summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/export/config-h10.h9
-rw-r--r--firmware/export/config-h10_5gb.h9
-rw-r--r--firmware/export/pp5020.h2
-rw-r--r--firmware/system.c2
-rw-r--r--firmware/target/arm/iriver/h10/power-h10.c5
-rw-r--r--firmware/target/arm/iriver/h10/usb-h10.c63
-rw-r--r--firmware/usb.c3
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 @@
85#define BATTERY_TYPES_COUNT 1 /* only one type */ 85#define BATTERY_TYPES_COUNT 1 /* only one type */
86#define BATTERY_SCALE_FACTOR 5865 86#define BATTERY_SCALE_FACTOR 5865
87 87
88/* Hardware controlled charging? FIXME */ 88/* Hardware controlled charging */
89//#define CONFIG_CHARGING CHARGING_SIMPLE 89#define CONFIG_CHARGING CHARGING_SIMPLE
90 90
91/* define this if the hardware can be powered off while charging */ 91/* define this if the hardware can be powered off while charging */
92/* TODO: should this be set for the H10? */ 92#define HAVE_POWEROFF_WHILE_CHARGING
93//#define HAVE_POWEROFF_WHILE_CHARGING
94 93
95/* The start address index for ROM builds */ 94/* The start address index for ROM builds */
96#define ROM_START 0x00000000 95#define ROM_START 0x00000000
@@ -128,7 +127,7 @@
128/* #define USB_IPODSTYLE */ 127/* #define USB_IPODSTYLE */
129 128
130/* define this if the unit can be powered or charged via USB */ 129/* define this if the unit can be powered or charged via USB */
131/*#define HAVE_USB_POWER*/ 130#define HAVE_USB_POWER
132 131
133/* Virtual LED (icon) */ 132/* Virtual LED (icon) */
134#define CONFIG_LED LED_VIRTUAL 133#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 @@
81#define BATTERY_TYPES_COUNT 1 /* only one type */ 81#define BATTERY_TYPES_COUNT 1 /* only one type */
82#define BATTERY_SCALE_FACTOR 5865 82#define BATTERY_SCALE_FACTOR 5865
83 83
84/* Hardware controlled charging? FIXME */ 84/* Hardware controlled charging */
85//#define CONFIG_CHARGING CHARGING_SIMPLE 85#define CONFIG_CHARGING CHARGING_SIMPLE
86 86
87/* define this if the hardware can be powered off while charging */ 87/* define this if the hardware can be powered off while charging */
88/* TODO: should this be set for the H10? */ 88#define HAVE_POWEROFF_WHILE_CHARGING
89//#define HAVE_POWEROFF_WHILE_CHARGING
90 89
91/* The start address index for ROM builds */ 90/* The start address index for ROM builds */
92#define ROM_START 0x00000000 91#define ROM_START 0x00000000
@@ -110,7 +109,7 @@
110/* #define USB_IPODSTYLE */ 109/* #define USB_IPODSTYLE */
111 110
112/* define this if the unit can be powered or charged via USB */ 111/* define this if the unit can be powered or charged via USB */
113/*#define HAVE_USB_POWER*/ 112#define HAVE_USB_POWER
114 113
115/* Virtual LED (icon) */ 114/* Virtual LED (icon) */
116#define CONFIG_LED LED_VIRTUAL 115#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 @@
125#define DEV_RS (*(volatile unsigned long *)(0x60006004)) 125#define DEV_RS (*(volatile unsigned long *)(0x60006004))
126#define DEV_EN (*(volatile unsigned long *)(0x6000600c)) 126#define DEV_EN (*(volatile unsigned long *)(0x6000600c))
127 127
128#define DEV_SYSTEM 0x4
129
128#define TIMER1_CFG (*(volatile unsigned long *)(0x60005000)) 130#define TIMER1_CFG (*(volatile unsigned long *)(0x60005000))
129#define TIMER1_VAL (*(volatile unsigned long *)(0x60005004)) 131#define TIMER1_VAL (*(volatile unsigned long *)(0x60005004))
130#define TIMER2_CFG (*(volatile unsigned long *)(0x60005008)) 132#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)
1316 1316
1317void system_reboot(void) 1317void system_reboot(void)
1318{ 1318{
1319 /* Reboot */
1320 DEV_RS |= DEV_SYSTEM;
1319} 1321}
1320 1322
1321int system_memory_guard(int newmode) 1323int 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)
71 71
72bool charger_inserted(void) 72bool charger_inserted(void)
73{ 73{
74 return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */ 74 return (GPIOF_INPUT_VAL & 0x08)?true:false;
75} 75}
76 76
77void ide_power_enable(bool on) 77void ide_power_enable(bool on)
@@ -89,8 +89,5 @@ bool ide_powered(void)
89 89
90void power_off(void) 90void power_off(void)
91{ 91{
92 /* Give things a second to settle before cutting power */
93 sleep(HZ);
94
95 GPIOF_OUTPUT_VAL &=~ 0x20; 92 GPIOF_OUTPUT_VAL &=~ 0x20;
96} 93}
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 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19
20/* Code from the iPod port but commented out. USB detection custom made based
21 on GPIO analysis */
22
23#include "config.h" 19#include "config.h"
24#include "cpu.h" 20#include "cpu.h"
25#include "kernel.h" 21#include "kernel.h"
@@ -37,52 +33,11 @@
37#include "sprintf.h" 33#include "sprintf.h"
38#include "string.h" 34#include "string.h"
39#include "hwcompat.h" 35#include "hwcompat.h"
40#ifdef HAVE_MMC 36#include "pp5020.h"
41#include "ata_mmc.h"
42#endif
43 37
44void usb_init_device(void) 38void usb_init_device(void)
45{ 39{
46#if 0 40 /* USB is initialized by bootloader */
47 int r0;
48 outl(inl(0x70000084) | 0x200, 0x70000084);
49
50 outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
51 outl(inl(0x6000600C) | 0x400000, 0x6000600C);
52
53 outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */
54 outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */
55
56 outl(inl(0x70000020) | 0x80000000, 0x70000020);
57 while ((inl(0x70000028) & 0x80) == 0);
58
59 outl(inl(0xc5000184) | 0x100, 0xc5000184);
60 while ((inl(0xc5000184) & 0x100) != 0);
61
62 outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4);
63 if ((inl(0xc50001A4) & 0x100) == 0) {
64 outl(inl(0xc50001A8) & ~0x3, 0xc50001A8);
65 outl(inl(0xc50001A8) | 0x2, 0xc50001A8);
66 outl(inl(0x70000028) | 0x4000, 0x70000028);
67 outl(inl(0x70000028) | 0x2, 0x70000028);
68 } else {
69 outl(inl(0xc50001A8) | 0x3, 0xc50001A8);
70 outl(inl(0x70000028) &~0x4000, 0x70000028);
71 outl(inl(0x70000028) | 0x2, 0x70000028);
72 }
73 outl(inl(0xc5000140) | 0x2, 0xc5000140);
74 while((inl(0xc5000140) & 0x2) != 0);
75 r0 = inl(0xc5000184);
76
77 /* Note from IPL source (referring to next 5 lines of code:
78 THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
79 outl(inl(0x70000020) | 0x80000000, 0x70000020);
80 outl(inl(0x6000600C) | 0x400000, 0x6000600C);
81 while ((inl(0x70000028) & 0x80) == 0);
82 outl(inl(0x70000028) | 0x2, 0x70000028);
83
84 udelay(0x186A0);
85#endif
86} 41}
87 42
88bool usb_detect(void) 43bool usb_detect(void)
@@ -92,16 +47,10 @@ bool usb_detect(void)
92 47
93void usb_enable(bool on) 48void usb_enable(bool on)
94{ 49{
95 (void)on; 50 /* For the H10, we reboot if BUTTON_RIGHT is held so that the iriver
96#if 0 51 * bootloader can start up in UMS mode. This does not return. */
97 /* For the ipod, we can only do one thing with USB mode - reboot 52 if (on && (button_status()==BUTTON_RIGHT))
98 into Apple's flash-based disk-mode. This does not return. */
99 if (on)
100 { 53 {
101 /* The following code is copied from ipodlinux */ 54 system_reboot();
102 unsigned char* storage_ptr = (unsigned char *)0x40017F00;
103 memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21);
104 DEV_RS |= 4; /* Reboot */
105 } 55 }
106#endif
107} 56}
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 */
80#elif CONFIG_KEYPAD == GIGABEAT_PAD 80#elif CONFIG_KEYPAD == GIGABEAT_PAD
81#define USBPOWER_BUTTON BUTTON_MENU 81#define USBPOWER_BUTTON BUTTON_MENU
82#define USBPOWER_BTN_IGNORE BUTTON_POWER 82#define USBPOWER_BTN_IGNORE BUTTON_POWER
83#elif CONFIG_KEYPAD == IRIVER_H10_PAD
84#define USBPOWER_BUTTON BUTTON_NONE
85#define USBPOWER_BTN_IGNORE BUTTON_POWER
83#endif 86#endif
84#endif /* HAVE_USB_POWER */ 87#endif /* HAVE_USB_POWER */
85 88