diff options
Diffstat (limited to 'firmware/target/coldfire/mpio/ata-mpio.c')
-rw-r--r-- | firmware/target/coldfire/mpio/ata-mpio.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/firmware/target/coldfire/mpio/ata-mpio.c b/firmware/target/coldfire/mpio/ata-mpio.c index f993dd9178..9ffa57a3f7 100644 --- a/firmware/target/coldfire/mpio/ata-mpio.c +++ b/firmware/target/coldfire/mpio/ata-mpio.c | |||
@@ -39,12 +39,38 @@ void ata_reset(void) | |||
39 | 39 | ||
40 | void ata_enable(bool on) | 40 | void ata_enable(bool on) |
41 | { | 41 | { |
42 | static bool init = true; | ||
43 | |||
44 | /* Ide power toggling is a nasty hack to allow USB bridge operation | ||
45 | * in rockbox. For some reason GL811E bridge doesn't like the state | ||
46 | * in which rockbox leaves drive (and vice versa). The only way | ||
47 | * I found out to recover is to do disk power cycle (I tried toggling | ||
48 | * reset line of the disk but it doesn't work). | ||
49 | */ | ||
50 | |||
42 | /* GPO36 /reset line of GL811E */ | 51 | /* GPO36 /reset line of GL811E */ |
43 | if (on) | 52 | if (on) |
53 | { | ||
44 | and_l(~(1<<4), &GPIO1_OUT); | 54 | and_l(~(1<<4), &GPIO1_OUT); |
55 | #ifndef BOOTLADER | ||
56 | if ( !init ) | ||
57 | { | ||
58 | ide_power_enable(false); | ||
59 | sleep(1); | ||
60 | ide_power_enable(true); | ||
61 | } | ||
62 | #endif | ||
63 | init = false; | ||
64 | } | ||
45 | else | 65 | else |
66 | { | ||
67 | #ifndef BOOTLOADER | ||
68 | ide_power_enable(false); | ||
69 | sleep(1); | ||
70 | ide_power_enable(true); | ||
71 | #endif | ||
46 | or_l((1<<4), &GPIO1_OUT); | 72 | or_l((1<<4), &GPIO1_OUT); |
47 | 73 | } | |
48 | or_l((1<<4), &GPIO1_ENABLE); | 74 | or_l((1<<4), &GPIO1_ENABLE); |
49 | or_l((1<<4), &GPIO1_FUNCTION); | 75 | or_l((1<<4), &GPIO1_FUNCTION); |
50 | } | 76 | } |