From 557ebcedfbb0b9093a41425fbaa1cba28a693e69 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 15 Apr 2022 13:53:18 +0200 Subject: [PATCH] liblitesata/sata_init: Always reinitialize core on call (Even when already ready). --- litex/soc/software/liblitesata/sata.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/litex/soc/software/liblitesata/sata.c b/litex/soc/software/liblitesata/sata.c index 07f39b893..6f96a1ad6 100644 --- a/litex/soc/software/liblitesata/sata.c +++ b/litex/soc/software/liblitesata/sata.c @@ -22,18 +22,18 @@ int sata_init(void) { uint16_t timeout; - for (timeout=10; timeout>0; timeout--) { + /* Reset SATA PHY */ + sata_phy_enable_write(0); + busy_wait(1); + sata_phy_enable_write(1); + + /* Wait for 100ms */ + busy_wait(100); + /* Check SATA PHY status */ if (sata_phy_status_read() & 0x1) return 1; - - /* Reset SATA PHY */ - sata_phy_enable_write(0); - sata_phy_enable_write(1); - - /* Wait for 10ms */ - busy_wait(10); } return 0;