diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config-h10.h | 9 | ||||
-rw-r--r-- | firmware/export/config-h10_5gb.h | 9 | ||||
-rw-r--r-- | firmware/export/pp5020.h | 2 | ||||
-rw-r--r-- | firmware/system.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/iriver/h10/power-h10.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/iriver/h10/usb-h10.c | 63 | ||||
-rw-r--r-- | firmware/usb.c | 3 |
7 files changed, 22 insertions, 71 deletions
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index c024fd464c..df42068fb8 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -85,12 +85,11 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Hardware controlled charging? FIXME */ -//#define CONFIG_CHARGING CHARGING_SIMPLE +/* Hardware controlled charging */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ -/* TODO: should this be set for the H10? */ -//#define HAVE_POWEROFF_WHILE_CHARGING +#define HAVE_POWEROFF_WHILE_CHARGING /* The start address index for ROM builds */ #define ROM_START 0x00000000 @@ -128,7 +127,7 @@ /* #define USB_IPODSTYLE */ /* define this if the unit can be powered or charged via USB */ -/*#define HAVE_USB_POWER*/ +#define HAVE_USB_POWER /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 9ad7eede2e..35d54679eb 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -81,12 +81,11 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ #define BATTERY_SCALE_FACTOR 5865 -/* Hardware controlled charging? FIXME */ -//#define CONFIG_CHARGING CHARGING_SIMPLE +/* Hardware controlled charging */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define this if the hardware can be powered off while charging */ -/* TODO: should this be set for the H10? */ -//#define HAVE_POWEROFF_WHILE_CHARGING +#define HAVE_POWEROFF_WHILE_CHARGING /* The start address index for ROM builds */ #define ROM_START 0x00000000 @@ -110,7 +109,7 @@ /* #define USB_IPODSTYLE */ /* define this if the unit can be powered or charged via USB */ -/*#define HAVE_USB_POWER*/ +#define HAVE_USB_POWER /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h index ccb49a0d90..37d8882519 100644 --- a/firmware/export/pp5020.h +++ b/firmware/export/pp5020.h @@ -125,6 +125,8 @@ #define DEV_RS (*(volatile unsigned long *)(0x60006004)) #define DEV_EN (*(volatile unsigned long *)(0x6000600c)) +#define DEV_SYSTEM 0x4 + #define TIMER1_CFG (*(volatile unsigned long *)(0x60005000)) #define TIMER1_VAL (*(volatile unsigned long *)(0x60005004)) #define TIMER2_CFG (*(volatile unsigned long *)(0x60005008)) diff --git a/firmware/system.c b/firmware/system.c index 9b2f1ba5a4..81c5a36917 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1316,6 +1316,8 @@ void system_init(void) void system_reboot(void) { + /* Reboot */ + DEV_RS |= DEV_SYSTEM; } int system_memory_guard(int newmode) diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c index 6e7b65a803..143248efcd 100644 --- a/firmware/target/arm/iriver/h10/power-h10.c +++ b/firmware/target/arm/iriver/h10/power-h10.c @@ -71,7 +71,7 @@ void power_init(void) bool charger_inserted(void) { - return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */ + return (GPIOF_INPUT_VAL & 0x08)?true:false; } void ide_power_enable(bool on) @@ -89,8 +89,5 @@ bool ide_powered(void) void power_off(void) { - /* Give things a second to settle before cutting power */ - sleep(HZ); - GPIOF_OUTPUT_VAL &=~ 0x20; } 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 } diff --git a/firmware/usb.c b/firmware/usb.c index 0be6c4011e..ce9d1ce69f 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -80,6 +80,9 @@ void screen_dump(void); /* Nasty again. Defined in apps/ too */ #elif CONFIG_KEYPAD == GIGABEAT_PAD #define USBPOWER_BUTTON BUTTON_MENU #define USBPOWER_BTN_IGNORE BUTTON_POWER +#elif CONFIG_KEYPAD == IRIVER_H10_PAD +#define USBPOWER_BUTTON BUTTON_NONE +#define USBPOWER_BTN_IGNORE BUTTON_POWER #endif #endif /* HAVE_USB_POWER */ |