diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-01-17 06:50:27 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-01-17 06:50:27 +0000 |
commit | bcc0f88372fd2be986a5e279dd7e3bd556d6c984 (patch) | |
tree | 149db74c9cb02a1e4b219cb168053b22e41ae82b | |
parent | 62207228f717d0eb29aca5d1fbc155f151d6814e (diff) | |
download | rockbox-bcc0f88372fd2be986a5e279dd7e3bd556d6c984.tar.gz rockbox-bcc0f88372fd2be986a5e279dd7e3bd556d6c984.zip |
Convert PortalPlayer iRivers to use USB-mode enabled bootloader. The H10 5/6GB already has a pre-boot USB mode (so it's a little redundant there) but building them the same way is simpler.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29067 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/export/config.h | 10 | ||||
-rw-r--r-- | firmware/export/config/iriverh10.h | 3 | ||||
-rw-r--r-- | firmware/export/config/iriverh10_5gb.h | 3 | ||||
-rw-r--r-- | firmware/target/arm/ata-pp5020.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/iriver/boot.lds | 64 | ||||
-rw-r--r-- | firmware/target/arm/iriver/usb-target.h | 4 | ||||
-rw-r--r-- | firmware/target/arm/system-pp502x.c | 42 |
7 files changed, 38 insertions, 90 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index c77e673351..95f38c5995 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -698,6 +698,9 @@ Lyre prototype 1 */ | |||
698 | #define HAVE_PRIORITY_SCHEDULING | 698 | #define HAVE_PRIORITY_SCHEDULING |
699 | #define USB_STATUS_BY_EVENT | 699 | #define USB_STATUS_BY_EVENT |
700 | #define USB_DETECT_BY_DRV | 700 | #define USB_DETECT_BY_DRV |
701 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC | ||
702 | #define INCLUDE_TIMEOUT_API | ||
703 | #endif | ||
701 | #endif | 704 | #endif |
702 | 705 | ||
703 | #else /* !BOOTLOADER */ | 706 | #else /* !BOOTLOADER */ |
@@ -721,9 +724,7 @@ Lyre prototype 1 */ | |||
721 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC | 724 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC |
722 | #define USB_STATUS_BY_EVENT | 725 | #define USB_STATUS_BY_EVENT |
723 | #define USB_DETECT_BY_DRV | 726 | #define USB_DETECT_BY_DRV |
724 | #if CONFIG_CPU != IMX31L | ||
725 | #define INCLUDE_TIMEOUT_API | 727 | #define INCLUDE_TIMEOUT_API |
726 | #endif | ||
727 | #endif /* HAVE_USBSTACK && USBOTG_ARC */ | 728 | #endif /* HAVE_USBSTACK && USBOTG_ARC */ |
728 | 729 | ||
729 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525 | 730 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525 |
@@ -912,22 +913,17 @@ Lyre prototype 1 */ | |||
912 | 913 | ||
913 | #ifdef HAVE_HEADPHONE_DETECTION | 914 | #ifdef HAVE_HEADPHONE_DETECTION |
914 | /* Timeout objects required if headphone detection is enabled */ | 915 | /* Timeout objects required if headphone detection is enabled */ |
915 | #ifndef INCLUDE_TIMEOUT_API | ||
916 | #define INCLUDE_TIMEOUT_API | 916 | #define INCLUDE_TIMEOUT_API |
917 | #endif | ||
918 | #endif /* HAVE_HEADPHONE_DETECTION */ | 917 | #endif /* HAVE_HEADPHONE_DETECTION */ |
919 | 918 | ||
920 | #ifdef HAVE_TOUCHSCREEN | 919 | #ifdef HAVE_TOUCHSCREEN |
921 | /* Timeout objects required for kinetic list scrolling */ | 920 | /* Timeout objects required for kinetic list scrolling */ |
922 | #undef INCLUDE_TIMEOUT_API | ||
923 | #define INCLUDE_TIMEOUT_API | 921 | #define INCLUDE_TIMEOUT_API |
924 | #endif /* HAVE_TOUCHSCREEN */ | 922 | #endif /* HAVE_TOUCHSCREEN */ |
925 | 923 | ||
926 | #if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK) | 924 | #if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK) |
927 | /* USB charging support in the USB stack requires timeout objects */ | 925 | /* USB charging support in the USB stack requires timeout objects */ |
928 | #ifndef INCLUDE_TIMEOUT_API | ||
929 | #define INCLUDE_TIMEOUT_API | 926 | #define INCLUDE_TIMEOUT_API |
930 | #endif | ||
931 | #endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */ | 927 | #endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */ |
932 | 928 | ||
933 | #if defined(HAVE_USBSTACK) || (CONFIG_STORAGE & STORAGE_NAND) | 929 | #if defined(HAVE_USBSTACK) || (CONFIG_STORAGE & STORAGE_NAND) |
diff --git a/firmware/export/config/iriverh10.h b/firmware/export/config/iriverh10.h index 83c92651a2..219e1277d6 100644 --- a/firmware/export/config/iriverh10.h +++ b/firmware/export/config/iriverh10.h | |||
@@ -178,6 +178,9 @@ | |||
178 | #define USB_VENDOR_ID 0x0B70 | 178 | #define USB_VENDOR_ID 0x0B70 |
179 | #define USB_PRODUCT_ID 0x00BA | 179 | #define USB_PRODUCT_ID 0x00BA |
180 | #define HAVE_USB_HID_MOUSE | 180 | #define HAVE_USB_HID_MOUSE |
181 | #ifdef BOOTLOADER | ||
182 | #define HAVE_BOOTLOADER_USB_MODE | ||
183 | #endif | ||
181 | 184 | ||
182 | /* Define this if you have adjustable CPU frequency */ | 185 | /* Define this if you have adjustable CPU frequency */ |
183 | #define HAVE_ADJUSTABLE_CPU_FREQ | 186 | #define HAVE_ADJUSTABLE_CPU_FREQ |
diff --git a/firmware/export/config/iriverh10_5gb.h b/firmware/export/config/iriverh10_5gb.h index c2cffcf41f..5ff588ef72 100644 --- a/firmware/export/config/iriverh10_5gb.h +++ b/firmware/export/config/iriverh10_5gb.h | |||
@@ -165,6 +165,9 @@ | |||
165 | #define USB_VENDOR_ID 0x0B70 | 165 | #define USB_VENDOR_ID 0x0B70 |
166 | #define USB_PRODUCT_ID 0x00BA | 166 | #define USB_PRODUCT_ID 0x00BA |
167 | #define HAVE_USB_HID_MOUSE | 167 | #define HAVE_USB_HID_MOUSE |
168 | #ifdef BOOTLOADER | ||
169 | #define HAVE_BOOTLOADER_USB_MODE | ||
170 | #endif | ||
168 | 171 | ||
169 | /* Define this if you have adjustable CPU frequency */ | 172 | /* Define this if you have adjustable CPU frequency */ |
170 | #define HAVE_ADJUSTABLE_CPU_FREQ | 173 | #define HAVE_ADJUSTABLE_CPU_FREQ |
diff --git a/firmware/target/arm/ata-pp5020.c b/firmware/target/arm/ata-pp5020.c index c8ce148dd7..44297a5a7e 100644 --- a/firmware/target/arm/ata-pp5020.c +++ b/firmware/target/arm/ata-pp5020.c | |||
@@ -193,7 +193,7 @@ bool ata_dma_setup(void *addr, unsigned long bytes, bool write) { | |||
193 | IDE_DMA_CONTROL |= 2; | 193 | IDE_DMA_CONTROL |= 2; |
194 | IDE_DMA_LENGTH = bytes - 4; | 194 | IDE_DMA_LENGTH = bytes - 4; |
195 | 195 | ||
196 | #ifndef BOOTLOADER | 196 | #if !defined(BOOTLOADER) || defined (HAVE_BOOTLOADER_USB_MODE) |
197 | if ((unsigned long)addr < DRAM_START) | 197 | if ((unsigned long)addr < DRAM_START) |
198 | /* Rockbox remaps DRAM to start at 0 */ | 198 | /* Rockbox remaps DRAM to start at 0 */ |
199 | IDE_DMA_ADDR = (unsigned long)addr + DRAM_START; | 199 | IDE_DMA_ADDR = (unsigned long)addr + DRAM_START; |
diff --git a/firmware/target/arm/iriver/boot.lds b/firmware/target/arm/iriver/boot.lds index 10bde4e9d5..ed4fc351fe 100644 --- a/firmware/target/arm/iriver/boot.lds +++ b/firmware/target/arm/iriver/boot.lds | |||
@@ -1,64 +1,2 @@ | |||
1 | #include "config.h" | 1 | #include "config.h" |
2 | 2 | #include "../boot-pp502x-bl-usb.lds" | |
3 | ENTRY(start) | ||
4 | OUTPUT_FORMAT(elf32-littlearm) | ||
5 | OUTPUT_ARCH(arm) | ||
6 | STARTUP(target/arm/crt0-pp-bl.o) | ||
7 | |||
8 | #define DRAMSIZE (MEMORYSIZE * 0x100000) | ||
9 | |||
10 | #define DRAMORIG 0x10000000 | ||
11 | #define IRAMORIG 0x40000000 | ||
12 | #define IRAMSIZE 0x18000 | ||
13 | #define FLASHORIG 0x001f0000 | ||
14 | #define FLASHSIZE 2M | ||
15 | |||
16 | MEMORY | ||
17 | { | ||
18 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | ||
19 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE | ||
20 | } | ||
21 | |||
22 | SECTIONS | ||
23 | { | ||
24 | . = IRAMORIG; | ||
25 | |||
26 | .text : { | ||
27 | *(.init.text) | ||
28 | *(.text*) | ||
29 | *(.glue_7) | ||
30 | *(.glue_7t) | ||
31 | } > IRAM | ||
32 | |||
33 | .data : { | ||
34 | *(.icode) | ||
35 | *(.irodata) | ||
36 | *(.idata) | ||
37 | *(.data*) | ||
38 | *(.ncdata*) | ||
39 | *(.rodata*) | ||
40 | _dataend = . ; | ||
41 | } > IRAM | ||
42 | |||
43 | .stack (NOLOAD) : { | ||
44 | *(.stack) | ||
45 | _stackbegin = .; | ||
46 | stackbegin = .; | ||
47 | . += 0x2000; | ||
48 | _stackend = .; | ||
49 | stackend = .; | ||
50 | } > IRAM | ||
51 | |||
52 | /* The bss section is too large for IRAM - we just move it 16MB into the | ||
53 | DRAM */ | ||
54 | |||
55 | . = DRAMORIG; | ||
56 | .bss . + (16*1024*1024) (NOLOAD) : { | ||
57 | _edata = .; | ||
58 | *(.bss*); | ||
59 | *(.ibss); | ||
60 | *(COMMON) | ||
61 | *(.ncbss*); | ||
62 | _end = .; | ||
63 | } > DRAM | ||
64 | } | ||
diff --git a/firmware/target/arm/iriver/usb-target.h b/firmware/target/arm/iriver/usb-target.h index 03aa2cbff7..034b012bdd 100644 --- a/firmware/target/arm/iriver/usb-target.h +++ b/firmware/target/arm/iriver/usb-target.h | |||
@@ -24,6 +24,10 @@ | |||
24 | #ifndef USB_TARGET_H | 24 | #ifndef USB_TARGET_H |
25 | #define USB_TARGET_H | 25 | #define USB_TARGET_H |
26 | 26 | ||
27 | #ifdef HAVE_BOOTLOADER_USB_MODE | ||
28 | #define USB_DRIVER_CLOSE | ||
29 | #endif | ||
30 | |||
27 | bool usb_init_device(void); | 31 | bool usb_init_device(void); |
28 | void usb_pin_init(void); /* Init the GPIO input only */ | 32 | void usb_pin_init(void); /* Init the GPIO input only */ |
29 | bool usb_plugged(void); /* Returns instantaneous state - always */ | 33 | bool usb_plugged(void); /* Returns instantaneous state - always */ |
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index 41b43ba24d..bd71d28417 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -260,12 +260,11 @@ static void init_cache(void) | |||
260 | CACHE_CTL |= CACHE_CTL_INIT | CACHE_CTL_ENABLE | CACHE_CTL_RUN; | 260 | CACHE_CTL |= CACHE_CTL_INIT | CACHE_CTL_ENABLE | CACHE_CTL_RUN; |
261 | nop; nop; nop; nop; | 261 | nop; nop; nop; nop; |
262 | } | 262 | } |
263 | #endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE*/ | 263 | #endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */ |
264 | 264 | ||
265 | /* We need this for Sansas since we boost the cpu in their bootloader */ | 265 | /* We need this for Sansas since we boost the cpu in their bootloader */ |
266 | #if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) || \ | 266 | #if !defined(BOOTLOADER) || (defined(SANSA_E200) || defined(SANSA_C200) || \ |
267 | defined(SANSA_E200) || defined(SANSA_C200) || \ | 267 | defined(PHILIPS_SA9200)) |
268 | defined(PHILIPS_SA9200) | ||
269 | void scale_suspend_core(bool suspend) ICODE_ATTR; | 268 | void scale_suspend_core(bool suspend) ICODE_ATTR; |
270 | void scale_suspend_core(bool suspend) | 269 | void scale_suspend_core(bool suspend) |
271 | { | 270 | { |
@@ -409,12 +408,11 @@ static void pp_set_cpu_frequency(long frequency) | |||
409 | corelock_unlock(&cpufreq_cl); | 408 | corelock_unlock(&cpufreq_cl); |
410 | #endif | 409 | #endif |
411 | } | 410 | } |
412 | #endif /* !BOOTLOADER || HAVE_BOOTLOADER_USB_MODE || | 411 | #endif /* !BOOTLOADER || (SANSA_E200 || SANSA_C200 || PHILIPS_SA9200) */ |
413 | SANSA_E200 || SANSA_C200 || PHILIPS_SA9200 */ | ||
414 | 412 | ||
413 | #ifndef BOOTLOADER | ||
415 | void system_init(void) | 414 | void system_init(void) |
416 | { | 415 | { |
417 | #ifndef BOOTLOADER | ||
418 | if (CURRENT_CORE == CPU) | 416 | if (CURRENT_CORE == CPU) |
419 | { | 417 | { |
420 | #if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(IPOD_COLOR) | 418 | #if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(IPOD_COLOR) |
@@ -538,10 +536,13 @@ void system_init(void) | |||
538 | } | 536 | } |
539 | 537 | ||
540 | init_cache(); | 538 | init_cache(); |
539 | } | ||
541 | 540 | ||
542 | #else /* !BOOTLOADER */ | 541 | #else /* BOOTLOADER */ |
543 | /* Only the CPU gets here in the bootloader */ | ||
544 | 542 | ||
543 | void system_init(void) | ||
544 | { | ||
545 | /* Only the CPU gets here in the bootloader */ | ||
545 | #ifdef HAVE_BOOTLOADER_USB_MODE | 546 | #ifdef HAVE_BOOTLOADER_USB_MODE |
546 | disable_all_interrupts(); | 547 | disable_all_interrupts(); |
547 | init_cache(); | 548 | init_cache(); |
@@ -550,13 +551,23 @@ void system_init(void) | |||
550 | #endif /* HAVE_BOOTLOADER_USB_MODE */ | 551 | #endif /* HAVE_BOOTLOADER_USB_MODE */ |
551 | 552 | ||
552 | #if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200) | 553 | #if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200) |
553 | pp_set_cpu_frequency(CPUFREQ_MAX); | 554 | pp_set_cpu_frequency(CPUFREQ_MAX); |
554 | #endif | 555 | #endif |
555 | /* Else the frequency shot get changed upon USB connect - | 556 | /* Else the frequency should get changed upon USB connect - |
556 | * decide per-target */ | 557 | * decide per-target */ |
558 | } | ||
557 | 559 | ||
558 | #endif /* BOOTLOADER */ | 560 | #ifdef HAVE_BOOTLOADER_USB_MODE |
561 | void system_prepare_fw_start(void) | ||
562 | { | ||
563 | disable_interrupt(IRQ_FIQ_STATUS); | ||
564 | tick_stop(); | ||
565 | disable_all_interrupts(); | ||
566 | /* Some OF's disable this themselves, others do not and will hang. */ | ||
567 | CACHE_CTL &= ~CACHE_CTL_VECT_REMAP; | ||
559 | } | 568 | } |
569 | #endif /* HAVE_BOOTLOADER_USB_MODE */ | ||
570 | #endif /* !BOOTLOADER */ | ||
560 | 571 | ||
561 | void ICODE_ATTR system_reboot(void) | 572 | void ICODE_ATTR system_reboot(void) |
562 | { | 573 | { |
@@ -597,10 +608,3 @@ int system_memory_guard(int newmode) | |||
597 | return 0; | 608 | return 0; |
598 | } | 609 | } |
599 | 610 | ||
600 | #ifdef HAVE_BOOTLOADER_USB_MODE | ||
601 | void system_prepare_fw_start(void) | ||
602 | { | ||
603 | tick_stop(); | ||
604 | disable_all_interrupts(); | ||
605 | } | ||
606 | #endif | ||