diff options
author | Tom Rini <trini@ti.com> | 2015-01-26 17:44:49 -0500 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2015-01-26 17:44:49 -0500 |
commit | ab92da9f47d51d363c7de42e2a7bd807e2c1bd54 (patch) | |
tree | dfabc29929e39a1ecc47edf5a4cf839ead062acd /drivers/block/ahci.c | |
parent | aed03faa064cca56847571b13cbd4c849c6116aa (diff) | |
parent | e43ade3749ff10bc313f33bf23705465e4163896 (diff) | |
download | u-boot-imx-ab92da9f47d51d363c7de42e2a7bd807e2c1bd54.zip u-boot-imx-ab92da9f47d51d363c7de42e2a7bd807e2c1bd54.tar.gz u-boot-imx-ab92da9f47d51d363c7de42e2a7bd807e2c1bd54.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'drivers/block/ahci.c')
-rw-r--r-- | drivers/block/ahci.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index 37d2d2a..c908fab 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -513,6 +513,20 @@ static void ahci_set_feature(u8 port) } #endif +static int wait_spinup(volatile u8 *port_mmio) +{ + ulong start; + u32 tf_data; + + start = get_timer(0); + do { + tf_data = readl(port_mmio + PORT_TFDATA); + if (!(tf_data & ATA_BUSY)) + return 0; + } while (get_timer(start) < WAIT_MS_SPINUP); + + return -ETIMEDOUT; +} static int ahci_port_start(u8 port) { @@ -579,7 +593,11 @@ static int ahci_port_start(u8 port) debug("Exit start port %d\n", port); - return 0; + /* + * Make sure interface is not busy based on error and status + * information from task file data register before proceeding + */ + return wait_spinup(port_mmio); } |