From patchwork Tue Oct 7 13:56:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 38406 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F1C6E2057C for ; Tue, 7 Oct 2014 13:56:53 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf4084500wgh.7 for ; Tue, 07 Oct 2014 06:56:53 -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:in-reply-to :references: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=coXi5uh0lD+ipRAM/V4jXVBGB8VtLSdvblVc3mgGLk4+iuL7fxzX1QsJ/rymMW8TLl EbvjIgFwu8gppJxY0Cx7CU/Zv9JpGgzeAOELxSSFOWEhtWoScRp1/7xfhP7rkREMgdwX f7pU82rO4yX8d7C9SxrDPgefK8j1QLgq+aF1kWJNuPdLG/EiIl5p49WXAPganGFrpUTK uI7jK0CBnBgpMDC/SpD1pHDBpcwmU5i9vXu5b0g0OxF7r9KkMP8yeOv90mxRr5eUwODg RYyQxdba6EQQNKZ1V+zt8DsyjNzu5iin3FeFavCJMt0MvQpP+RvXjUCKMrZ1LLSBcPIF ZCjQ== X-Gm-Message-State: ALoCoQmJmgaqhpFcfjVF7evb7ouVfXuQoI/N6ElpzCL11WL4acNhuWGLp/JVgtshp0E+dSR3jG5m X-Received: by 10.112.198.226 with SMTP id jf2mr606550lbc.1.1412690213122; Tue, 07 Oct 2014 06:56:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.44 with SMTP id t12ls438349lal.104.gmail; Tue, 07 Oct 2014 06:56:52 -0700 (PDT) X-Received: by 10.152.21.226 with SMTP id y2mr4426085lae.34.1412690212949; Tue, 07 Oct 2014 06:56:52 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) by mx.google.com with ESMTPS id h3si12935472lag.57.2014.10.07.06.56.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 06:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id q1so6351553lam.22 for ; Tue, 07 Oct 2014 06:56:52 -0700 (PDT) X-Received: by 10.152.22.137 with SMTP id d9mr4413555laf.29.1412690212733; Tue, 07 Oct 2014 06:56:52 -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 of9csp355041lbb; Tue, 7 Oct 2014 06:56:52 -0700 (PDT) X-Received: by 10.180.75.210 with SMTP id e18mr28396111wiw.6.1412690212109; Tue, 07 Oct 2014 06:56:52 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id h7si14275923wie.43.2014.10.07.06.56.51 for ; Tue, 07 Oct 2014 06:56:52 -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 776ACA7413; Tue, 7 Oct 2014 15:56:51 +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 CU3vq0VIyaVz; Tue, 7 Oct 2014 15:56:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA57B4B664; Tue, 7 Oct 2014 15:56:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 99F27A73E5 for ; Tue, 7 Oct 2014 15:56:47 +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 XdUurod8n3KJ for ; Tue, 7 Oct 2014 15:56:47 +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 231754B662 for ; Tue, 7 Oct 2014 15:56:44 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.04,670,1406592000"; d="scan'208";a="178969689" 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:56:42 -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 1XbVFp-0002uX-9b; Tue, 07 Oct 2014 14:56:42 +0100 Received: by zakaz.uk.xensource.com (sSMTP sendmail emulation); Tue, 07 Oct 2014 14:56:41 +0100 From: Ian Campbell To: , Minkyu Kang Date: Tue, 7 Oct 2014 14:56:40 +0100 Message-ID: <1412690200-6630-2-git-send-email-ijc@hellion.org.uk> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412690172.4972.31.camel@hellion.org.uk> References: <1412690172.4972.31.camel@hellion.org.uk> MIME-Version: 1.0 X-DLP: MIA1 Cc: Kukjin Kim , Yuvaraj Kumar C D , Taylor Hutt , Ian Campbell Subject: [U-Boot] [PATCH 2/2] 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.215.49 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 */