Skip to contentSkip to conversation

sunxi: ahci: Add a delay after enabling target power

PATCH New Hans de Goede 2 participants 2 messages Nov 14, 2014 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: ahci: Add a delay after enabling target power

If the target power is connected through a gpio, then give the target some time to power up before continuing with ahci / sata probing, this avoids link timeouts, without penalizing other boards where there is no target power gpio.

Why 500 ms ? I started with 200, that was not enough, then I went to 500 which worked, lowering it to 350 broke things again, so 500 seems the minimum my vertex2 needs to be ready to get probed.

---
 board/sunxi/ahci.c | 2 ++
 1 file changed, 2 insertions(+)
board/sunxi/ahci.c +2 -0
index 5e12328..b7f0dda 100644
@@ -76,6 +76,8 @@ void scsi_init(void)
 #ifdef CONFIG_SATAPWR
 	gpio_request(CONFIG_SATAPWR, "satapwr");
 	gpio_direction_output(CONFIG_SATAPWR, 1);
+	/* Give attached sata device time to power-up to avoid link timeouts */
+	mdelay(500);
 #endif
 
 	if (sunxi_ahci_phy_init(SUNXI_SATA_BASE) < 0)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 sunxi: ahci: Add a delay after enabling target power

Quoted 8 lines · Hans de Goede

If the target power is connected through a gpio, then give the target some time to power up before continuing with ahci / sata probing, this avoids link timeouts, without penalizing other boards where there is no target power gpio.

Why 500 ms ? I started with 200, that was not enough, then I went to 500 which worked, lowering it to 350 broke things again, so 500 seems the minimum my vertex2 needs to be ready to get probed.

;-)

Quoted 1 line