summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-01-17 06:50:27 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-01-17 06:50:27 +0000
commitbcc0f88372fd2be986a5e279dd7e3bd556d6c984 (patch)
tree149db74c9cb02a1e4b219cb168053b22e41ae82b
parent62207228f717d0eb29aca5d1fbc155f151d6814e (diff)
downloadrockbox-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.h10
-rw-r--r--firmware/export/config/iriverh10.h3
-rw-r--r--firmware/export/config/iriverh10_5gb.h3
-rw-r--r--firmware/target/arm/ata-pp5020.c2
-rw-r--r--firmware/target/arm/iriver/boot.lds64
-rw-r--r--firmware/target/arm/iriver/usb-target.h4
-rw-r--r--firmware/target/arm/system-pp502x.c42
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 */
#define HAVE_PRIORITY_SCHEDULING
#define USB_STATUS_BY_EVENT
#define USB_DETECT_BY_DRV
+#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC
+#define INCLUDE_TIMEOUT_API
+#endif
#endif
#else /* !BOOTLOADER */
@@ -721,9 +724,7 @@ Lyre prototype 1 */
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC
#define USB_STATUS_BY_EVENT
#define USB_DETECT_BY_DRV
-#if CONFIG_CPU != IMX31L
#define INCLUDE_TIMEOUT_API
-#endif
#endif /* HAVE_USBSTACK && USBOTG_ARC */
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525
@@ -912,22 +913,17 @@ Lyre prototype 1 */
#ifdef HAVE_HEADPHONE_DETECTION
/* Timeout objects required if headphone detection is enabled */
-#ifndef INCLUDE_TIMEOUT_API
#define INCLUDE_TIMEOUT_API
-#endif
#endif /* HAVE_HEADPHONE_DETECTION */
#ifdef HAVE_TOUCHSCREEN
/* Timeout objects required for kinetic list scrolling */
-#undef INCLUDE_TIMEOUT_API
#define INCLUDE_TIMEOUT_API
#endif /* HAVE_TOUCHSCREEN */
#if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK)
/* USB charging support in the USB stack requires timeout objects */
-#ifndef INCLUDE_TIMEOUT_API
#define INCLUDE_TIMEOUT_API
-#endif
#endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */
#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 @@
#define USB_VENDOR_ID 0x0B70
#define USB_PRODUCT_ID 0x00BA
#define HAVE_USB_HID_MOUSE
+#ifdef BOOTLOADER
+#define HAVE_BOOTLOADER_USB_MODE
+#endif
/* Define this if you have adjustable CPU frequency */
#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 @@
#define USB_VENDOR_ID 0x0B70
#define USB_PRODUCT_ID 0x00BA
#define HAVE_USB_HID_MOUSE
+#ifdef BOOTLOADER
+#define HAVE_BOOTLOADER_USB_MODE
+#endif
/* Define this if you have adjustable CPU frequency */
#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) {
IDE_DMA_CONTROL |= 2;
IDE_DMA_LENGTH = bytes - 4;
-#ifndef BOOTLOADER
+#if !defined(BOOTLOADER) || defined (HAVE_BOOTLOADER_USB_MODE)
if ((unsigned long)addr < DRAM_START)
/* Rockbox remaps DRAM to start at 0 */
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 @@
#include "config.h"
-
-ENTRY(start)
-OUTPUT_FORMAT(elf32-littlearm)
-OUTPUT_ARCH(arm)
-STARTUP(target/arm/crt0-pp-bl.o)
-
-#define DRAMSIZE (MEMORYSIZE * 0x100000)
-
-#define DRAMORIG 0x10000000
-#define IRAMORIG 0x40000000
-#define IRAMSIZE 0x18000
-#define FLASHORIG 0x001f0000
-#define FLASHSIZE 2M
-
-MEMORY
-{
- DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
- IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
-}
-
-SECTIONS
-{
- . = IRAMORIG;
-
- .text : {
- *(.init.text)
- *(.text*)
- *(.glue_7)
- *(.glue_7t)
- } > IRAM
-
- .data : {
- *(.icode)
- *(.irodata)
- *(.idata)
- *(.data*)
- *(.ncdata*)
- *(.rodata*)
- _dataend = . ;
- } > IRAM
-
- .stack (NOLOAD) : {
- *(.stack)
- _stackbegin = .;
- stackbegin = .;
- . += 0x2000;
- _stackend = .;
- stackend = .;
- } > IRAM
-
- /* The bss section is too large for IRAM - we just move it 16MB into the
- DRAM */
-
- . = DRAMORIG;
- .bss . + (16*1024*1024) (NOLOAD) : {
- _edata = .;
- *(.bss*);
- *(.ibss);
- *(COMMON)
- *(.ncbss*);
- _end = .;
- } > DRAM
-}
+#include "../boot-pp502x-bl-usb.lds"
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 @@
#ifndef USB_TARGET_H
#define USB_TARGET_H
+#ifdef HAVE_BOOTLOADER_USB_MODE
+#define USB_DRIVER_CLOSE
+#endif
+
bool usb_init_device(void);
void usb_pin_init(void); /* Init the GPIO input only */
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)
CACHE_CTL |= CACHE_CTL_INIT | CACHE_CTL_ENABLE | CACHE_CTL_RUN;
nop; nop; nop; nop;
}
-#endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE*/
+#endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */
/* We need this for Sansas since we boost the cpu in their bootloader */
-#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) || \
- defined(SANSA_E200) || defined(SANSA_C200) || \
- defined(PHILIPS_SA9200)
+#if !defined(BOOTLOADER) || (defined(SANSA_E200) || defined(SANSA_C200) || \
+ defined(PHILIPS_SA9200))
void scale_suspend_core(bool suspend) ICODE_ATTR;
void scale_suspend_core(bool suspend)
{
@@ -409,12 +408,11 @@ static void pp_set_cpu_frequency(long frequency)
corelock_unlock(&cpufreq_cl);
#endif
}
-#endif /* !BOOTLOADER || HAVE_BOOTLOADER_USB_MODE ||
- SANSA_E200 || SANSA_C200 || PHILIPS_SA9200 */
+#endif /* !BOOTLOADER || (SANSA_E200 || SANSA_C200 || PHILIPS_SA9200) */
+#ifndef BOOTLOADER
void system_init(void)
{
-#ifndef BOOTLOADER
if (CURRENT_CORE == CPU)
{
#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(IPOD_COLOR)
@@ -538,10 +536,13 @@ void system_init(void)
}
init_cache();
+}
-#else /* !BOOTLOADER */
- /* Only the CPU gets here in the bootloader */
+#else /* BOOTLOADER */
+void system_init(void)
+{
+ /* Only the CPU gets here in the bootloader */
#ifdef HAVE_BOOTLOADER_USB_MODE
disable_all_interrupts();
init_cache();
@@ -550,13 +551,23 @@ void system_init(void)
#endif /* HAVE_BOOTLOADER_USB_MODE */
#if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200)
- pp_set_cpu_frequency(CPUFREQ_MAX);
+ pp_set_cpu_frequency(CPUFREQ_MAX);
#endif
- /* Else the frequency shot get changed upon USB connect -
+ /* Else the frequency should get changed upon USB connect -
* decide per-target */
+}
-#endif /* BOOTLOADER */
+#ifdef HAVE_BOOTLOADER_USB_MODE
+void system_prepare_fw_start(void)
+{
+ disable_interrupt(IRQ_FIQ_STATUS);
+ tick_stop();
+ disable_all_interrupts();
+ /* Some OF's disable this themselves, others do not and will hang. */
+ CACHE_CTL &= ~CACHE_CTL_VECT_REMAP;
}
+#endif /* HAVE_BOOTLOADER_USB_MODE */
+#endif /* !BOOTLOADER */
void ICODE_ATTR system_reboot(void)
{
@@ -597,10 +608,3 @@ int system_memory_guard(int newmode)
return 0;
}
-#ifdef HAVE_BOOTLOADER_USB_MODE
-void system_prepare_fw_start(void)
-{
- tick_stop();
- disable_all_interrupts();
-}
-#endif