diff mbox

[U-Boot,4/5] arm: omap: reset sata on boot

Message ID 1418652179-15311-5-git-send-email-lifshitz@compulab.co.il
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Dmitry Lifshitz Dec. 15, 2014, 2:02 p.m. UTC
On OMAP platforms (like OMAP5) Linux kernel fails to detect a SATA
device if it is used by U-Boot.

It happens because U-Boot does not reset SATA controller before boot.

Reset the controller on OS boot so that Linux will have a clean state
to work with.

Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>
---
 arch/arm/cpu/armv7/omap-common/boot-common.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Comments

Tom Rini Dec. 15, 2014, 5 p.m. UTC | #1
On Mon, Dec 15, 2014 at 04:02:58PM +0200, Dmitry Lifshitz wrote:

> On OMAP platforms (like OMAP5) Linux kernel fails to detect a SATA
> device if it is used by U-Boot.
> 
> It happens because U-Boot does not reset SATA controller before boot.
> 
> Reset the controller on OS boot so that Linux will have a clean state
> to work with.
> 
> Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>

To be clear, since we're using CMD_SCSI and not CMD_SATA is why we need
this reset sequence here instead of the sata_stop() that say i.MX uses.

Reviewed-by: Tom Rini <trini@ti.com>
Dmitry Lifshitz Dec. 16, 2014, 6:50 a.m. UTC | #2
Hi Tom,

On 12/15/2014 07:00 PM, Tom Rini wrote:
> On Mon, Dec 15, 2014 at 04:02:58PM +0200, Dmitry Lifshitz wrote:
>
>> On OMAP platforms (like OMAP5) Linux kernel fails to detect a SATA
>> device if it is used by U-Boot.
>>
>> It happens because U-Boot does not reset SATA controller before boot.
>>
>> Reset the controller on OS boot so that Linux will have a clean state
>> to work with.
>>
>> Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>
>
> To be clear, since we're using CMD_SCSI and not CMD_SATA is why we need
> this reset sequence here instead of the sata_stop() that say i.MX uses.

You are right, sata_stop() can be used here.

Unfortunately, OMAP SATA access is implemented via SCSI, so I managed to 
implement this workaround.

Regards,

Dmitry
Tom Rini Jan. 7, 2015, 3:12 p.m. UTC | #3
On Mon, Dec 15, 2014 at 04:02:58PM +0200, Dmitry Lifshitz wrote:

> On OMAP platforms (like OMAP5) Linux kernel fails to detect a SATA
> device if it is used by U-Boot.
> 
> It happens because U-Boot does not reset SATA controller before boot.
> 
> Reset the controller on OS boot so that Linux will have a clean state
> to work with.
> 
> Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>
> Reviewed-by: Tom Rini <trini@ti.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index cb18908..00a1082 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -9,12 +9,14 @@ 
  */
 
 #include <common.h>
+#include <ahci.h>
 #include <spl.h>
 #include <asm/omap_common.h>
 #include <asm/arch/omap.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <watchdog.h>
+#include <scsi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -143,3 +145,10 @@  void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 	image_entry((u32 *)&gd->arch.omap_boot_params);
 }
 #endif
+
+#ifdef CONFIG_SCSI_AHCI_PLAT
+void arch_preboot_os(void)
+{
+	ahci_reset(DWC_AHSATA_BASE);
+}
+#endif