summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2010-08-29 13:20:16 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2010-08-29 13:20:16 +0000
commit8aa175bc1fd303bccd491fc92689f29bdf439094 (patch)
tree6e907019503dcd5ae01de1c0ae796c7b704e8a41
parent47c510b9dcb0580d9db6199696d0d81ce680b999 (diff)
downloadrockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.zip
rockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.tar.gz
rockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.tar.bz2
rockbox-8aa175bc1fd303bccd491fc92689f29bdf439094.tar.xz
ipodvideo: detect ram size at boot (doesn't actually get USED yet)
This is the first step to allowing a single build which will work on any ipodvideo. A global variable, probed_ramsize, is initialised to either 32 or 64 early in boot. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27937 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/crt0-pp.S18
-rw-r--r--firmware/target/arm/system-pp502x.c11
-rw-r--r--firmware/target/arm/system-target.h4
3 files changed, 33 insertions, 0 deletions
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S
index ee95ac8..585455f 100644
--- a/firmware/target/arm/crt0-pp.S
+++ b/firmware/target/arm/crt0-pp.S
@@ -137,6 +137,24 @@ pad_skip:
mov r1, #0
str r1, [r2]
+#if defined(IPOD_VIDEO)
+ /* detect 32mb vs 64mb model */
+ /* we do this here because after SDRAM is remapped, we already assumed */
+ /* its size to be whatever we were compiled for. */
+
+ mov r2, #0x12000000
+ mov r3, #64
+ strb r3, [r2, #-1] /* first write 64 to last byte of first 32MB bank */
+
+ mov r2, #0x14000000
+ mov r3, #32
+ strb r3, [r2, #-1] /* now write 32 to last byte of second 32MB bank */
+
+ /* now the last word of the first 32MB bank tells you the RAM size */
+ /* since on a 32MB model both writes will touch the same actual location */
+ /* this is read later on in boot */
+#endif
+
mov r2, #0x40000000
ldr r3, =remap_start
ldr r4, =remap_end
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 9bedb0e..700686b 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -42,6 +42,10 @@ extern void SERIAL0(void);
static struct corelock cpufreq_cl SHAREDBSS_ATTR;
#endif
+#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
+unsigned char probed_ramsize;
+#endif
+
void __attribute__((interrupt("IRQ"))) irq_handler(void)
{
if(CURRENT_CORE == CPU)
@@ -518,6 +522,13 @@ void system_init(void)
#else
pp_set_cpu_frequency(CPUFREQ_MAX);
#endif
+
+#if defined(IPOD_VIDEO)
+ /* crt0-pp.S wrote the ram size to the last byte of the first 32MB
+ ram bank. See the comment there for how we determine it. */
+ volatile unsigned char *end32 = (volatile unsigned char *)0x01ffffff;
+ probed_ramsize = *end32;
+#endif
}
init_cache();
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h
index 5d20c39..c7503d7 100644
--- a/firmware/target/arm/system-target.h
+++ b/firmware/target/arm/system-target.h
@@ -172,6 +172,10 @@ static inline void wake_core(int core)
#define HAVE_CPUCACHE_FLUSH
#endif
+#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
+extern unsigned char probed_ramsize;
+#endif
+
#endif /* CPU_PP */
#endif /* SYSTEM_TARGET_H */