USB support for H300

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8167 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-12-06 10:06:40 +00:00
parent c9016f82e0
commit 55e9670c70
2 changed files with 28 additions and 11 deletions

View file

@ -235,9 +235,7 @@ void init(void)
adc_init(); adc_init();
#ifndef IRIVER_H300_SERIES
usb_init(); usb_init();
#endif
backlight_init(); backlight_init();
@ -285,7 +283,6 @@ void init(void)
panicf("ata: %d", rc); panicf("ata: %d", rc);
} }
#ifndef IRIVER_H300_SERIES
usb_start_monitoring(); usb_start_monitoring();
while (usb_detect()) while (usb_detect())
{ /* enter USB mode early, before trying to mount */ { /* enter USB mode early, before trying to mount */
@ -302,7 +299,7 @@ void init(void)
break; break;
#endif #endif
} }
#endif
if (!mounted) if (!mounted)
{ {
rc = disk_mount_all(); rc = disk_mount_all();

View file

@ -136,13 +136,21 @@ static void usb_enable(bool on)
if(on) if(on)
{ {
/* Power on the Cypress chip */ /* Power on the Cypress chip */
or_l(0x01000000, &GPIO_OUT); #ifdef IRIVER_H100_SERIES
or_l(0x01000040, &GPIO_OUT);
#else
and_l(~0x00000008,&GPIO1_OUT);
#endif
sleep(2); sleep(2);
} }
else else
{ {
/* Power off the Cypress chip */ /* Power off the Cypress chip */
and_l(~0x01000000, &GPIO_OUT); #ifdef IRIVER_H100_SERIES
and_l(~0x01000040, &GPIO_OUT);
#else
or_l(0x00000008,&GPIO1_OUT);
#endif
} }
#elif defined(USB_IPODSTYLE) #elif defined(USB_IPODSTYLE)
@ -361,7 +369,7 @@ bool usb_detect(void)
#endif #endif
#ifdef IRIVER_H300 #ifdef IRIVER_H300
/* TODO: add proper code code for H300 USB style */ /* TODO: add proper code code for H300 USB style */
current_status = false; current_status = (GPIO1_READ & 0x80)?true:false;
#endif #endif
#ifdef USB_IPODSTYLE #ifdef USB_IPODSTYLE
/* TODO: Implement USB_IPODSTYLE */ /* TODO: Implement USB_IPODSTYLE */
@ -436,11 +444,23 @@ void usb_init(void)
countdown = -1; countdown = -1;
#ifdef USB_IRIVERSTYLE #ifdef USB_IRIVERSTYLE
and_l(~0x01000000, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
or_l(0x01000000, &GPIO_ENABLE);
or_l(0x01000000, &GPIO_FUNCTION);
or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */ or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */
#ifdef IRIVER_H300_SERIES
/* ISD300 3.3V ON */
or_l(8,&GPIO1_FUNCTION);
or_l(8,&GPIO1_OUT);
or_l(8,&GPIO1_ENABLE);
/* Tristate the SCK/SDA to the ISD300 config EEPROM */
and_l(~0x03000000, &GPIO_ENABLE);
or_l(0x03000000, &GPIO_FUNCTION);
#else
and_l(~0x01000040, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
or_l(0x01000040, &GPIO_ENABLE);
or_l(0x01000040, &GPIO_FUNCTION);
#endif
#endif #endif
usb_enable(false); usb_enable(false);