From patchwork Tue Oct 7 13:36:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 38404 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 02AAA2057C for ; Tue, 7 Oct 2014 13:44:13 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf4102088lab.7 for ; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=I37tH3KPp9uDJ2r8ijRldaXInGGtoal1lo090S/wb+A=; b=Qkw3+FDyYY8rPZVhE8Nx25sJPH2gBOW10eThdKrIygX3laC2hem03odCOBuoHpqAzb N8BveWx2IuFgz4auLel29Yln2qGnNtXOHkKcg4T68Z+NlDihQg+8JzqwoAT7ARdqai9e 7jqNu4yAM42O/USxridWFri1yIwnHN8xtdpMs7xbaToVWxwD4UrEguxqAzhd0noPCcb7 NPUUS5qRRoFwOwBkO4taR6rXE4EMihZjfUjzpvfxshZkuDJATV6yOUPqRvk8t1Agz3Pg 41tl2iSecuqt2FXyyWzu0QuHe//O6c6oZF//jKj/0xOpj6Scbd5JmerBLO0gooM+qr+C qKoQ== X-Gm-Message-State: ALoCoQnAHIRIkg+ine8iuieQIW5WGYjVnP6DjKPAQ/ULfuSkvhVOSS9V34Z3+kRU7MY92vHPb08X X-Received: by 10.112.74.80 with SMTP id r16mr37113lbv.21.1412689452810; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.107 with SMTP id lv11ls648694lac.14.gmail; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) X-Received: by 10.153.4.44 with SMTP id cb12mr4352174lad.35.1412689452654; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id ue9si28874144lac.20.2014.10.07.06.44.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 06:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id w7so6236223lbi.9 for ; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) X-Received: by 10.153.7.73 with SMTP id da9mr4334418lad.56.1412689452075; Tue, 07 Oct 2014 06:44:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp352797lbb; Tue, 7 Oct 2014 06:44:11 -0700 (PDT) X-Received: by 10.180.210.201 with SMTP id mw9mr28141823wic.35.1412689451393; Tue, 07 Oct 2014 06:44:11 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id fq8si14211153wib.63.2014.10.07.06.44.10 for ; Tue, 07 Oct 2014 06:44:11 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CB30E4B653; Tue, 7 Oct 2014 15:44:07 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L33GyYDYb2Ha; Tue, 7 Oct 2014 15:44:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CC580A743F; Tue, 7 Oct 2014 15:44:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4EC64B638 for ; Tue, 7 Oct 2014 15:44:00 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v4dqoFkIEqk9 for ; Tue, 7 Oct 2014 15:44:00 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by theia.denx.de (Postfix) with ESMTPS id 108544B635 for ; Tue, 7 Oct 2014 15:43:57 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.04,670,1406592000"; d="scan'208";a="178964503" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Tue, 7 Oct 2014 09:43:45 -0400 Received: from kazak.uk.xensource.com ([10.80.2.80] helo=zakaz.uk.xensource.com) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1XbUw7-0001lb-2C; Tue, 07 Oct 2014 14:36:20 +0100 Received: by zakaz.uk.xensource.com (sSMTP sendmail emulation); Tue, 07 Oct 2014 14:36:19 +0100 From: Ian Campbell To: , Minkyu Kang Date: Tue, 7 Oct 2014 14:36:19 +0100 Message-ID: <1412688979-1236-1-git-send-email-ijc@hellion.org.uk> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell Subject: [U-Boot] [PATCH] HACK: arndale: deinit scsi before launching Linux X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ijc@hellion.org.uk X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Ian Campbell NOT TO BE APPLIED AS IS Without this Linux fails to correctly init the phy (or something) and cannot detect the disk. Even with this we can fail to detect the disk outselves on some fraction of boots, so something else is clearly up too. --- arch/arm/cpu/armv7/exynos/sata.c | 11 +++++++++++ arch/arm/lib/bootm.c | 4 ++++ board/samsung/arndale/arndale.c | 5 +++++ drivers/block/ahci.c | 4 ++++ include/scsi.h | 1 + 5 files changed, 25 insertions(+) diff --git a/arch/arm/cpu/armv7/exynos/sata.c b/arch/arm/cpu/armv7/exynos/sata.c index 14d42e7..05f1372 100644 --- a/arch/arm/cpu/armv7/exynos/sata.c +++ b/arch/arm/cpu/armv7/exynos/sata.c @@ -310,6 +310,11 @@ static int exynos5_ahci_init(void __iomem *mmio) printf("%s: already calibrated?\n", __func__); } + /* Clear phy control enable. Seems to be necessary to + * reinitialise on a warm reboot, at least sometimes. */ + clrbits_le32(EXYNOS5_SATA_PHY_CONTROL, S5P_PMU_SATA_PHY_CONTROL_EN); + udelay(1000); + setbits_le32(EXYNOS5_SATA_PHY_CONTROL, S5P_PMU_SATA_PHY_CONTROL_EN); __raw_writel(0, phy_ctrl + SATA_RESET); @@ -368,3 +373,9 @@ int exynos5_sata_init(void) } return -ENODEV; } + +int exynos5_sata_deinit(void) +{ + clrbits_le32(EXYNOS5_SATA_PHY_CONTROL, S5P_PMU_SATA_PHY_CONTROL_EN); + return 0; +} diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 39fe7a1..9c8d242 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,9 @@ static void announce_and_cleanup(int fake) #ifdef CONFIG_USB_DEVICE udc_disconnect(); #endif +#ifdef CONFIG_SCSI_AHCI_PLAT + scsi_deinit(); +#endif cleanup_before_linux(); } diff --git a/board/samsung/arndale/arndale.c b/board/samsung/arndale/arndale.c index 551bfce..43c9694 100644 --- a/board/samsung/arndale/arndale.c +++ b/board/samsung/arndale/arndale.c @@ -36,6 +36,11 @@ int scsi_init(void) printf("ARNDALE SCSI INIT\n"); return exynos5_sata_init(); } + +int scsi_deinit(void) +{ + return exynos5_sata_deinit(); +} #endif int board_init(void) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index a93a8e1..a7e57be 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -959,6 +959,10 @@ void __weak scsi_init(void) { } +void __weak scsi_deinit(void) +{ +} + #endif /* diff --git a/include/scsi.h b/include/scsi.h index 73de7b7..06ad192 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -172,6 +172,7 @@ void scsi_low_level_init(int busdevfunc); * functions residing inside cmd_scsi.c */ void scsi_init(void); +void scsi_deinit(void); void scsi_scan(int mode); /** @return the number of scsi disks */