10 #include <linux/kernel.h>
11 #include <linux/module.h>
27 static u16 bcm63xx_cpu_id;
28 static u16 bcm63xx_cpu_rev;
29 static unsigned int bcm63xx_cpu_freq;
30 static unsigned int bcm63xx_memory_size;
32 static const unsigned long bcm6328_regs_base[] = {
36 static const int bcm6328_irqs[] = {
40 static const unsigned long bcm6338_regs_base[] = {
44 static const int bcm6338_irqs[] = {
48 static const unsigned long bcm6345_regs_base[] = {
52 static const int bcm6345_irqs[] = {
56 static const unsigned long bcm6348_regs_base[] = {
60 static const int bcm6348_irqs[] = {
65 static const unsigned long bcm6358_regs_base[] = {
69 static const int bcm6358_irqs[] = {
74 static const unsigned long bcm6368_regs_base[] = {
78 static const int bcm6368_irqs[] = {
85 return bcm63xx_cpu_id;
92 return bcm63xx_cpu_rev;
99 return bcm63xx_cpu_freq;
104 return bcm63xx_memory_size;
107 static unsigned int detect_cpu_clock(
void)
109 switch (bcm63xx_get_cpu_id()) {
112 unsigned int tmp, mips_pll_fcvo;
118 switch (mips_pll_fcvo) {
147 unsigned int tmp, n1, n2, m1;
157 return (16 * 1000000 * n1 * n2) / m1;
162 unsigned int tmp, n1, n2, m1;
169 return (16 * 1000000 * n1 * n2) / m1;
174 unsigned int tmp,
p1, p2, ndiv, m1;
192 return (((64 * 1000000) / p1) * p2 * ndiv) / m1;
203 static unsigned int detect_memory_size(
void)
213 return (val * 8 * 1024 * 1024);
238 return 1 << (cols +
rows + (is_32bits + 1) +
banks);
243 unsigned int tmp, expected_cpu_id;
297 if (!expected_cpu_id)
298 panic(
"unsupported Broadcom CPU");
309 if (bcm63xx_cpu_id != expected_cpu_id)
310 panic(
"bcm63xx CPU id mismatch");
312 bcm63xx_cpu_freq = detect_cpu_clock();
313 bcm63xx_memory_size = detect_memory_size();
316 bcm63xx_cpu_id, bcm63xx_cpu_rev);
318 bcm63xx_cpu_freq / 1000000);
320 bcm63xx_memory_size >> 20);