Index: apps/plugins/plugin.lds =================================================================== --- apps/plugins/plugin.lds (Revision 20583) +++ apps/plugins/plugin.lds (Arbeitskopie) @@ -1,4 +1,5 @@ #include "config.h" +#include "cpu.h" /* These output formats should be in the config-files */ @@ -36,16 +37,16 @@ #endif #if CONFIG_CPU==DM320 || CONFIG_CPU==S3C2440 -#include "cpu.h" #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE #elif CONFIG_CPU==IMX31L #include "imx31l.h" /* Reserve 1mb for LCD buffer/TTB as in app.lds */ -#define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - +STUBOFFSET - CODEC_SIZE #elif CONFIG_CPU==AS3525 && MEMORYSIZE <= 2 -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - TTB_SIZE #else -#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE - TTB_SIZE #endif #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300) Index: firmware/export/as3525.h =================================================================== --- firmware/export/as3525.h (Revision 20583) +++ firmware/export/as3525.h (Arbeitskopie) @@ -26,7 +26,11 @@ #define ECCSIZE 512 #define ECCBYTES 3 +/* AS352X MMU Page Table Entries */ +#define TTB_SIZE 0x4000 /* Mimics OF */ +#define TTB_BASE_ADDR (0x30000000 + MEM*0x100000 - TTB_SIZE) + /* AS352X device base addresses */ Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (Revision 20583) +++ firmware/SOURCES (Arbeitskopie) @@ -360,6 +360,7 @@ target/arm/as3525/usb-as3525.c target/arm/as3525/dma-pl081.c target/arm/as3525/ascodec-as3525.c +target/arm/mmu-arm.S #ifndef BOOTLOADER drivers/generic_i2c.c target/arm/adc-as3514.c Index: firmware/target/arm/mmu-arm.h =================================================================== --- firmware/target/arm/mmu-arm.h (Revision 20583) +++ firmware/target/arm/mmu-arm.h (Arbeitskopie) @@ -53,6 +53,12 @@ /* will do writeback */ void invalidate_idcache(void); +/* Set bus speed relationships */ +void mmu_bus_fast(void); +void mmu_bus_sync(void); +void mmu_bus_async(void); + + #define HAVE_CPUCACHE_INVALIDATE #define HAVE_CPUCACHE_FLUSH Index: firmware/target/arm/crt0.S =================================================================== --- firmware/target/arm/crt0.S (Revision 20583) +++ firmware/target/arm/crt0.S (Arbeitskopie) @@ -89,6 +89,36 @@ bhi 1b #endif + /* Setup the MMU, start by disabling */ + + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x41 /* disable mmu and dcache */ + bic r0, r0, #0x1000 /* disable icache */ + mcr p15, 0, r0, c1, c0, 0 + + bl ttb_init + /* Mimic OF Caching Scheme */ + ldr r0, =0x0 + ldr r1, =0x0 + ldr r2, =0x1000 + mov r3, #0 + bl map_section + + ldr r0, =0x0 + mov r1, r0 @ Flat Mapped + mov r2, #1 + mov r3, #0xc @ writeback cache + bl map_section + + ldr r0, =0x30000000 + mov r1, r0 @ Flat Mapped + mov r2, #1 + mov r3, #0xc @ writeback cache + bl map_section + + bl enable_mmu + bl mmu_bus_async + /* Initialise bss section to zero */ ldr r2, =_edata ldr r3, =_end Index: firmware/target/arm/as3525/boot.lds =================================================================== --- firmware/target/arm/as3525/boot.lds (Revision 20583) +++ firmware/target/arm/as3525/boot.lds (Arbeitskopie) @@ -5,7 +5,7 @@ OUTPUT_ARCH(arm) STARTUP(target/arm/crt0.o) -#define DRAMSIZE (MEMORYSIZE * 0x100000) +#define DRAMSIZE (MEMORYSIZE * 0x100000) - TTB_SIZE #define DRAMORIG 0x30000000 #define IRAMORIG 0 #define IRAMSIZE 0x50000 Index: firmware/target/arm/as3525/app.lds =================================================================== --- firmware/target/arm/as3525/app.lds (Revision 20583) +++ firmware/target/arm/as3525/app.lds (Arbeitskopie) @@ -25,10 +25,11 @@ #define IRAMSIZE 0x50000 #ifdef LOWMEM -#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - TTB_SIZE #define CODECORIG (IRAMORIG + IRAMSIZE - CODEC_SIZE) #else -#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE +#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGINSIZE - CODECSIZE \ + - TTB_SIZE #define CODECORIG (ENDAUDIOADDR) #endif Index: firmware/target/arm/as3525/ata_sd_as3525.c =================================================================== --- firmware/target/arm/as3525/ata_sd_as3525.c (Revision 20583) +++ firmware/target/arm/as3525/ata_sd_as3525.c (Arbeitskopie) @@ -41,6 +41,7 @@ #include "stdbool.h" #include "ata_idle_notify.h" #include "sd.h" +#include "mmu-arm.h" #ifdef HAVE_HOTSWAP #include "disk.h" @@ -704,6 +705,8 @@ dma_retain(); + invalidate_dcache_range(buf, (count * SECTOR_SIZE)); + while(count) { /* Interrupt handler might set this to true during transfer */ Index: firmware/target/arm/mmu-arm.S =================================================================== --- firmware/target/arm/mmu-arm.S (Revision 20583) +++ firmware/target/arm/mmu-arm.S (Arbeitskopie) @@ -476,12 +476,65 @@ .type invalidate_idcache, %function .global cpucache_invalidate @ Alias invalidate_idcache: -cpucache_invalidate: +cpucache_invalidate: mov r1, lr @ save lr to r1, call uses r0 only bl invalidate_dcache @ Clean and invalidate entire DCache mcr p15, 0, r0, c7, c5, 0 @ Invalidate ICache (r0=0 from call) mov pc, r1 @ .size invalidate_idcache, .-invalidate_idcache +/* + *void mmu_bus_fast(void) + * + */ + .section .text, "ax", %progbits + .align 2 + .global mmu_bus_fast + .type mmu_bus_fast, %function + +mmu_bus_fast: + mrc 15, 0, r0, c1, c0, 0 @Read control reg + bic r0, r0, #0xc0000000 @Set Fast Bus + mcr 15, 0, r0, c1, c0, 0 @Make it so + bx lr + + .size mmu_bus_fast, .-mmu_bus_fast + +/* + *void mmu_bus_sync(void) + * + */ + .section .text, "ax", %progbits + .align 2 + .global mmu_bus_sync + .type mmu_bus_sync, %function + +mmu_bus_sync: + mrc 15, 0, r0, c1, c0, 0 @Read control reg + bic r0, r0, #0xc0000000 @Clear Bus bits + orr r0, r0, #0x40000000 @Set Sync Bus + mcr 15, 0, r0, c1, c0, 0 @Make it so + bx lr + + .size mmu_bus_sync, .-mmu_bus_sync + +/* + *void mmu_bus_async(void) + * + */ + .section .text, "ax", %progbits + .align 2 + .global mmu_bus_async + .type mmu_bus_async, %function + +mmu_bus_async: + mrc 15, 0, r0, c1, c0, 0 @Read control reg + bic r0, r0, #0xc0000000 @Set Fast Bus + mcr 15, 0, r0, c1, c0, 0 @Make it so + bx lr + + .size mmu_bus_async, .-mmu_bus_async + + #endif /* !IMX31L */