From 58764183439c0a7611aca2fcf344496a1589babf Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 14 Mar 2009 17:17:27 +0000 Subject: [PATCH] SansaAMS: Add a comment to clarifing a bit that the dcache is inactive without mmu; Show the cp15 control register in the "View I/O Pots menu". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20324 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/debug-as3525.c | 20 +++++++++++++++++++- firmware/target/arm/as3525/system-as3525.c | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 80f8702360..a8a973b9b2 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c @@ -31,6 +31,13 @@ #define _DEBUG_PRINTF(a,varargs...) \ snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf) +#define ON "Enabled" +#define OFF "Enabled" + +#define CP15_MMU (1<<0) /* mmu off/on */ +#define CP15_DC (1<<2) /* dcache off/on */ +#define CP15_IC (1<<12) /* icache off/on */ + /* FIXME: target tree is including ./debug-target.h rather than the one in * sansa-fuze/, even though deps contains the correct one * if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/ @@ -39,8 +46,16 @@ short button_dbop_data(void); #endif +static unsigned read_cp15 (void) +{ + unsigned value; -/* TODO */ + asm volatile ( + "mrc p15, 0, %0, c1, c0, 0 @ read control reg\n":"=r" + (value)::"memory" + ); + return (value); +} bool __dbg_hw_info(void) { @@ -68,6 +83,9 @@ bool __dbg_ports(void) _DEBUG_PRINTF("[DBOP_DIN]"); _DEBUG_PRINTF("DBOP_DIN: %4x", button_dbop_data()); #endif + line++; + _DEBUG_PRINTF("[CP15]"); + _DEBUG_PRINTF("CP15: 0x%8x", read_cp15()); lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) break; diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 26c806efc7..7af38ff9d1 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c @@ -236,6 +236,9 @@ void system_init(void) CGU_PERI |= ((CLK_DIV(AS3525_PLLA_FREQ, AS3525_PCLK_FREQ) - 1) << 2) | 1; /* clk_in = PLLA */ + + /* FIXME: dcache will not be active, since the mmu is not running + * See arm922t datasheet */ asm volatile( "mov r0, #0 \n" "mcr p15, 0, r0, c7, c7 \n" /* invalidate icache & dcache */