From 9560ba66969c5bd7030da99acdf8f6fb34f3bfa0 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 5 May 2008 11:21:04 +0000 Subject: [PATCH] Mind repeat calls to ata_device_init. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17373 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/imx31/gigabeat-s/ata-imx31.c | 18 ++++++++++++++++-- 1 file 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 @@ #include "power.h" #include "panic.h" #include "ata.h" +#include "ata-target.h" #include "clkctl-imx31.h" static const struct ata_pio_timings @@ -78,6 +79,8 @@ static const struct ata_pio_timings }, }; +static bool initialized = false; + /* Setup the timing for PIO mode */ static void ata_set_pio_mode(int mode) { @@ -125,8 +128,19 @@ void ata_device_init(void) { ATA_INTF_CONTROL |= ATA_ATA_RST; /* Make sure we're not in reset mode */ - /* Setup mode 0 by default */ - ata_set_pio_mode(0); + if (!initialized) + { + initialized = true; + /* Setup mode 0 by default */ + ata_set_pio_mode(0); + /* mode may be switched later once identify info is ready in which + * case the main driver calls back */ + } + else + { + /* identify info will be ready */ + ata_identify_ready(); + } } void ata_identify_ready(void)