summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-02-04 17:37:05 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-02-04 17:37:05 +0000
commitd5827d5f9abedf1406541af88938a5fcad42ea6c (patch)
tree55121ffec69a3b0a23fde5df13c8940e6525596e /firmware/target/mips/ingenic_jz47xx/system-jz4740.c
parent9b13a5d151a14ba7a5b8c502763cb56356260ceb (diff)
downloadrockbox-d5827d5f9abedf1406541af88938a5fcad42ea6c.tar.gz
rockbox-d5827d5f9abedf1406541af88938a5fcad42ea6c.zip
MIPS:
* Add missing mmu-mips.h change Onda VX747: * Correct USB power handling * Improve NAND handling * Other minor fixes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19921 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.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
index 9c7f83530f..052ea64495 100644
--- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c
@@ -369,15 +369,10 @@ void exception_handler(void* stack_ptr, unsigned int cause, unsigned int epc)
369 panicf("Exception occurred: %s [0x%08x] at 0x%08x (stack at 0x%08x)", parse_exception(cause), cause, epc, (unsigned int)stack_ptr); 369 panicf("Exception occurred: %s [0x%08x] at 0x%08x (stack at 0x%08x)", parse_exception(cause), cause, epc, (unsigned int)stack_ptr);
370} 370}
371 371
372static const int FR2n[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
373static unsigned int iclk; 372static unsigned int iclk;
374
375static void detect_clock(void) 373static void detect_clock(void)
376{ 374{
377 unsigned int cfcr, pllout; 375 iclk = __cpm_get_cclk();
378 cfcr = REG_CPM_CPCCR;
379 pllout = (__cpm_get_pllm() + 2)* JZ_EXTAL / (__cpm_get_plln() + 2);
380 iclk = pllout / FR2n[__cpm_get_cdiv()];
381} 376}
382 377
383void udelay(unsigned int usec) 378void udelay(unsigned int usec)
@@ -639,6 +634,9 @@ static inline void set_cpu_freq(unsigned int pllin, unsigned int div)
639 634
640static void OF_init_clocks(void) 635static void OF_init_clocks(void)
641{ 636{
637 unsigned long t = read_c0_status();
638 write_c0_status(t & ~1);
639
642 unsigned int prog_entry = ((unsigned int)OF_init_clocks >> 5) << 5; 640 unsigned int prog_entry = ((unsigned int)OF_init_clocks >> 5) << 5;
643 unsigned int i, prog_size = 1024; 641 unsigned int i, prog_size = 1024;
644 642
@@ -675,6 +673,8 @@ static void OF_init_clocks(void)
675 set_cpu_freq(336000000, 1); 673 set_cpu_freq(336000000, 1);
676 674
677 for(i=0; i<60; i++); 675 for(i=0; i<60; i++);
676
677 write_c0_status(t);
678} 678}
679 679
680static void my_init_clocks(void) 680static void my_init_clocks(void)
@@ -700,10 +700,10 @@ static void my_init_clocks(void)
700 CPM_CPCCR_UCS | 700 CPM_CPCCR_UCS |
701 CPM_CPCCR_PCS | 701 CPM_CPCCR_PCS |
702 (0 << CPM_CPCCR_CDIV_BIT) | 702 (0 << CPM_CPCCR_CDIV_BIT) |
703 (2 << CPM_CPCCR_HDIV_BIT) | 703 (1 << CPM_CPCCR_HDIV_BIT) |
704 (2 << CPM_CPCCR_PDIV_BIT) | 704 (1 << CPM_CPCCR_PDIV_BIT) |
705 (2 << CPM_CPCCR_MDIV_BIT) | 705 (1 << CPM_CPCCR_MDIV_BIT) |
706 (2 << CPM_CPCCR_LDIV_BIT); 706 (1 << CPM_CPCCR_LDIV_BIT);
707 707
708 plcr1 = (54 << CPM_CPPCR_PLLM_BIT) | /* FD */ 708 plcr1 = (54 << CPM_CPPCR_PLLM_BIT) | /* FD */
709 (0 << CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */ 709 (0 << CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */
@@ -763,6 +763,7 @@ void system_main(void)
763 763
764#if 0 764#if 0
765 my_init_clocks(); 765 my_init_clocks();
766 //OF_init_clocks();
766 /*__cpm_stop_udc(); 767 /*__cpm_stop_udc();
767 REG_CPM_CPCCR |= CPM_CPCCR_UCS; 768 REG_CPM_CPCCR |= CPM_CPCCR_UCS;
768 REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_UDIV_MASK) | (3 << CPM_CPCCR_UDIV_BIT); 769 REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_UDIV_MASK) | (3 << CPM_CPCCR_UDIV_BIT);