diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-07-13 07:40:30 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-07-13 07:40:30 +0000 |
commit | 5f655c93f931236c173700f54e4b329bf709e7cc (patch) | |
tree | 7e4edf40a5d59ec356fdc97f8eeef020aa1074dd | |
parent | ac13e52522dac375096a65264ceae00afb3c5973 (diff) | |
download | rockbox-5f655c93f931236c173700f54e4b329bf709e7cc.tar.gz rockbox-5f655c93f931236c173700f54e4b329bf709e7cc.zip |
Patch #5639 by Ulrich Pegelow, inits the M5636 USBOTG chip on the X5 to reduce the battery consumption.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10208 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/main.c | 6 | ||||
-rw-r--r-- | docs/CREDITS | 1 | ||||
-rw-r--r-- | firmware/SOURCES | 5 | ||||
-rwxr-xr-x | firmware/drivers/m5636.c | 45 | ||||
-rw-r--r-- | firmware/export/config-iaudiox5.h | 3 | ||||
-rw-r--r-- | firmware/export/config.h | 1 | ||||
-rwxr-xr-x | firmware/export/m5636.h | 25 | ||||
-rwxr-xr-x | firmware/target/coldfire/iaudio/x5/m5636-target.h | 37 | ||||
-rwxr-xr-x | firmware/target/coldfire/iaudio/x5/m5636-x5.c | 50 |
9 files changed, 172 insertions, 1 deletions
diff --git a/apps/main.c b/apps/main.c index d6e3c342c9..4f31cdb58a 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -92,6 +92,10 @@ | |||
92 | #include "isp1362.h" | 92 | #include "isp1362.h" |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | #if CONFIG_USBOTG == USBOTG_M5636 | ||
96 | #include "m5636.h" | ||
97 | #endif | ||
98 | |||
95 | /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ | 99 | /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ |
96 | 100 | ||
97 | const char appsversion[]=APPSVERSION; | 101 | const char appsversion[]=APPSVERSION; |
@@ -282,6 +286,8 @@ void init(void) | |||
282 | usb_init(); | 286 | usb_init(); |
283 | #if CONFIG_USBOTG == USBOTG_ISP1362 | 287 | #if CONFIG_USBOTG == USBOTG_ISP1362 |
284 | isp1362_init(); | 288 | isp1362_init(); |
289 | #elif CONFIG_USBOTG == USBOTG_M5636 | ||
290 | m5636_init(); | ||
285 | #endif | 291 | #endif |
286 | 292 | ||
287 | backlight_init(); | 293 | backlight_init(); |
diff --git a/docs/CREDITS b/docs/CREDITS index 63bb2df1a5..6566d5962b 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -210,3 +210,4 @@ Ioannis Koutoulakis | |||
210 | Alistair Marshall | 210 | Alistair Marshall |
211 | Karl Ove Hufthammer | 211 | Karl Ove Hufthammer |
212 | Víctor Zabalza | 212 | Víctor Zabalza |
213 | Ulrich Pegelow | ||
diff --git a/firmware/SOURCES b/firmware/SOURCES index d6765ef627..5d59a6bd1e 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -206,7 +206,9 @@ usb_serial.c | |||
206 | #if CONFIG_USBOTG == USBOTG_ISP1362 | 206 | #if CONFIG_USBOTG == USBOTG_ISP1362 |
207 | drivers/isp1362.c | 207 | drivers/isp1362.c |
208 | #endif | 208 | #endif |
209 | 209 | #if CONFIG_USBOTG == USBOTG_M5636 | |
210 | drivers/m5636.c | ||
211 | #endif | ||
210 | 212 | ||
211 | #ifndef SIMULATOR | 213 | #ifndef SIMULATOR |
212 | #ifdef IAUDIO_X5 | 214 | #ifdef IAUDIO_X5 |
@@ -219,5 +221,6 @@ target/coldfire/iaudio/x5/ata-x5.c | |||
219 | target/coldfire/iaudio/x5/system-x5.c | 221 | target/coldfire/iaudio/x5/system-x5.c |
220 | target/coldfire/iaudio/x5/usb-x5.c | 222 | target/coldfire/iaudio/x5/usb-x5.c |
221 | target/coldfire/iaudio/x5/backlight-x5.c | 223 | target/coldfire/iaudio/x5/backlight-x5.c |
224 | target/coldfire/iaudio/x5/m5636-x5.c | ||
222 | #endif | 225 | #endif |
223 | #endif | 226 | #endif |
diff --git a/firmware/drivers/m5636.c b/firmware/drivers/m5636.c new file mode 100755 index 0000000000..e7b7a174df --- /dev/null +++ b/firmware/drivers/m5636.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Ulrich Pegelow | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "system.h" | ||
21 | #include "kernel.h" | ||
22 | #include "logf.h" | ||
23 | #include "m5636.h" | ||
24 | #include "m5636-target.h" | ||
25 | |||
26 | /* Disclaimer: This code had to be developed without any documentation for the | ||
27 | M5636 USBOTG chip, due to the restrictive information policy of | ||
28 | its manufacturer. | ||
29 | The development is solely based on reverse engineering. | ||
30 | Malfunctioning (with the risk of possible damage to the | ||
31 | hardware) can not be fully excluded. | ||
32 | USE THIS CODE AT YOUR OWN RISK! | ||
33 | */ | ||
34 | |||
35 | /* Init: This currently just puts the M5636 into sleep mode */ | ||
36 | |||
37 | void m5636_init(void) | ||
38 | { | ||
39 | m5636_device_init(); | ||
40 | |||
41 | M5636_4068 |= 0x0003; /* ???? */ | ||
42 | M5636_4068 |= 0x0080; /* ???? */ | ||
43 | M5636_4078 |= 0x0001; /* ???? */ | ||
44 | } | ||
45 | |||
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index b16a142a28..d224b3b45e 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -102,6 +102,9 @@ | |||
102 | 102 | ||
103 | #define USB_X5STYLE | 103 | #define USB_X5STYLE |
104 | 104 | ||
105 | /* USB On-the-go */ | ||
106 | #define CONFIG_USBOTG USBOTG_M5636 | ||
107 | |||
105 | /* Define this if you have adjustable CPU frequency */ | 108 | /* Define this if you have adjustable CPU frequency */ |
106 | #define HAVE_ADJUSTABLE_CPU_FREQ | 109 | #define HAVE_ADJUSTABLE_CPU_FREQ |
107 | 110 | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 6c2580c360..3768d857cb 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -135,6 +135,7 @@ | |||
135 | 135 | ||
136 | /* USB On-the-go */ | 136 | /* USB On-the-go */ |
137 | #define USBOTG_ISP1362 1362 | 137 | #define USBOTG_ISP1362 1362 |
138 | #define USBOTG_M5636 5636 | ||
138 | 139 | ||
139 | /* now go and pick yours */ | 140 | /* now go and pick yours */ |
140 | #if defined(ARCHOS_PLAYER) | 141 | #if defined(ARCHOS_PLAYER) |
diff --git a/firmware/export/m5636.h b/firmware/export/m5636.h new file mode 100755 index 0000000000..33846c57d5 --- /dev/null +++ b/firmware/export/m5636.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Ulrich Pegelow | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef M5636_H | ||
20 | #define M5636_H | ||
21 | |||
22 | void m5636_init(void); | ||
23 | void m5636_dump_regs(void); | ||
24 | |||
25 | #endif | ||
diff --git a/firmware/target/coldfire/iaudio/x5/m5636-target.h b/firmware/target/coldfire/iaudio/x5/m5636-target.h new file mode 100755 index 0000000000..51cb933c07 --- /dev/null +++ b/firmware/target/coldfire/iaudio/x5/m5636-target.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Ulrich Pegelow | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef M5636_TARGET_H | ||
20 | #define M5636_TARGET_H | ||
21 | |||
22 | #define M5636_BASE 0xf0004000L /* Rockbox: 0xf0004000; OF: 0x20004000 */ | ||
23 | |||
24 | /* We are currently lacking a datasheet for the M5636. No mnemonics available. | ||
25 | The registers are named according to their respective hexadecimal offsets. | ||
26 | */ | ||
27 | |||
28 | #define M5636_4064 (*(volatile unsigned short *)(M5636_BASE + 0x64L)) | ||
29 | #define M5636_4068 (*(volatile unsigned short *)(M5636_BASE + 0x68L)) | ||
30 | #define M5636_4078 (*(volatile unsigned short *)(M5636_BASE + 0x78L)) | ||
31 | |||
32 | extern void m5636_device_init(void); | ||
33 | |||
34 | /* for debugging purposes only */ | ||
35 | extern void m5636_dump_regs(void); | ||
36 | |||
37 | #endif | ||
diff --git a/firmware/target/coldfire/iaudio/x5/m5636-x5.c b/firmware/target/coldfire/iaudio/x5/m5636-x5.c new file mode 100755 index 0000000000..d30ff360d6 --- /dev/null +++ b/firmware/target/coldfire/iaudio/x5/m5636-x5.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Ulrich Pegelow | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "system.h" | ||
22 | #include "logf.h" | ||
23 | #include "m5636-target.h" | ||
24 | |||
25 | void m5636_device_init(void) | ||
26 | { | ||
27 | and_l(~0x00004000, &GPIO_INT_EN); /* probably redundant: disable | ||
28 | interrupt; just in case ... */ | ||
29 | and_l(~0x00000004, &GPIO1_OUT); /* probably redundant: set GPIO34 low */ | ||
30 | or_l( 0x00000004, &GPIO1_ENABLE); /* GPIO34 enable (see above) */ | ||
31 | or_l( 0x00000004, &GPIO1_FUNCTION); /* GPIO34 function (see above) */ | ||
32 | } | ||
33 | |||
34 | /* for debugging purposes only */ | ||
35 | void m5636_dump_regs(void) | ||
36 | { | ||
37 | unsigned short *address; | ||
38 | |||
39 | for (address = (unsigned short *)M5636_BASE; | ||
40 | address < (unsigned short *)(M5636_BASE + 0x100); | ||
41 | address++) | ||
42 | { | ||
43 | logf("m5636 A:%08x D:%04x", address, (unsigned)*address); | ||
44 | } | ||
45 | |||
46 | logf("GPIO_INT_EN %08x", GPIO_INT_EN); | ||
47 | logf("GPIO1_OUT %08x", GPIO1_OUT); | ||
48 | logf("GPIO1_ENABLE %08x", GPIO1_ENABLE); | ||
49 | logf("GPIO1_FUNCTION %08x", GPIO1_FUNCTION); | ||
50 | } | ||