diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-12-09 11:31:08 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-12-09 11:31:08 +0000 |
commit | 0358e7b86479d62aa752002d9058f3220ffa5304 (patch) | |
tree | edc452c15c148723c9e22ff815c74e7e613f3eb1 | |
parent | 14b3108fa5ea7427b9cd51cece92eda863c1309f (diff) | |
download | rockbox-0358e7b86479d62aa752002d9058f3220ffa5304.tar.gz rockbox-0358e7b86479d62aa752002d9058f3220ffa5304.zip |
MPIO HD200, HD300: Make USB bridge handling more correct (this doesn't solve problems with USB inside rockbox on HD300 unfortunately).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28780 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | bootloader/mpio_hd200_hd300.c | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/mpio/ata-mpio.c | 15 | ||||
-rw-r--r-- | firmware/target/coldfire/mpio/usb-mpio.c | 27 |
3 files changed, 20 insertions, 24 deletions
diff --git a/bootloader/mpio_hd200_hd300.c b/bootloader/mpio_hd200_hd300.c index 97e49d552c..14f76354fb 100644 --- a/bootloader/mpio_hd200_hd300.c +++ b/bootloader/mpio_hd200_hd300.c | |||
@@ -492,6 +492,7 @@ void main(void) | |||
492 | /* init USB */ | 492 | /* init USB */ |
493 | ide_power_enable(true); | 493 | ide_power_enable(true); |
494 | sleep(HZ/20); | 494 | sleep(HZ/20); |
495 | ata_enable(false); | ||
495 | usb_enable(true); | 496 | usb_enable(true); |
496 | } | 497 | } |
497 | 498 | ||
@@ -512,6 +513,7 @@ void main(void) | |||
512 | { | 513 | { |
513 | /* disable USB */ | 514 | /* disable USB */ |
514 | usb_enable(false); | 515 | usb_enable(false); |
516 | ata_enable(true); | ||
515 | sleep(HZ); | 517 | sleep(HZ); |
516 | ide_power_enable(false); | 518 | ide_power_enable(false); |
517 | sleep(HZ); | 519 | sleep(HZ); |
diff --git a/firmware/target/coldfire/mpio/ata-mpio.c b/firmware/target/coldfire/mpio/ata-mpio.c index db03095e3d..f993dd9178 100644 --- a/firmware/target/coldfire/mpio/ata-mpio.c +++ b/firmware/target/coldfire/mpio/ata-mpio.c | |||
@@ -39,13 +39,22 @@ void ata_reset(void) | |||
39 | 39 | ||
40 | void ata_enable(bool on) | 40 | void ata_enable(bool on) |
41 | { | 41 | { |
42 | (void)on; | 42 | /* GPO36 /reset line of GL811E */ |
43 | if (on) | ||
44 | and_l(~(1<<4), &GPIO1_OUT); | ||
45 | else | ||
46 | or_l((1<<4), &GPIO1_OUT); | ||
47 | |||
48 | or_l((1<<4), &GPIO1_ENABLE); | ||
49 | or_l((1<<4), &GPIO1_FUNCTION); | ||
43 | } | 50 | } |
44 | 51 | ||
45 | /* to be fixed */ | ||
46 | bool ata_is_coldstart(void) | 52 | bool ata_is_coldstart(void) |
47 | { | 53 | { |
48 | return true; | 54 | /* check if ATA reset line is configured |
55 | * as GPIO | ||
56 | */ | ||
57 | return (GPIO_FUNCTION & (1<<19)) == 0; | ||
49 | } | 58 | } |
50 | 59 | ||
51 | void ata_device_init(void) | 60 | void ata_device_init(void) |
diff --git a/firmware/target/coldfire/mpio/usb-mpio.c b/firmware/target/coldfire/mpio/usb-mpio.c index a8c3db85bd..9436517134 100644 --- a/firmware/target/coldfire/mpio/usb-mpio.c +++ b/firmware/target/coldfire/mpio/usb-mpio.c | |||
@@ -30,9 +30,6 @@ void usb_init_device(void) | |||
30 | /* GPIO42 is USB detect input | 30 | /* GPIO42 is USB detect input |
31 | * but it also serves as MCLK2 for DAC | 31 | * but it also serves as MCLK2 for DAC |
32 | */ | 32 | */ |
33 | and_l(~(1<<4), &GPIO1_OUT); /* GPIO36 low */ | ||
34 | or_l((1<<4), &GPIO1_ENABLE); /* GPIO36 */ | ||
35 | or_l((1<<4)|(1<<5), &GPIO1_FUNCTION); /* GPIO36 GPIO37 */ | ||
36 | 33 | ||
37 | /* GPIO22 GPIO30 high */ | 34 | /* GPIO22 GPIO30 high */ |
38 | or_l((1<<22)|(1<<30), &GPIO_OUT); | 35 | or_l((1<<22)|(1<<30), &GPIO_OUT); |
@@ -48,28 +45,16 @@ int usb_detect(void) | |||
48 | 45 | ||
49 | void usb_enable(bool on) | 46 | void usb_enable(bool on) |
50 | { | 47 | { |
51 | /* one second timeout */ | ||
52 | unsigned char timeout = 10; | ||
53 | |||
54 | if(on) | 48 | if(on) |
55 | { | 49 | { |
56 | and_l(~(1<<30),&GPIO_OUT); /* GPIO30 low */ | 50 | /* Turn on power for GL811E bridge */ |
57 | and_l(~(1<<22),&GPIO_OUT); /* GPIO22 low */ | 51 | and_l(~((1<<30)|(1<<22)),&GPIO_OUT); /* GPIO30 low */ |
58 | 52 | /* GPIO22 low */ | |
59 | or_l((1<<4),&GPIO1_OUT); /* GPIO36 high */ | ||
60 | |||
61 | } | 53 | } |
62 | else | 54 | else |
63 | { | 55 | { |
64 | or_l((1<<22),&GPIO_OUT); /* GPIO22 high */ | 56 | /* Turn off power */ |
65 | or_l((1<<30),&GPIO_OUT); /* GPIO30 high */ | 57 | or_l((1<<30)|(1<<22),&GPIO_OUT); /* GPIO22 high */ |
66 | 58 | /* GPIO30 high */ | |
67 | and_l(~(1<<4),&GPIO1_OUT); /* GPIO36 low */ | ||
68 | |||
69 | while ( !(GPIO1_READ & (1<<5)) && timeout--) | ||
70 | { | ||
71 | sleep(HZ/10); | ||
72 | } | ||
73 | sleep(HZ); | ||
74 | } | 59 | } |
75 | } | 60 | } |