lots of ifxmips cleanups
[openwrt/svn-archive/archive.git] / target / linux / ifxmips / files / arch / mips / ifxmips / cgu.c
index 3dec89e7c1d516c569f41d32a716293d949bc7ab..d1e2ff4fad3c68391bd56df6db98ad1b4b197b37 100644 (file)
@@ -413,3 +413,19 @@ cgu_get_clockout(int clkout)
        }
        return 0;
 }
+
+void cgu_setup_pci_clk(int external_clock)
+{
+       //set clock to 33Mhz 
+       ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~0xf00000, IFXMIPS_CGU_IFCCR);
+       ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | 0x800000, IFXMIPS_CGU_IFCCR);
+       // internal or external clock
+       if(external_clock)
+       {
+               ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~ (1 << 16), IFXMIPS_CGU_IFCCR);
+               ifxmips_w32((1 << 30), IFXMIPS_CGU_PCICR);
+       } else {
+               ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | (1 << 16), IFXMIPS_CGU_IFCCR);
+               ifxmips_w32((1 << 31) | (1 << 30), IFXMIPS_CGU_PCICR);
+       }
+}