mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
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
This commit is contained in:
parent
14b3108fa5
commit
0358e7b864
3 changed files with 20 additions and 24 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue