uClibc: fix ubicom32 compile error with 0.9.32
[openwrt.git] / target / linux / brcm47xx / patches-2.6.37 / 017-MIPS-BCM47xx-revert_decouple_bmips_cpu_support.patch
1 --- a/arch/mips/bcm63xx/cpu.c
2 +++ b/arch/mips/bcm63xx/cpu.c
3 @@ -10,9 +10,7 @@
4  #include <linux/kernel.h>
5  #include <linux/module.h>
6  #include <linux/cpu.h>
7 -#include <asm/cpu.h>
8  #include <asm/cpu-info.h>
9 -#include <asm/mipsregs.h>
10  #include <bcm63xx_cpu.h>
11  #include <bcm63xx_regs.h>
12  #include <bcm63xx_io.h>
13 @@ -298,24 +296,26 @@ void __init bcm63xx_cpu_init(void)
14         expected_cpu_id = 0;
15  
16         switch (c->cputype) {
17 -       case CPU_BMIPS3300:
18 -               if ((read_c0_prid() & 0xff00) == PRID_IMP_BMIPS3300_ALT) {
19 -                       expected_cpu_id = BCM6348_CPU_ID;
20 -                       bcm63xx_regs_base = bcm96348_regs_base;
21 -                       bcm63xx_irqs = bcm96348_irqs;
22 -               } else {
23 -                       __cpu_name[cpu] = "Broadcom BCM6338";
24 -                       expected_cpu_id = BCM6338_CPU_ID;
25 -                       bcm63xx_regs_base = bcm96338_regs_base;
26 -                       bcm63xx_irqs = bcm96338_irqs;
27 -               }
28 +       /*
29 +        * BCM6338 as the same PrId as BCM3302 see arch/mips/kernel/cpu-probe.c
30 +        */
31 +       case CPU_BCM3302:
32 +               __cpu_name[cpu] = "Broadcom BCM6338";
33 +               expected_cpu_id = BCM6338_CPU_ID;
34 +               bcm63xx_regs_base = bcm96338_regs_base;
35 +               bcm63xx_irqs = bcm96338_irqs;
36                 break;
37 -       case CPU_BMIPS32:
38 +       case CPU_BCM6345:
39                 expected_cpu_id = BCM6345_CPU_ID;
40                 bcm63xx_regs_base = bcm96345_regs_base;
41                 bcm63xx_irqs = bcm96345_irqs;
42                 break;
43 -       case CPU_BMIPS4350:
44 +       case CPU_BCM6348:
45 +               expected_cpu_id = BCM6348_CPU_ID;
46 +               bcm63xx_regs_base = bcm96348_regs_base;
47 +               bcm63xx_irqs = bcm96348_irqs;
48 +               break;
49 +       case CPU_BCM6358:
50                 expected_cpu_id = BCM6358_CPU_ID;
51                 bcm63xx_regs_base = bcm96358_regs_base;
52                 bcm63xx_irqs = bcm96358_irqs;
53 --- a/arch/mips/include/asm/cpu.h
54 +++ b/arch/mips/include/asm/cpu.h
55 @@ -111,16 +111,14 @@
56   * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
57   */
58  
59 -#define PRID_IMP_BMIPS4KC      0x4000
60 -#define PRID_IMP_BMIPS32       0x8000
61 -#define PRID_IMP_BMIPS3300     0x9000
62 -#define PRID_IMP_BMIPS3300_ALT 0x9100
63 -#define PRID_IMP_BMIPS3300_BUG 0x0000
64 -#define PRID_IMP_BMIPS43XX     0xa000
65 -#define PRID_IMP_BMIPS5000     0x5a00
66 -
67 -#define PRID_REV_BMIPS4380_LO  0x0040
68 -#define PRID_REV_BMIPS4380_HI  0x006f
69 +#define PRID_IMP_BCM4710       0x4000
70 +#define PRID_IMP_BCM3302       0x9000
71 +#define PRID_IMP_BCM6338       0x9000
72 +#define PRID_IMP_BCM6345       0x8000
73 +#define PRID_IMP_BCM6348       0x9100
74 +#define PRID_IMP_BCM4350       0xA000
75 +#define PRID_REV_BCM6358       0x0010
76 +#define PRID_REV_BCM6368       0x0030
77  
78  /*
79   * These are the PRID's for when 23:16 == PRID_COMP_CAVIUM
80 @@ -226,8 +224,9 @@ enum cpu_type_enum {
81          * MIPS32 class processors
82          */
83         CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
84 -       CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
85 -       CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC,
86 +       CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
87 +       CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358,
88 +       CPU_JZRISC,
89  
90         /*
91          * MIPS64 class processors
92 --- a/arch/mips/kernel/cpu-probe.c
93 +++ b/arch/mips/kernel/cpu-probe.c
94 @@ -183,10 +183,10 @@ void __init check_wait(void)
95         case CPU_5KC:
96         case CPU_25KF:
97         case CPU_PR4450:
98 -       case CPU_BMIPS3300:
99 -       case CPU_BMIPS4350:
100 -       case CPU_BMIPS4380:
101 -       case CPU_BMIPS5000:
102 +       case CPU_BCM3302:
103 +       case CPU_BCM6338:
104 +       case CPU_BCM6348:
105 +       case CPU_BCM6358:
106         case CPU_CAVIUM_OCTEON:
107         case CPU_CAVIUM_OCTEON_PLUS:
108         case CPU_CAVIUM_OCTEON2:
109 @@ -905,37 +905,33 @@ static inline void cpu_probe_broadcom(st
110  {
111         decode_configs(c);
112         switch (c->processor_id & 0xff00) {
113 -       case PRID_IMP_BMIPS32:
114 -               c->cputype = CPU_BMIPS32;
115 -               __cpu_name[cpu] = "Broadcom BMIPS32";
116 -               break;
117 -       case PRID_IMP_BMIPS3300:
118 -       case PRID_IMP_BMIPS3300_ALT:
119 -       case PRID_IMP_BMIPS3300_BUG:
120 -               c->cputype = CPU_BMIPS3300;
121 -               __cpu_name[cpu] = "Broadcom BMIPS3300";
122 -               break;
123 -       case PRID_IMP_BMIPS43XX: {
124 -               int rev = c->processor_id & 0xff;
125 -
126 -               if (rev >= PRID_REV_BMIPS4380_LO &&
127 -                               rev <= PRID_REV_BMIPS4380_HI) {
128 -                       c->cputype = CPU_BMIPS4380;
129 -                       __cpu_name[cpu] = "Broadcom BMIPS4380";
130 -               } else {
131 -                       c->cputype = CPU_BMIPS4350;
132 -                       __cpu_name[cpu] = "Broadcom BMIPS4350";
133 -               }
134 -               break;
135 -       }
136 -       case PRID_IMP_BMIPS5000:
137 -               c->cputype = CPU_BMIPS5000;
138 -               __cpu_name[cpu] = "Broadcom BMIPS5000";
139 -               c->options |= MIPS_CPU_ULRI;
140 +       case PRID_IMP_BCM3302:
141 +        /* same as PRID_IMP_BCM6338 */
142 +               c->cputype = CPU_BCM3302;
143 +               __cpu_name[cpu] = "Broadcom BCM3302";
144 +               break;
145 +       case PRID_IMP_BCM4710:
146 +               c->cputype = CPU_BCM4710;
147 +               __cpu_name[cpu] = "Broadcom BCM4710";
148 +               break;
149 +       case PRID_IMP_BCM6345:
150 +               c->cputype = CPU_BCM6345;
151 +               __cpu_name[cpu] = "Broadcom BCM6345";
152 +               break;
153 +       case PRID_IMP_BCM6348:
154 +               c->cputype = CPU_BCM6348;
155 +               __cpu_name[cpu] = "Broadcom BCM6348";
156                 break;
157 -       case PRID_IMP_BMIPS4KC:
158 -               c->cputype = CPU_4KC;
159 -               __cpu_name[cpu] = "MIPS 4Kc";
160 +       case PRID_IMP_BCM4350:
161 +               switch (c->processor_id & 0xf0) {
162 +               case PRID_REV_BCM6358:
163 +                       c->cputype = CPU_BCM6358;
164 +                       __cpu_name[cpu] = "Broadcom BCM6358";
165 +                       break;
166 +               default:
167 +                       c->cputype = CPU_UNKNOWN;
168 +                       break;
169 +               }
170                 break;
171         }
172  }
173 --- a/arch/mips/mm/tlbex.c
174 +++ b/arch/mips/mm/tlbex.c
175 @@ -338,12 +338,13 @@ static void __cpuinit build_tlb_write_en
176         case CPU_4KSC:
177         case CPU_20KC:
178         case CPU_25KF:
179 -       case CPU_BMIPS32:
180 -       case CPU_BMIPS3300:
181 -       case CPU_BMIPS4350:
182 -       case CPU_BMIPS4380:
183 -       case CPU_BMIPS5000:
184 +       case CPU_BCM3302:
185 +       case CPU_BCM4710:
186         case CPU_LOONGSON2:
187 +       case CPU_BCM6338:
188 +       case CPU_BCM6345:
189 +       case CPU_BCM6348:
190 +       case CPU_BCM6358:
191         case CPU_R5500:
192                 if (m4kc_tlbp_war())
193                         uasm_i_nop(p);