summaryrefslogtreecommitdiffstats
path: root/firmware/target
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 /firmware/target
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
Diffstat (limited to 'firmware/target')
-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
4 files changed, 29 insertions, 83 deletions
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