forked from len0rd/rockbox
iPod: Fix the bootloader so it can load and run the original Apple firmware again. The Rockbox firmware was doing too much to the hardware so we remove most of the initialisation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8301 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5a313efa0c
commit
cb7e695ef9
9 changed files with 45 additions and 10 deletions
|
@ -415,7 +415,16 @@ void* main(void)
|
||||||
lcd_puts(0, line++, "Rockbox loaded.");
|
lcd_puts(0, line++, "Rockbox loaded.");
|
||||||
lcd_update();
|
lcd_update();
|
||||||
memcpy((void*)DRAM_START,loadbuffer,rc);
|
memcpy((void*)DRAM_START,loadbuffer,rc);
|
||||||
return (void*)DRAM_START;
|
|
||||||
|
/* Transfer execution directly to Rockbox - we don't want
|
||||||
|
to run the rest of the bootloader startup code. */
|
||||||
|
asm volatile(
|
||||||
|
"mov r0, #0x10000000 \n"
|
||||||
|
"mov pc, r0 \n"
|
||||||
|
);
|
||||||
|
|
||||||
|
/* We don't get here, but keep the compiler happy. */
|
||||||
|
return (void*)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,12 +197,13 @@ start_loc:
|
||||||
/* execute the loader - this will load an image to 0x10000000 */
|
/* execute the loader - this will load an image to 0x10000000 */
|
||||||
bl main
|
bl main
|
||||||
|
|
||||||
|
/* The loader only returns if it is loading the Apple firmware or Linux -
|
||||||
|
the following code isn't executed when starting Rockbox */
|
||||||
|
|
||||||
/* save the startup address for the COP */
|
/* save the startup address for the COP */
|
||||||
ldr r1, =startup_loc
|
ldr r1, =startup_loc
|
||||||
str r0, [r1]
|
str r0, [r1]
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* TODO: fix something for the COP to wake up to, until then let it sleep. */
|
|
||||||
#if CONFIG_CPU==PP5002
|
#if CONFIG_CPU==PP5002
|
||||||
/* make sure COP is sleeping */
|
/* make sure COP is sleeping */
|
||||||
ldr r4, =0xcf004050
|
ldr r4, =0xcf004050
|
||||||
|
@ -227,8 +228,7 @@ start_loc:
|
||||||
@ldr r4, =PP5020_COP_CTRL
|
@ldr r4, =PP5020_COP_CTRL
|
||||||
mov r3, #0x0
|
mov r3, #0x0
|
||||||
str r3, [r4]
|
str r3, [r4]
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
/* jump to start location */
|
/* jump to start location */
|
||||||
mov pc, r0
|
mov pc, r0
|
||||||
|
|
||||||
|
|
|
@ -262,8 +262,10 @@ void power_off(void)
|
||||||
#if CONFIG_CPU == MCF5249
|
#if CONFIG_CPU == MCF5249
|
||||||
and_l(~0x00080000, &GPIO1_OUT);
|
and_l(~0x00080000, &GPIO1_OUT);
|
||||||
#elif CONFIG_CPU == PP5020
|
#elif CONFIG_CPU == PP5020
|
||||||
|
#ifndef BOOTLOADER
|
||||||
/* We don't turn off the ipod, we put it in a deep sleep */
|
/* We don't turn off the ipod, we put it in a deep sleep */
|
||||||
pcf50605_standby_mode();
|
pcf50605_standby_mode();
|
||||||
|
#endif
|
||||||
#elif defined(GMINI_ARCH)
|
#elif defined(GMINI_ARCH)
|
||||||
P1 &= ~1;
|
P1 &= ~1;
|
||||||
P1CON &= ~1;
|
P1CON &= ~1;
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#define CONFIG_CODEC SWCODEC
|
#define CONFIG_CODEC SWCODEC
|
||||||
|
|
||||||
/* define this if you have a real-time clock */
|
/* define this if you have a real-time clock */
|
||||||
|
#ifndef BOOTLOADER
|
||||||
#define CONFIG_RTC RTC_PCF50605
|
#define CONFIG_RTC RTC_PCF50605
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#define CONFIG_CODEC SWCODEC
|
#define CONFIG_CODEC SWCODEC
|
||||||
|
|
||||||
/* define this if you have a real-time clock */
|
/* define this if you have a real-time clock */
|
||||||
|
#ifndef BOOTLOADER
|
||||||
#define CONFIG_RTC RTC_PCF50605
|
#define CONFIG_RTC RTC_PCF50605
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#define CONFIG_CODEC SWCODEC
|
#define CONFIG_CODEC SWCODEC
|
||||||
|
|
||||||
/* define this if you have a real-time clock */
|
/* define this if you have a real-time clock */
|
||||||
|
#ifndef BOOTLOADER
|
||||||
#define CONFIG_RTC RTC_PCF50605
|
#define CONFIG_RTC RTC_PCF50605
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define this if you have a software controlled poweroff */
|
/* Define this if you have a software controlled poweroff */
|
||||||
#define HAVE_SW_POWEROFF
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
|
@ -66,7 +66,13 @@ struct mutex
|
||||||
};
|
};
|
||||||
|
|
||||||
/* global tick variable */
|
/* global tick variable */
|
||||||
|
#if (CONFIG_CPU == PP5020) && defined(BOOTLOADER)
|
||||||
|
/* We don't enable interrupts in the iPod bootloader, so we need to fake
|
||||||
|
the current_tick variable */
|
||||||
|
#define current_tick ((*((volatile long*)0x60005010))/10000)
|
||||||
|
#else
|
||||||
extern long current_tick;
|
extern long current_tick;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
#define sleep(x) sim_sleep(x)
|
#define sleep(x) sim_sleep(x)
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
|
||||||
|
#if (CONFIG_CPU != PP5020) || !defined(BOOTLOADER)
|
||||||
long current_tick = 0;
|
long current_tick = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||||
|
|
||||||
|
@ -48,7 +50,7 @@ void kernel_init(void)
|
||||||
|
|
||||||
num_queues = 0;
|
num_queues = 0;
|
||||||
memset(all_queues, 0, sizeof(all_queues));
|
memset(all_queues, 0, sizeof(all_queues));
|
||||||
|
|
||||||
tick_start(1000/HZ);
|
tick_start(1000/HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +321,7 @@ void tick_start(unsigned int interval_in_ms)
|
||||||
|
|
||||||
#define USECS_PER_INT 0x2710
|
#define USECS_PER_INT 0x2710
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER
|
||||||
void TIMER1(void)
|
void TIMER1(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -336,9 +339,11 @@ void TIMER1(void)
|
||||||
current_tick++;
|
current_tick++;
|
||||||
wake_up_thread();
|
wake_up_thread();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void tick_start(unsigned int interval_in_ms)
|
void tick_start(unsigned int interval_in_ms)
|
||||||
{
|
{
|
||||||
|
#ifndef BOOTLOADER
|
||||||
/* TODO: use interval_in_ms to set timer periode */
|
/* TODO: use interval_in_ms to set timer periode */
|
||||||
(void)interval_in_ms;
|
(void)interval_in_ms;
|
||||||
PP5020_TIMER1 = 0x0;
|
PP5020_TIMER1 = 0x0;
|
||||||
|
@ -347,6 +352,10 @@ void tick_start(unsigned int interval_in_ms)
|
||||||
PP5020_TIMER1 = 0xc0000000 | USECS_PER_INT;
|
PP5020_TIMER1 = 0xc0000000 | USECS_PER_INT;
|
||||||
/* unmask interrupt source */
|
/* unmask interrupt source */
|
||||||
PP5020_CPU_INT_EN = PP5020_TIMER1_MASK;
|
PP5020_CPU_INT_EN = PP5020_TIMER1_MASK;
|
||||||
|
#else
|
||||||
|
/* We don't enable interrupts in the bootloader */
|
||||||
|
(void)interval_in_ms;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1106,6 +1106,7 @@ int system_memory_guard(int newmode)
|
||||||
}
|
}
|
||||||
#elif CONFIG_CPU==PP5020
|
#elif CONFIG_CPU==PP5020
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER
|
||||||
extern void TIMER1(void);
|
extern void TIMER1(void);
|
||||||
extern void ipod_4g_button_int(void);
|
extern void ipod_4g_button_int(void);
|
||||||
|
|
||||||
|
@ -1116,6 +1117,7 @@ void irq(void)
|
||||||
else if (PP5020_CPU_HI_INT_STAT & PP5020_I2C_MASK)
|
else if (PP5020_CPU_HI_INT_STAT & PP5020_I2C_MASK)
|
||||||
ipod_4g_button_int();
|
ipod_4g_button_int();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* TODO: The following two function have been lifted straight from IPL, and
|
/* TODO: The following two function have been lifted straight from IPL, and
|
||||||
hence have a lot of numeric addresses used straight. I'd like to use
|
hence have a lot of numeric addresses used straight. I'd like to use
|
||||||
|
@ -1124,11 +1126,10 @@ void irq(void)
|
||||||
to extend the funtions to do alternate cache configurations and/or
|
to extend the funtions to do alternate cache configurations and/or
|
||||||
some other CPU frequency scaling. */
|
some other CPU frequency scaling. */
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER
|
||||||
static void ipod_init_cache(void)
|
static void ipod_init_cache(void)
|
||||||
{
|
{
|
||||||
/* Initialising the cache in the iPod Video bootloader prevents
|
/* Initialising the cache in the iPod bootloader prevents Rockbox from starting */
|
||||||
Rockbox from starting */
|
|
||||||
#if !defined(BOOTLOADER) || !defined(APPLE_IPODVIDEO)
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* cache init mode? */
|
/* cache init mode? */
|
||||||
|
@ -1147,7 +1148,6 @@ static void ipod_init_cache(void)
|
||||||
|
|
||||||
for (i = 0x10000000; i < 0x10002000; i += 16)
|
for (i = 0x10000000; i < 0x10002000; i += 16)
|
||||||
inb(i);
|
inb(i);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ipod_set_cpu_speed(void)
|
static void ipod_set_cpu_speed(void)
|
||||||
|
@ -1163,9 +1163,11 @@ static void ipod_set_cpu_speed(void)
|
||||||
|
|
||||||
outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020);
|
outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void system_init(void)
|
void system_init(void)
|
||||||
{
|
{
|
||||||
|
#ifndef BOOTLOADER
|
||||||
/* disable all irqs */
|
/* disable all irqs */
|
||||||
outl(-1, 0x60001138);
|
outl(-1, 0x60001138);
|
||||||
outl(-1, 0x60001128);
|
outl(-1, 0x60001128);
|
||||||
|
@ -1176,6 +1178,7 @@ void system_init(void)
|
||||||
outl(-1, 0x6000101c);
|
outl(-1, 0x6000101c);
|
||||||
ipod_set_cpu_speed();
|
ipod_set_cpu_speed();
|
||||||
ipod_init_cache();
|
ipod_init_cache();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void system_reboot(void)
|
void system_reboot(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue