summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootloader/mpio_hd200_hd300.c2
-rw-r--r--firmware/target/coldfire/mpio/ata-mpio.c15
-rw-r--r--firmware/target/coldfire/mpio/usb-mpio.c27
3 files changed, 20 insertions, 24 deletions
diff --git a/bootloader/mpio_hd200_hd300.c b/bootloader/mpio_hd200_hd300.c
index 97e49d5..14f7635 100644
--- a/bootloader/mpio_hd200_hd300.c
+++ b/bootloader/mpio_hd200_hd300.c
@@ -492,6 +492,7 @@ void main(void)
/* init USB */
ide_power_enable(true);
sleep(HZ/20);
+ ata_enable(false);
usb_enable(true);
}
@@ -512,6 +513,7 @@ void main(void)
{
/* disable USB */
usb_enable(false);
+ ata_enable(true);
sleep(HZ);
ide_power_enable(false);
sleep(HZ);
diff --git a/firmware/target/coldfire/mpio/ata-mpio.c b/firmware/target/coldfire/mpio/ata-mpio.c
index db03095..f993dd9 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 a8c3db8..9436517 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 */
}
}