public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] HACK: arndale: deinit scsi before launching Linux
Date: Tue, 7 Oct 2014 14:56:40 +0100	[thread overview]
Message-ID: <1412690200-6630-2-git-send-email-ijc@hellion.org.uk> (raw)
In-Reply-To: <1412690172.4972.31.camel@hellion.org.uk>

From: Ian Campbell <ian.campbell@citrix.com>

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 <common.h>
 #include <command.h>
 #include <image.h>
+#include <scsi.h>
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
 #include <libfdt.h>
@@ -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 */
-- 
2.1.0

  parent reply	other threads:[~2014-10-07 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 13:56 [U-Boot] [PATCH RFC 0/2] u-boot: arndale: Support for SATA controller Ian Campbell
2014-10-07 13:56 ` [U-Boot] [PATCH 1/2] exynos5250/arndale: Enable SATA/AHCI support Ian Campbell
2014-10-26  7:27   ` Minkyu Kang
2014-10-29 10:34     ` Ian Campbell
2014-10-29 14:09       ` Minkyu Kang
2014-10-07 13:56 ` Ian Campbell [this message]
2014-10-08  8:18   ` [U-Boot] [PATCH 2/2] HACK: arndale: deinit scsi before launching Linux Wolfgang Denk
2014-10-09  7:40     ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412690200-6630-2-git-send-email-ijc@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox