summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/ata-imx31.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/ata-imx31.c b/firmware/target/arm/imx31/gigabeat-s/ata-imx31.c
index 92c2300f89..965b447651 100644
--- a/firmware/target/arm/imx31/gigabeat-s/ata-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/ata-imx31.c
@@ -24,6 +24,7 @@
24#include "power.h" 24#include "power.h"
25#include "panic.h" 25#include "panic.h"
26#include "ata.h" 26#include "ata.h"
27#include "ata-target.h"
27#include "clkctl-imx31.h" 28#include "clkctl-imx31.h"
28 29
29static const struct ata_pio_timings 30static const struct ata_pio_timings
@@ -78,6 +79,8 @@ static const struct ata_pio_timings
78 }, 79 },
79}; 80};
80 81
82static bool initialized = false;
83
81/* Setup the timing for PIO mode */ 84/* Setup the timing for PIO mode */
82static void ata_set_pio_mode(int mode) 85static void ata_set_pio_mode(int mode)
83{ 86{
@@ -125,8 +128,19 @@ void ata_device_init(void)
125{ 128{
126 ATA_INTF_CONTROL |= ATA_ATA_RST; /* Make sure we're not in reset mode */ 129 ATA_INTF_CONTROL |= ATA_ATA_RST; /* Make sure we're not in reset mode */
127 130
128 /* Setup mode 0 by default */ 131 if (!initialized)
129 ata_set_pio_mode(0); 132 {
133 initialized = true;
134 /* Setup mode 0 by default */
135 ata_set_pio_mode(0);
136 /* mode may be switched later once identify info is ready in which
137 * case the main driver calls back */
138 }
139 else
140 {
141 /* identify info will be ready */
142 ata_identify_ready();
143 }
130} 144}
131 145
132void ata_identify_ready(void) 146void ata_identify_ready(void)