summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-06 20:39:02 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-08-06 20:39:02 +0000
commit88ae9024e4a1fec45e867f6a1f6cbea0ae0455bb (patch)
tree67fd77d2267eeda80987db55692886546a457e59 /firmware/target/mips/ingenic_jz47xx/system-jz4740.c
parent496e1f7e85f929c487eb89f85ff0fc7edfcf3a27 (diff)
downloadrockbox-88ae9024e4a1fec45e867f6a1f6cbea0ae0455bb.tar.gz
rockbox-88ae9024e4a1fec45e867f6a1f6cbea0ae0455bb.tar.bz2
rockbox-88ae9024e4a1fec45e867f6a1f6cbea0ae0455bb.zip
* Add basic (non-working) support for NAND flash
* Add panicf() handling * Add not-yet-enabled dma acceleration * Other (minor) fixes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18203 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/system-jz4740.c')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/system-jz4740.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
index 30681974da..a4bf76608b 100644
--- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
@@ -209,6 +209,28 @@ void __dcache_writeback_all(void)
SYNC_WB();
}
+void dma_cache_wback_inv(unsigned long addr, unsigned long size)
+{
+ unsigned long end, a;
+
+ if (size >= CACHE_SIZE)
+ __dcache_writeback_all();
+ else
+ {
+ unsigned long dc_lsize = CACHE_LINE_SIZE;
+
+ a = addr & ~(dc_lsize - 1);
+ end = (addr + size - 1) & ~(dc_lsize - 1);
+ while (1)
+ {
+ __flush_dcache_line(a); /* Hit_Writeback_Inv_D */
+ if (a == end)
+ break;
+ a += dc_lsize;
+ }
+ }
+}
+
extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
#define USE_RTC_CLOCK 0
@@ -251,15 +273,21 @@ extern unsigned int _vectorsend; /* see boot.lds/app.lds */
void system_main(void)
{
cli();
- write_c0_status(0x10000400);
+ write_c0_status(1 << 28 | 1 << 10); /* Enable CP | Mask interrupt 2 */
- memcpy((void *)A_K0BASE, (void *)&_loadaddress, 0x20);
+ memcpy((void *)A_K0BASE, (void *)&_vectorsstart, 0x20);
memcpy((void *)(A_K0BASE + 0x180), (void *)&_vectorsstart, 0x20);
memcpy((void *)(A_K0BASE + 0x200), (void *)&_vectorsstart, 0x20);
__dcache_writeback_all();
__icache_invalidate_all();
+ (*((unsigned int*)(0x80000200))) = 0x42;
+ (*((unsigned int*)(0x80000204))) = 0x45;
+ (*((unsigned int*)(0x80000208))) = 0x10020;
+
+ set_c0_status(1 << 22); /* Enable Boot Exception Vectors */
+
sti();
detect_clock();