20 #define PQ2_SCCR (0x10c80/4)
21 #define PQ2_SCMR (0x10c88/4)
23 static int pq2_corecnf_map[] = {
24 3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, -1,
25 6, 5, 13, 2, 14, 4, 15, 9, 0, 11, 8, 10, 16, 12, 7, -1
32 u32 *timebase,
u32 *brgfreq)
35 u32 sccr, scmr, mainclk, busclk;
36 int corecnf, busdf, plldf, pllmf, dfbrg;
40 printf(
"pq2_get_clocks: Couldn't get IMMR base.\r\n");
48 corecnf = (scmr >> 24) & 0x1f;
49 busdf = (scmr >> 20) & 0xf;
50 plldf = (scmr >> 12) & 1;
53 mainclk = crystal * (pllmf + 1) / (plldf + 1);
54 busclk = mainclk / (busdf + 1);
57 *sysfreq = mainclk / 2;
59 *timebase = busclk / 4;
61 *brgfreq = mainclk / (1 << ((dfbrg + 1) * 2));
64 int coremult = pq2_corecnf_map[corecnf];
67 *corefreq = mainclk / 2;
68 else if (coremult == 0)
71 *corefreq = busclk * coremult / 2;
84 node = finddevice(
"/soc/cpm");
86 setprop(node,
"clock-frequency", &sysfreq, 4);
88 node = finddevice(
"/soc/cpm/brg");
90 setprop(node,
"clock-frequency", &brgfreq, 4);
95 u32 sysfreq, corefreq, timebase, brgfreq;
97 if (!
pq2_get_clocks(crystal, &sysfreq, &corefreq, &timebase, &brgfreq))