From e63e62b2a1d849b9a965e989b3ce18576c0ac521 Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Wed, 20 Sep 2006 23:21:59 +0000 Subject: Detect charger connected on H10. No need to sleep(HZ) when powering off. More sensible USB support for H10: plugging in puts it into USB charging mode and leaves Rockbox usable, holding 'O' while pluggin in the USB cable will reboot the H10 (continuing to hold 'O' starts it up in UMS mode), holding any other button brings up the USB screen as previously. Implement system_reboot() for all PP5020 devices. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11015 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/iriver/h10/usb-h10.c | 63 +++----------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) (limited to 'firmware/target/arm/iriver/h10/usb-h10.c') diff --git a/firmware/target/arm/iriver/h10/usb-h10.c b/firmware/target/arm/iriver/h10/usb-h10.c index bf687fef47..55d2a0ff75 100644 --- a/firmware/target/arm/iriver/h10/usb-h10.c +++ b/firmware/target/arm/iriver/h10/usb-h10.c @@ -16,10 +16,6 @@ * KIND, either express or implied. * ****************************************************************************/ - -/* Code from the iPod port but commented out. USB detection custom made based - on GPIO analysis */ - #include "config.h" #include "cpu.h" #include "kernel.h" @@ -37,52 +33,11 @@ #include "sprintf.h" #include "string.h" #include "hwcompat.h" -#ifdef HAVE_MMC -#include "ata_mmc.h" -#endif +#include "pp5020.h" void usb_init_device(void) { -#if 0 - int r0; - outl(inl(0x70000084) | 0x200, 0x70000084); - - outl(inl(0x7000002C) | 0x3000000, 0x7000002C); - outl(inl(0x6000600C) | 0x400000, 0x6000600C); - - outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */ - outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */ - - outl(inl(0x70000020) | 0x80000000, 0x70000020); - while ((inl(0x70000028) & 0x80) == 0); - - outl(inl(0xc5000184) | 0x100, 0xc5000184); - while ((inl(0xc5000184) & 0x100) != 0); - - outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4); - if ((inl(0xc50001A4) & 0x100) == 0) { - outl(inl(0xc50001A8) & ~0x3, 0xc50001A8); - outl(inl(0xc50001A8) | 0x2, 0xc50001A8); - outl(inl(0x70000028) | 0x4000, 0x70000028); - outl(inl(0x70000028) | 0x2, 0x70000028); - } else { - outl(inl(0xc50001A8) | 0x3, 0xc50001A8); - outl(inl(0x70000028) &~0x4000, 0x70000028); - outl(inl(0x70000028) | 0x2, 0x70000028); - } - outl(inl(0xc5000140) | 0x2, 0xc5000140); - while((inl(0xc5000140) & 0x2) != 0); - r0 = inl(0xc5000184); - - /* Note from IPL source (referring to next 5 lines of code: - THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ - outl(inl(0x70000020) | 0x80000000, 0x70000020); - outl(inl(0x6000600C) | 0x400000, 0x6000600C); - while ((inl(0x70000028) & 0x80) == 0); - outl(inl(0x70000028) | 0x2, 0x70000028); - - udelay(0x186A0); -#endif + /* USB is initialized by bootloader */ } bool usb_detect(void) @@ -92,16 +47,10 @@ bool usb_detect(void) void usb_enable(bool on) { - (void)on; -#if 0 - /* For the ipod, we can only do one thing with USB mode - reboot - into Apple's flash-based disk-mode. This does not return. */ - if (on) + /* For the H10, we reboot if BUTTON_RIGHT is held so that the iriver + * bootloader can start up in UMS mode. This does not return. */ + if (on && (button_status()==BUTTON_RIGHT)) { - /* The following code is copied from ipodlinux */ - unsigned char* storage_ptr = (unsigned char *)0x40017F00; - memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); - DEV_RS |= 4; /* Reboot */ + system_reboot(); } -#endif } -- cgit v1.2.3