summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-12-09 11:31:08 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-12-09 11:31:08 +0000
commit0358e7b86479d62aa752002d9058f3220ffa5304 (patch)
treeedc452c15c148723c9e22ff815c74e7e613f3eb1 /firmware/target/coldfire
parent14b3108fa5ea7427b9cd51cece92eda863c1309f (diff)
downloadrockbox-0358e7b86479d62aa752002d9058f3220ffa5304.tar.gz
rockbox-0358e7b86479d62aa752002d9058f3220ffa5304.tar.bz2
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
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/mpio/ata-mpio.c15
-rw-r--r--firmware/target/coldfire/mpio/usb-mpio.c27
2 files changed, 18 insertions, 24 deletions
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)
void ata_enable(bool on)
{
- (void)on;
+ /* GPO36 /reset line of GL811E */
+ if (on)
+ and_l(~(1<<4), &GPIO1_OUT);
+ else
+ or_l((1<<4), &GPIO1_OUT);
+
+ or_l((1<<4), &GPIO1_ENABLE);
+ or_l((1<<4), &GPIO1_FUNCTION);
}
-/* to be fixed */
bool ata_is_coldstart(void)
{
- return true;
+ /* check if ATA reset line is configured
+ * as GPIO
+ */
+ return (GPIO_FUNCTION & (1<<19)) == 0;
}
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)
/* GPIO42 is USB detect input
* but it also serves as MCLK2 for DAC
*/
- and_l(~(1<<4), &GPIO1_OUT); /* GPIO36 low */
- or_l((1<<4), &GPIO1_ENABLE); /* GPIO36 */
- or_l((1<<4)|(1<<5), &GPIO1_FUNCTION); /* GPIO36 GPIO37 */
/* GPIO22 GPIO30 high */
or_l((1<<22)|(1<<30), &GPIO_OUT);
@@ -48,28 +45,16 @@ int usb_detect(void)
void usb_enable(bool on)
{
- /* one second timeout */
- unsigned char timeout = 10;
-
if(on)
{
- and_l(~(1<<30),&GPIO_OUT); /* GPIO30 low */
- and_l(~(1<<22),&GPIO_OUT); /* GPIO22 low */
-
- or_l((1<<4),&GPIO1_OUT); /* GPIO36 high */
-
+ /* Turn on power for GL811E bridge */
+ and_l(~((1<<30)|(1<<22)),&GPIO_OUT); /* GPIO30 low */
+ /* GPIO22 low */
}
else
{
- or_l((1<<22),&GPIO_OUT); /* GPIO22 high */
- or_l((1<<30),&GPIO_OUT); /* GPIO30 high */
-
- and_l(~(1<<4),&GPIO1_OUT); /* GPIO36 low */
-
- while ( !(GPIO1_READ & (1<<5)) && timeout--)
- {
- sleep(HZ/10);
- }
- sleep(HZ);
+ /* Turn off power */
+ or_l((1<<30)|(1<<22),&GPIO_OUT); /* GPIO22 high */
+ /* GPIO30 high */
}
}