diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 22 | ||||
-rw-r--r-- | firmware/export/pp5020.h | 8 | ||||
-rw-r--r-- | firmware/target/arm/ipod/usb-target.h | 24 | ||||
-rw-r--r-- | firmware/target/arm/iriver/h10/usb-h10.c | 58 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/usb-e200.c | 39 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/usb-target.h | 25 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/usb-target.h | 27 | ||||
-rw-r--r-- | firmware/target/arm/tatung/tpj1022/usb-tpj1022.c | 107 | ||||
-rw-r--r-- | firmware/target/arm/usb-pp.c (renamed from firmware/target/arm/ipod/usb-ipod.c) | 73 | ||||
-rw-r--r-- | firmware/target/arm/usb-target.h | 128 |
10 files changed, 190 insertions, 321 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 386d3707c4..6a4f172e47 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -331,7 +331,7 @@ target/arm/sandisk/sansa-e200/ata-e200.c | |||
331 | target/arm/sandisk/sansa-e200/lcd-e200.c | 331 | target/arm/sandisk/sansa-e200/lcd-e200.c |
332 | target/arm/sandisk/sansa-e200/adc-e200.c | 332 | target/arm/sandisk/sansa-e200/adc-e200.c |
333 | target/arm/sandisk/sansa-e200/backlight-e200.c | 333 | target/arm/sandisk/sansa-e200/backlight-e200.c |
334 | target/arm/sandisk/sansa-e200/usb-e200.c | 334 | target/arm/usb-pp.c |
335 | target/arm/sandisk/sansa-e200/button-e200.c | 335 | target/arm/sandisk/sansa-e200/button-e200.c |
336 | target/arm/sandisk/sansa-e200/power-e200.c | 336 | target/arm/sandisk/sansa-e200/power-e200.c |
337 | target/arm/i2s-pp.c | 337 | target/arm/i2s-pp.c |
@@ -416,7 +416,7 @@ target/arm/iriver/h10/backlight-h10.c | |||
416 | target/arm/iriver/h10/button-h10.c | 416 | target/arm/iriver/h10/button-h10.c |
417 | target/arm/iriver/h10/lcd-h10_20gb.c | 417 | target/arm/iriver/h10/lcd-h10_20gb.c |
418 | target/arm/iriver/h10/power-h10.c | 418 | target/arm/iriver/h10/power-h10.c |
419 | target/arm/iriver/h10/usb-h10.c | 419 | target/arm/usb-pp.c |
420 | #endif /* SIMULATOR */ | 420 | #endif /* SIMULATOR */ |
421 | #endif /* IRIVER_H10 */ | 421 | #endif /* IRIVER_H10 */ |
422 | 422 | ||
@@ -430,7 +430,7 @@ target/arm/iriver/h10/backlight-h10.c | |||
430 | target/arm/iriver/h10/button-h10.c | 430 | target/arm/iriver/h10/button-h10.c |
431 | target/arm/iriver/h10/lcd-h10_5gb.c | 431 | target/arm/iriver/h10/lcd-h10_5gb.c |
432 | target/arm/iriver/h10/power-h10.c | 432 | target/arm/iriver/h10/power-h10.c |
433 | target/arm/iriver/h10/usb-h10.c | 433 | target/arm/usb-pp.c |
434 | #endif /* SIMULATOR */ | 434 | #endif /* SIMULATOR */ |
435 | #endif /* IRIVER_H10_5GB */ | 435 | #endif /* IRIVER_H10_5GB */ |
436 | 436 | ||
@@ -460,7 +460,7 @@ target/arm/tatung/tpj1022/backlight-tpj1022.c | |||
460 | target/arm/tatung/tpj1022/button-tpj1022.c | 460 | target/arm/tatung/tpj1022/button-tpj1022.c |
461 | target/arm/tatung/tpj1022/lcd-tpj1022.c | 461 | target/arm/tatung/tpj1022/lcd-tpj1022.c |
462 | target/arm/tatung/tpj1022/power-tpj1022.c | 462 | target/arm/tatung/tpj1022/power-tpj1022.c |
463 | target/arm/tatung/tpj1022/usb-tpj1022.c | 463 | target/arm/usb-pp.c |
464 | #endif /* SIMULATOR */ | 464 | #endif /* SIMULATOR */ |
465 | #endif /* ELIO_TPJ1022 */ | 465 | #endif /* ELIO_TPJ1022 */ |
466 | 466 | ||
@@ -475,7 +475,7 @@ target/arm/ipod/adc-ipod.c | |||
475 | target/arm/ipod/backlight-4g_color.c | 475 | target/arm/ipod/backlight-4g_color.c |
476 | target/arm/ipod/button-clickwheel.c | 476 | target/arm/ipod/button-clickwheel.c |
477 | target/arm/ipod/power-ipod.c | 477 | target/arm/ipod/power-ipod.c |
478 | target/arm/ipod/usb-ipod.c | 478 | target/arm/usb-pp.c |
479 | #endif /* SIMULATOR */ | 479 | #endif /* SIMULATOR */ |
480 | #endif /* IPOD_4G */ | 480 | #endif /* IPOD_4G */ |
481 | 481 | ||
@@ -490,7 +490,7 @@ target/arm/ipod/adc-ipod.c | |||
490 | target/arm/ipod/backlight-4g_color.c | 490 | target/arm/ipod/backlight-4g_color.c |
491 | target/arm/ipod/button-clickwheel.c | 491 | target/arm/ipod/button-clickwheel.c |
492 | target/arm/ipod/power-ipod.c | 492 | target/arm/ipod/power-ipod.c |
493 | target/arm/ipod/usb-ipod.c | 493 | target/arm/usb-pp.c |
494 | #endif /* SIMULATOR */ | 494 | #endif /* SIMULATOR */ |
495 | #endif /* IPOD_COLOR */ | 495 | #endif /* IPOD_COLOR */ |
496 | 496 | ||
@@ -505,7 +505,7 @@ target/arm/ipod/adc-ipod.c | |||
505 | target/arm/ipod/backlight-nano_video.c | 505 | target/arm/ipod/backlight-nano_video.c |
506 | target/arm/ipod/button-clickwheel.c | 506 | target/arm/ipod/button-clickwheel.c |
507 | target/arm/ipod/power-ipod.c | 507 | target/arm/ipod/power-ipod.c |
508 | target/arm/ipod/usb-ipod.c | 508 | target/arm/usb-pp.c |
509 | #endif /* SIMULATOR */ | 509 | #endif /* SIMULATOR */ |
510 | #endif /* IPOD_NANO */ | 510 | #endif /* IPOD_NANO */ |
511 | 511 | ||
@@ -520,7 +520,7 @@ target/arm/ipod/adc-ipod.c | |||
520 | target/arm/ipod/backlight-nano_video.c | 520 | target/arm/ipod/backlight-nano_video.c |
521 | target/arm/ipod/button-clickwheel.c | 521 | target/arm/ipod/button-clickwheel.c |
522 | target/arm/ipod/power-ipod.c | 522 | target/arm/ipod/power-ipod.c |
523 | target/arm/ipod/usb-ipod.c | 523 | target/arm/usb-pp.c |
524 | #endif /* SIMULATOR */ | 524 | #endif /* SIMULATOR */ |
525 | #endif /* IPOD_VIDEO */ | 525 | #endif /* IPOD_VIDEO */ |
526 | 526 | ||
@@ -535,7 +535,7 @@ target/arm/ipod/adc-ipod.c | |||
535 | target/arm/ipod/3g/backlight-3g.c | 535 | target/arm/ipod/3g/backlight-3g.c |
536 | target/arm/ipod/3g/button-3g.c | 536 | target/arm/ipod/3g/button-3g.c |
537 | target/arm/ipod/power-ipod.c | 537 | target/arm/ipod/power-ipod.c |
538 | target/arm/ipod/usb-ipod.c | 538 | target/arm/usb-pp.c |
539 | #endif /* SIMULATOR */ | 539 | #endif /* SIMULATOR */ |
540 | #endif /* IPOD_3G */ | 540 | #endif /* IPOD_3G */ |
541 | 541 | ||
@@ -550,7 +550,7 @@ target/arm/ipod/adc-ipod.c | |||
550 | target/arm/ipod/backlight-mini1g_mini2g.c | 550 | target/arm/ipod/backlight-mini1g_mini2g.c |
551 | target/arm/ipod/button-mini1g.c | 551 | target/arm/ipod/button-mini1g.c |
552 | target/arm/ipod/power-ipod.c | 552 | target/arm/ipod/power-ipod.c |
553 | target/arm/ipod/usb-ipod.c | 553 | target/arm/usb-pp.c |
554 | #endif /* SIMULATOR */ | 554 | #endif /* SIMULATOR */ |
555 | #endif /* IPOD_MINI */ | 555 | #endif /* IPOD_MINI */ |
556 | 556 | ||
@@ -565,7 +565,7 @@ target/arm/ipod/adc-ipod.c | |||
565 | target/arm/ipod/backlight-mini1g_mini2g.c | 565 | target/arm/ipod/backlight-mini1g_mini2g.c |
566 | target/arm/ipod/button-clickwheel.c | 566 | target/arm/ipod/button-clickwheel.c |
567 | target/arm/ipod/power-ipod.c | 567 | target/arm/ipod/power-ipod.c |
568 | target/arm/ipod/usb-ipod.c | 568 | target/arm/usb-pp.c |
569 | #endif /* SIMULATOR */ | 569 | #endif /* SIMULATOR */ |
570 | #endif /* IPOD_MINI2G */ | 570 | #endif /* IPOD_MINI2G */ |
571 | 571 | ||
diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h index 37d8882519..cbae083913 100644 --- a/firmware/export/pp5020.h +++ b/firmware/export/pp5020.h | |||
@@ -126,6 +126,11 @@ | |||
126 | #define DEV_EN (*(volatile unsigned long *)(0x6000600c)) | 126 | #define DEV_EN (*(volatile unsigned long *)(0x6000600c)) |
127 | 127 | ||
128 | #define DEV_SYSTEM 0x4 | 128 | #define DEV_SYSTEM 0x4 |
129 | #define DEV_USB 0x400000 | ||
130 | |||
131 | #define DEV_INIT (*(volatile unsigned long *)(0x70000020)) | ||
132 | |||
133 | #define INIT_USB 0x80000000 | ||
129 | 134 | ||
130 | #define TIMER1_CFG (*(volatile unsigned long *)(0x60005000)) | 135 | #define TIMER1_CFG (*(volatile unsigned long *)(0x60005000)) |
131 | #define TIMER1_VAL (*(volatile unsigned long *)(0x60005004)) | 136 | #define TIMER1_VAL (*(volatile unsigned long *)(0x60005004)) |
@@ -158,9 +163,6 @@ | |||
158 | #define SER1_MASK (1 << (SER1_IRQ-32)) | 163 | #define SER1_MASK (1 << (SER1_IRQ-32)) |
159 | #define I2C_MASK (1 << (I2C_IRQ-32)) | 164 | #define I2C_MASK (1 << (I2C_IRQ-32)) |
160 | 165 | ||
161 | #define USB2D_IDENT (*(volatile unsigned long*)(0xc5000000)) | ||
162 | #define USB_STATUS (*(volatile unsigned long*)(0xc50001a4)) | ||
163 | |||
164 | #define IISCONFIG (*(volatile unsigned long*)(0x70002800)) | 166 | #define IISCONFIG (*(volatile unsigned long*)(0x70002800)) |
165 | 167 | ||
166 | #define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c)) | 168 | #define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c)) |
diff --git a/firmware/target/arm/ipod/usb-target.h b/firmware/target/arm/ipod/usb-target.h deleted file mode 100644 index 69a81472f8..0000000000 --- a/firmware/target/arm/ipod/usb-target.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 USB_TARGET_H | ||
20 | #define USB_TARGET_H | ||
21 | |||
22 | bool usb_init_device(void); | ||
23 | |||
24 | #endif | ||
diff --git a/firmware/target/arm/iriver/h10/usb-h10.c b/firmware/target/arm/iriver/h10/usb-h10.c deleted file mode 100644 index b11eb53deb..0000000000 --- a/firmware/target/arm/iriver/h10/usb-h10.c +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
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 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "kernel.h" | ||
22 | #include "thread.h" | ||
23 | #include "system.h" | ||
24 | #include "debug.h" | ||
25 | #include "ata.h" | ||
26 | #include "fat.h" | ||
27 | #include "disk.h" | ||
28 | #include "panic.h" | ||
29 | #include "lcd.h" | ||
30 | #include "adc.h" | ||
31 | #include "usb.h" | ||
32 | #include "button.h" | ||
33 | #include "sprintf.h" | ||
34 | #include "string.h" | ||
35 | #include "hwcompat.h" | ||
36 | #include "pp5020.h" | ||
37 | |||
38 | void usb_init_device(void) | ||
39 | { | ||
40 | /* USB is initialized by bootloader */ | ||
41 | } | ||
42 | |||
43 | bool usb_detect(void) | ||
44 | { | ||
45 | return (GPIOL_INPUT_VAL & 0x04)?true:false; | ||
46 | } | ||
47 | |||
48 | void usb_enable(bool on) | ||
49 | { | ||
50 | /* For the H10, we reboot if BUTTON_RIGHT is held so that the iriver | ||
51 | * bootloader can start up in UMS mode. This does not return. */ | ||
52 | if (on && (button_status()==BUTTON_RIGHT)) | ||
53 | { | ||
54 | ata_sleepnow(); /* Immediately spindown the disk. */ | ||
55 | sleep(HZ*2); | ||
56 | system_reboot(); | ||
57 | } | ||
58 | } | ||
diff --git a/firmware/target/arm/sandisk/sansa-e200/usb-e200.c b/firmware/target/arm/sandisk/sansa-e200/usb-e200.c deleted file mode 100644 index 031ba07253..0000000000 --- a/firmware/target/arm/sandisk/sansa-e200/usb-e200.c +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 <stdbool.h> | ||
21 | #include "system.h" | ||
22 | |||
23 | bool usb_init_device(void) | ||
24 | { | ||
25 | return true; | ||
26 | } | ||
27 | |||
28 | bool usb_detect(void) | ||
29 | { | ||
30 | if(GPIOB_INPUT_VAL & 0x10) | ||
31 | return true; | ||
32 | return false; | ||
33 | } | ||
34 | |||
35 | void usb_enable(bool on) | ||
36 | { | ||
37 | (void)on; | ||
38 | } | ||
39 | |||
diff --git a/firmware/target/arm/sandisk/sansa-e200/usb-target.h b/firmware/target/arm/sandisk/sansa-e200/usb-target.h deleted file mode 100644 index 3f309ff30b..0000000000 --- a/firmware/target/arm/sandisk/sansa-e200/usb-target.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 USB_TARGET_H | ||
20 | #define USB_TARGET_H | ||
21 | |||
22 | bool usb_init_device(void); | ||
23 | |||
24 | #endif | ||
25 | |||
diff --git a/firmware/target/arm/tatung/tpj1022/usb-target.h b/firmware/target/arm/tatung/tpj1022/usb-target.h deleted file mode 100644 index 7a17f7bacf..0000000000 --- a/firmware/target/arm/tatung/tpj1022/usb-target.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 | /* Based off x5 version */ | ||
21 | |||
22 | #ifndef USB_TARGET_H | ||
23 | #define USB_TARGET_H | ||
24 | |||
25 | bool usb_init_device(void); | ||
26 | |||
27 | #endif | ||
diff --git a/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c b/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c deleted file mode 100644 index b238de4369..0000000000 --- a/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
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 | /* Code from the iPod port but commented out. USB detection custom made based | ||
21 | on GPIO analysis */ | ||
22 | |||
23 | #include "config.h" | ||
24 | #include "cpu.h" | ||
25 | #include "kernel.h" | ||
26 | #include "thread.h" | ||
27 | #include "system.h" | ||
28 | #include "debug.h" | ||
29 | #include "ata.h" | ||
30 | #include "fat.h" | ||
31 | #include "disk.h" | ||
32 | #include "panic.h" | ||
33 | #include "lcd.h" | ||
34 | #include "adc.h" | ||
35 | #include "usb.h" | ||
36 | #include "button.h" | ||
37 | #include "sprintf.h" | ||
38 | #include "string.h" | ||
39 | #include "hwcompat.h" | ||
40 | #ifdef HAVE_MMC | ||
41 | #include "ata_mmc.h" | ||
42 | #endif | ||
43 | |||
44 | void usb_init_device(void) | ||
45 | { | ||
46 | #if 0 | ||
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 | } | ||
87 | |||
88 | bool usb_detect(void) | ||
89 | { | ||
90 | return false; | ||
91 | } | ||
92 | |||
93 | void usb_enable(bool on) | ||
94 | { | ||
95 | (void)on; | ||
96 | #if 0 | ||
97 | /* For the ipod, we can only do one thing with USB mode - reboot | ||
98 | into Apple's flash-based disk-mode. This does not return. */ | ||
99 | if (on) | ||
100 | { | ||
101 | /* The following code is copied from ipodlinux */ | ||
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 | } | ||
106 | #endif | ||
107 | } | ||
diff --git a/firmware/target/arm/ipod/usb-ipod.c b/firmware/target/arm/usb-pp.c index 9298d65ff7..f8d0a836ad 100644 --- a/firmware/target/arm/ipod/usb-ipod.c +++ b/firmware/target/arm/usb-pp.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include "sprintf.h" | 38 | #include "sprintf.h" |
39 | #include "string.h" | 39 | #include "string.h" |
40 | #include "hwcompat.h" | 40 | #include "hwcompat.h" |
41 | |||
42 | #include "usb-target.h" | ||
41 | 43 | ||
42 | void usb_init_device(void) | 44 | void usb_init_device(void) |
43 | { | 45 | { |
@@ -45,36 +47,36 @@ void usb_init_device(void) | |||
45 | outl(inl(0x70000084) | 0x200, 0x70000084); | 47 | outl(inl(0x70000084) | 0x200, 0x70000084); |
46 | 48 | ||
47 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); | 49 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); |
48 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | 50 | DEV_EN |= DEV_USB; |
49 | 51 | ||
50 | outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */ | 52 | DEV_RS |= DEV_USB; /* reset usb start */ |
51 | outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */ | 53 | DEV_RS &=~DEV_USB;/* reset usb end */ |
52 | 54 | ||
53 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | 55 | DEV_INIT |= INIT_USB; |
54 | while ((inl(0x70000028) & 0x80) == 0); | 56 | while ((inl(0x70000028) & 0x80) == 0); |
55 | 57 | ||
56 | outl(inl(0xc5000184) | 0x100, 0xc5000184); | 58 | UOG_PORTSC1 |= 0x100; |
57 | while ((inl(0xc5000184) & 0x100) != 0); | 59 | while ((UOG_PORTSC1 & 0x100) != 0); |
58 | 60 | ||
59 | outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4); | 61 | UOG_OTGSC |= 0x5F000000; |
60 | if ((inl(0xc50001A4) & 0x100) == 0) { | 62 | if( (UOG_OTGSC & 0x100) == 0) { |
61 | outl(inl(0xc50001A8) & ~0x3, 0xc50001A8); | 63 | UOG_USBMODE &=~ 0x3; |
62 | outl(inl(0xc50001A8) | 0x2, 0xc50001A8); | 64 | UOG_USBMODE |= 0x2; |
63 | outl(inl(0x70000028) | 0x4000, 0x70000028); | 65 | outl(inl(0x70000028) | 0x4000, 0x70000028); |
64 | outl(inl(0x70000028) | 0x2, 0x70000028); | 66 | outl(inl(0x70000028) | 0x2, 0x70000028); |
65 | } else { | 67 | } else { |
66 | outl(inl(0xc50001A8) | 0x3, 0xc50001A8); | 68 | UOG_USBMODE |= 0x2; |
67 | outl(inl(0x70000028) &~0x4000, 0x70000028); | 69 | outl(inl(0x70000028) &~0x4000, 0x70000028); |
68 | outl(inl(0x70000028) | 0x2, 0x70000028); | 70 | outl(inl(0x70000028) | 0x2, 0x70000028); |
69 | } | 71 | } |
70 | outl(inl(0xc5000140) | 0x2, 0xc5000140); | 72 | UOG_USBCMD |= 0x2; |
71 | while((inl(0xc5000140) & 0x2) != 0); | 73 | while((UOG_USBCMD & 0x2) != 0); |
72 | r0 = inl(0xc5000184); | 74 | r0 = UOG_PORTSC1; |
73 | 75 | ||
74 | /* Note from IPL source (referring to next 5 lines of code: | 76 | /* Note from IPL source (referring to next 5 lines of code: |
75 | THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ | 77 | THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ |
76 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | 78 | outl(inl(0x70000020) | 0x80000000, 0x70000020); |
77 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | 79 | DEV_EN |= DEV_USB; |
78 | while ((inl(0x70000028) & 0x80) == 0); | 80 | while ((inl(0x70000028) & 0x80) == 0); |
79 | outl(inl(0x70000028) | 0x2, 0x70000028); | 81 | outl(inl(0x70000028) | 0x2, 0x70000028); |
80 | 82 | ||
@@ -83,22 +85,34 @@ void usb_init_device(void) | |||
83 | 85 | ||
84 | void usb_enable(bool on) | 86 | void usb_enable(bool on) |
85 | { | 87 | { |
86 | /* For the ipod, we can only do one thing with USB mode - reboot | 88 | /* This device specific code will eventually give way to proper USB |
87 | into Apple's flash-based disk-mode. This does not return. */ | 89 | handling, which should be the same for all PortalPlayer targets. */ |
88 | if (on) | 90 | if (on) |
89 | { | 91 | { |
90 | /* The following code is copied from ipodlinux */ | 92 | #if IPOD_ARCH || defined(IRIVER_H10) || defined (IRIVER_H10_5GB) |
93 | /* For the H10 and iPod, we can only do one thing with USB mode - reboot | ||
94 | into the flash-based disk-mode. This does not return. */ | ||
95 | |||
96 | /* The following code is copied from ipodlinux */ | ||
91 | #if defined(IPOD_COLOR) || defined(IPOD_3G) || \ | 97 | #if defined(IPOD_COLOR) || defined(IPOD_3G) || \ |
92 | defined(IPOD_4G) || defined(IPOD_MINI) | 98 | defined(IPOD_4G) || defined(IPOD_MINI) |
93 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; | 99 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; |
94 | #elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G) | 100 | #elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G) |
95 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; | 101 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; |
96 | #endif | 102 | #endif |
97 | 103 | ||
98 | ata_sleepnow(); /* Immediately spindown the disk. */ | 104 | #if defined(IRIVER_H10) || defined (IRIVER_H10_5GB) |
99 | sleep(HZ*2); | 105 | if(button_status()==BUTTON_RIGHT) |
100 | memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); | 106 | #endif |
101 | DEV_RS |= 4; /* Reboot */ | 107 | { |
108 | ata_sleepnow(); /* Immediately spindown the disk. */ | ||
109 | sleep(HZ*2); | ||
110 | #ifdef IPOD_ARCH | ||
111 | memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); | ||
112 | #endif | ||
113 | system_reboot(); /* Reboot */ | ||
114 | } | ||
115 | #endif | ||
102 | } | 116 | } |
103 | } | 117 | } |
104 | 118 | ||
@@ -106,12 +120,17 @@ bool usb_detect(void) | |||
106 | { | 120 | { |
107 | bool current_status; | 121 | bool current_status; |
108 | 122 | ||
109 | /* The following check is in the ipodlinux source, with the | 123 | /* UOG_ID should have the bit format: |
110 | comment "USB2D_IDENT is bad" if USB2D_IDENT != 0x22FA05 */ | 124 | [31:24] = 0x0 |
111 | if (USB2D_IDENT != 0x22FA05) { | 125 | [23:16] = 0x22 (Revision number) |
126 | [15:14] = 0x3 (Reserved) | ||
127 | [13:8] = 0x3a (NID - 1's compliment of ID) | ||
128 | [7:6] = 0x0 (Reserved) | ||
129 | [5:0] = 0x05 (ID) */ | ||
130 | if (UOG_ID != 0x22FA05) { | ||
112 | return false; | 131 | return false; |
113 | } | 132 | } |
114 | current_status = (USB_STATUS & 0x800)?true:false; | 133 | current_status = (UOG_OTGSC & 0x800)?true:false; |
115 | 134 | ||
116 | return current_status; | 135 | return current_status; |
117 | } | 136 | } |
diff --git a/firmware/target/arm/usb-target.h b/firmware/target/arm/usb-target.h new file mode 100644 index 0000000000..2a5400be7e --- /dev/null +++ b/firmware/target/arm/usb-target.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
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 USB_TARGET_H | ||
20 | #define USB_TARGET_H | ||
21 | |||
22 | /* The PortalPlayer USB controller is compatible with Freescale i.MX31 */ | ||
23 | |||
24 | /* Register addresses */ | ||
25 | /* OTG */ | ||
26 | #define UOG_ID (*(volatile unsigned long *)(0xc5000000)) | ||
27 | #define UOG_HWGENERAL (*(volatile unsigned long *)(0xc5000004)) | ||
28 | #define UOG_HWHOST (*(volatile unsigned long *)(0xc5000008)) | ||
29 | #define UOG_HWTXBUF (*(volatile unsigned long *)(0xc5000010)) | ||
30 | #define UOG_HWRXBUF (*(volatile unsigned long *)(0xc5000014)) | ||
31 | #define UOG_CAPLENGTH (*(volatile unsigned char *)(0xc5000100)) | ||
32 | #define UOG_HCIVERSION (*(volatile unsigned short *)(0xc5000102)) | ||
33 | #define UOG_HCSPARAMS (*(volatile unsigned long *)(0xc5000104)) | ||
34 | #define UOG_HCCPARAMS (*(volatile unsigned long *)(0xc5000108)) | ||
35 | #define UOG_DCIVERSION (*(volatile unsigned short *)(0xc5000120)) | ||
36 | #define UOG_DCCPARAMS (*(volatile unsigned long *)(0xc5000124)) | ||
37 | #define UOG_USBCMD (*(volatile unsigned long *)(0xc5000140)) | ||
38 | #define UOG_USBSTS (*(volatile unsigned long *)(0xc5000144)) | ||
39 | #define UOG_USBINTR (*(volatile unsigned long *)(0xc5000148)) | ||
40 | #define UOG_FRINDEX (*(volatile unsigned long *)(0xc500014c)) | ||
41 | #define UOG_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000154)) | ||
42 | #define UOG_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000158)) | ||
43 | #define UOG_BURSTSIZE (*(volatile unsigned long *)(0xc5000160)) | ||
44 | #define UOG_TXFILLTUNING (*(volatile unsigned long *)(0xc5000164)) | ||
45 | #define UOG_ULPIVIEW (*(volatile unsigned long *)(0xc5000170)) | ||
46 | #define UOG_CFGFLAG (*(volatile unsigned long *)(0xc5000180)) | ||
47 | #define UOG_PORTSC1 (*(volatile unsigned long *)(0xc5000184)) | ||
48 | /*#define UOG_PORTSC2 (*(volatile unsigned long *)(0xc5000188)) | ||
49 | #define UOG_PORTSC3 (*(volatile unsigned long *)(0xc500018c)) | ||
50 | #define UOG_PORTSC4 (*(volatile unsigned long *)(0xc5000190)) | ||
51 | #define UOG_PORTSC5 (*(volatile unsigned long *)(0xc5000194)) | ||
52 | #define UOG_PORTSC6 (*(volatile unsigned long *)(0xc5000198)) | ||
53 | #define UOG_PORTSC7 (*(volatile unsigned long *)(0xc500019c)) | ||
54 | #define UOG_PORTSC8 (*(volatile unsigned long *)(0xc50001a0))*/ | ||
55 | #define UOG_OTGSC (*(volatile unsigned long *)(0xc50001a4)) | ||
56 | #define UOG_USBMODE (*(volatile unsigned long *)(0xc50001a8)) | ||
57 | #define UOG_ENDPTSETUPSTAT (*(volatile unsigned long *)(0xc50001ac)) | ||
58 | #define UOG_ENDPTPRIME (*(volatile unsigned long *)(0xc50001b0)) | ||
59 | #define UOG_ENDPTFLUSH (*(volatile unsigned long *)(0xc50001b4)) | ||
60 | #define UOG_ENDPTSTAT (*(volatile unsigned long *)(0xc50001b8)) | ||
61 | #define UOG_ENDPTCOMPLETE (*(volatile unsigned long *)(0xc50001bc)) | ||
62 | #define ENDPTCRTL0 (*(volatile unsigned long *)(0xc50001c0)) | ||
63 | #define ENDPTCRTL1 (*(volatile unsigned long *)(0xc50001c4)) | ||
64 | #define ENDPTCRTL2 (*(volatile unsigned long *)(0xc50001c8)) | ||
65 | #define ENDPTCRTL3 (*(volatile unsigned long *)(0xc50001cc)) | ||
66 | #define ENDPTCRTL4 (*(volatile unsigned long *)(0xc50001d0)) | ||
67 | #define ENDPTCRTL5 (*(volatile unsigned long *)(0xc50001d4)) | ||
68 | #define ENDPTCRTL6 (*(volatile unsigned long *)(0xc50001d8)) | ||
69 | #define ENDPTCRTL7 (*(volatile unsigned long *)(0xc50001dc)) | ||
70 | /*#define ENDPTCRTL8 (*(volatile unsigned long *)(0xc50001e0)) | ||
71 | #define ENDPTCRTL9 (*(volatile unsigned long *)(0xc50001e4)) | ||
72 | #define ENDPTCRTL10 (*(volatile unsigned long *)(0xc50001e8)) | ||
73 | #define ENDPTCRTL11 (*(volatile unsigned long *)(0xc50001ec)) | ||
74 | #define ENDPTCRTL12 (*(volatile unsigned long *)(0xc50001f0)) | ||
75 | #define ENDPTCRTL13 (*(volatile unsigned long *)(0xc50001f4)) | ||
76 | #define ENDPTCRTL14 (*(volatile unsigned long *)(0xc50001f8)) | ||
77 | #define ENDPTCRTL15 (*(volatile unsigned long *)(0xc50001fc))*/ | ||
78 | |||
79 | /* Host 1 */ | ||
80 | #define UH1_ID (*(volatile unsigned long *)(0xc5000200)) | ||
81 | #define UH1_HWGENERAL (*(volatile unsigned long *)(0xc5000204)) | ||
82 | #define UH1_HWHOST (*(volatile unsigned long *)(0xc5000208)) | ||
83 | #define UH1_HWTXBUF (*(volatile unsigned long *)(0xc5000210)) | ||
84 | #define UH1_HWRXBUF (*(volatile unsigned long *)(0xc5000214)) | ||
85 | #define UH1_CAPLENGTH (*(volatile unsigned long *)(0xc5000300)) | ||
86 | #define UH1_HCIVERSION (*(volatile unsigned long *)(0xc5000302)) | ||
87 | #define UH1_HCSPARAMS (*(volatile unsigned long *)(0xc5000304)) | ||
88 | #define UH1_HCCPARAMS (*(volatile unsigned long *)(0xc5000308)) | ||
89 | #define UH1_USBCMD (*(volatile unsigned long *)(0xc5000340)) | ||
90 | #define UH1_USBSTS (*(volatile unsigned long *)(0xc5000344)) | ||
91 | #define UH1_USBINTR (*(volatile unsigned long *)(0xc5000348)) | ||
92 | #define UH1_FRINDEX (*(volatile unsigned long *)(0xc500034c)) | ||
93 | #define UH1_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000354)) | ||
94 | #define UH1_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000358)) | ||
95 | #define UH1_BURSTSIZE (*(volatile unsigned long *)(0xc5000360)) | ||
96 | #define UH1_TXFILLTUNING (*(volatile unsigned long *)(0xc5000364)) | ||
97 | #define UH1_PORTSC1 (*(volatile unsigned long *)(0xc5000384)) | ||
98 | #define UH1_USBMODE (*(volatile unsigned long *)(0xc50003a8)) | ||
99 | |||
100 | /* Host 2 */ | ||
101 | #define UH2_ID (*(volatile unsigned long *)(0xc5000400)) | ||
102 | #define UH2_HWGENERAL (*(volatile unsigned long *)(0xc5000404)) | ||
103 | #define UH2_HWHOST (*(volatile unsigned long *)(0xc5000408)) | ||
104 | #define UH2_HWTXBUF (*(volatile unsigned long *)(0xc5000410)) | ||
105 | #define UH2_HWRXBUF (*(volatile unsigned long *)(0xc5000414)) | ||
106 | #define UH2_CAPLENGTH (*(volatile unsigned long *)(0xc5000500)) | ||
107 | #define UH2_HCIVERSION (*(volatile unsigned long *)(0xc5000502)) | ||
108 | #define UH2_HCSPARAMS (*(volatile unsigned long *)(0xc5000504)) | ||
109 | #define UH2_HCCPARAMS (*(volatile unsigned long *)(0xc5000508)) | ||
110 | #define UH2_USBCMD (*(volatile unsigned long *)(0xc5000540)) | ||
111 | #define UH2_USBSTS (*(volatile unsigned long *)(0xc5000544)) | ||
112 | #define UH2_USBINTR (*(volatile unsigned long *)(0xc5000548)) | ||
113 | #define UH2_FRINDEX (*(volatile unsigned long *)(0xc500054c)) | ||
114 | #define UH2_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000554)) | ||
115 | #define UH2_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000558)) | ||
116 | #define UH2_BURSTSIZE (*(volatile unsigned long *)(0xc5000560)) | ||
117 | #define UH2_TXFILLTUNING (*(volatile unsigned long *)(0xc5000564)) | ||
118 | #define UH2_ULPIVIEW (*(volatile unsigned long *)(0xc5000570)) | ||
119 | #define UH2_PORTSC1 (*(volatile unsigned long *)(0xc5000584)) | ||
120 | #define UH2_USBMODE (*(volatile unsigned long *)(0xc50005a8)) | ||
121 | |||
122 | /* General */ | ||
123 | #define USB_CTRL (*(volatile unsigned long *)(0xc5000600)) | ||
124 | #define USB_OTG_MIRROR (*(volatile unsigned long *)(0xc5000604)) | ||
125 | |||
126 | void usb_init_device(void); | ||
127 | |||
128 | #endif | ||