ar7: remove volatiles definitely
[openwrt.git] / target / linux / brcm-2.4 / patches / 001-bcm47xx.patch
1 Index: linux-2.4.35.4/arch/mips/config-shared.in
2 ===================================================================
3 --- linux-2.4.35.4.orig/arch/mips/config-shared.in      2007-12-15 05:19:53.151449966 +0100
4 +++ linux-2.4.35.4/arch/mips/config-shared.in   2007-12-15 05:20:13.936634447 +0100
5 @@ -208,6 +208,14 @@
6     fi
7     define_bool CONFIG_MIPS_RTC y
8  fi
9 +dep_bool 'Support for Broadcom MIPS-based boards' CONFIG_MIPS_BRCM $CONFIG_EXPERIMENTAL
10 +dep_bool 'Support for Broadcom BCM947XX' CONFIG_BCM947XX $CONFIG_MIPS_BRCM
11 +if [ "$CONFIG_BCM947XX" = "y" ] ; then
12 +   bool '    Support for Broadcom BCM4710' CONFIG_BCM4710
13 +   bool '    Support for Broadcom BCM4310' CONFIG_BCM4310
14 +   bool '    Support for Broadcom BCM4704' CONFIG_BCM4704
15 +   bool '    Support for Broadcom BCM5365' CONFIG_BCM5365
16 +fi
17  bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI
18  bool 'Support for TANBAC TB0226 (Mbase)' CONFIG_TANBAC_TB0226
19  bool 'Support for TANBAC TB0229 (VR4131DIMM)' CONFIG_TANBAC_TB0229
20 @@ -229,6 +237,11 @@
21  define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
22  
23  #
24 +# Provide an option for a default kernel command line
25 +#
26 +string 'Default kernel command string' CONFIG_CMDLINE ""
27 +
28 +#
29  # Select some configuration options automatically based on user selections.
30  #
31  if [ "$CONFIG_ACER_PICA_61" = "y" ]; then
32 @@ -554,6 +567,12 @@
33     define_bool CONFIG_SWAP_IO_SPACE_L y
34     define_bool CONFIG_BOOT_ELF32 y
35  fi
36 +if [ "$CONFIG_BCM947XX" = "y" ] ; then
37 +   define_bool CONFIG_PCI y
38 +   define_bool CONFIG_NONCOHERENT_IO y
39 +   define_bool CONFIG_NEW_TIME_C y
40 +   define_bool CONFIG_NEW_IRQ y
41 +fi
42  if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then
43     define_bool CONFIG_ARC32 y
44     define_bool CONFIG_ARC_MEMORY y
45 @@ -1042,7 +1061,11 @@
46  
47  bool 'Are you using a crosscompiler' CONFIG_CROSSCOMPILE
48  bool 'Enable run-time debugging' CONFIG_RUNTIME_DEBUG
49 -bool 'Remote GDB kernel debugging' CONFIG_KGDB
50 +if [ "$CONFIG_BCM947XX" = "y" ] ; then
51 +       bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
52 +else 
53 +       bool 'Remote GDB kernel debugging' CONFIG_KGDB
54 +fi
55  dep_bool '  Console output to GDB' CONFIG_GDB_CONSOLE $CONFIG_KGDB
56  if [ "$CONFIG_KGDB" = "y" ]; then
57     define_bool CONFIG_DEBUG_INFO y
58 Index: linux-2.4.35.4/arch/mips/kernel/cpu-probe.c
59 ===================================================================
60 --- linux-2.4.35.4.orig/arch/mips/kernel/cpu-probe.c    2007-12-15 05:19:44.862977633 +0100
61 +++ linux-2.4.35.4/arch/mips/kernel/cpu-probe.c 2007-12-15 05:20:13.944634901 +0100
62 @@ -162,7 +162,7 @@
63  
64  static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
65  {
66 -       switch (c->processor_id & 0xff00) {
67 +       switch (c->processor_id & PRID_IMP_MASK) {
68         case PRID_IMP_R2000:
69                 c->cputype = CPU_R2000;
70                 c->isa_level = MIPS_CPU_ISA_I;
71 @@ -172,7 +172,7 @@
72                 c->tlbsize = 64;
73                 break;
74         case PRID_IMP_R3000:
75 -               if ((c->processor_id & 0xff) == PRID_REV_R3000A)
76 +               if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A)
77                         if (cpu_has_confreg())
78                                 c->cputype = CPU_R3081E;
79                         else
80 @@ -187,12 +187,12 @@
81                 break;
82         case PRID_IMP_R4000:
83                 if (read_c0_config() & CONF_SC) {
84 -                       if ((c->processor_id & 0xff) >= PRID_REV_R4400)
85 +                       if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
86                                 c->cputype = CPU_R4400PC;
87                         else
88                                 c->cputype = CPU_R4000PC;
89                 } else {
90 -                       if ((c->processor_id & 0xff) >= PRID_REV_R4400)
91 +                       if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
92                                 c->cputype = CPU_R4400SC;
93                         else
94                                 c->cputype = CPU_R4000SC;
95 @@ -438,7 +438,7 @@
96  static inline void cpu_probe_mips(struct cpuinfo_mips *c)
97  {
98         decode_config1(c);
99 -       switch (c->processor_id & 0xff00) {
100 +       switch (c->processor_id & PRID_IMP_MASK) {
101         case PRID_IMP_4KC:
102                 c->cputype = CPU_4KC;
103                 c->isa_level = MIPS_CPU_ISA_M32;
104 @@ -479,10 +479,10 @@
105  {
106         decode_config1(c);
107         c->options |= MIPS_CPU_PREFETCH;
108 -       switch (c->processor_id & 0xff00) {
109 +       switch (c->processor_id & PRID_IMP_MASK) {
110         case PRID_IMP_AU1_REV1:
111         case PRID_IMP_AU1_REV2:
112 -               switch ((c->processor_id >> 24) & 0xff) {
113 +               switch ((c->processor_id >> 24) & PRID_REV_MASK) {
114                 case 0:
115                         c->cputype = CPU_AU1000;
116                         break;
117 @@ -510,10 +510,34 @@
118         }
119  }
120  
121 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
122 +{
123 +       decode_config1(c);
124 +       c->options |= MIPS_CPU_PREFETCH;
125 +       switch (c->processor_id & PRID_IMP_MASK) {
126 +       case PRID_IMP_BCM4710:
127 +                       c->cputype = CPU_BCM4710;
128 +                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 
129 +                                                               MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
130 +                       c->scache.flags = MIPS_CACHE_NOT_PRESENT;
131 +                       break;
132 +       case PRID_IMP_4KC:              
133 +       case PRID_IMP_BCM3302:          
134 +                       c->cputype = CPU_BCM3302;
135 +                       c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 
136 +                                                               MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
137 +                       c->scache.flags = MIPS_CACHE_NOT_PRESENT;
138 +                       break;
139 +       default:
140 +                       c->cputype = CPU_UNKNOWN;
141 +                       break;
142 +       }
143 +}
144 +
145  static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
146  {
147         decode_config1(c);
148 -       switch (c->processor_id & 0xff00) {
149 +       switch (c->processor_id & PRID_IMP_MASK) {
150         case PRID_IMP_SB1:
151                 c->cputype = CPU_SB1;
152                 c->isa_level = MIPS_CPU_ISA_M64;
153 @@ -535,7 +559,7 @@
154  static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
155  {
156         decode_config1(c);
157 -       switch (c->processor_id & 0xff00) {
158 +       switch (c->processor_id & PRID_IMP_MASK) {
159         case PRID_IMP_SR71000:
160                 c->cputype = CPU_SR71000;
161                 c->isa_level = MIPS_CPU_ISA_M64;
162 @@ -560,7 +584,7 @@
163         c->cputype      = CPU_UNKNOWN;
164  
165         c->processor_id = read_c0_prid();
166 -       switch (c->processor_id & 0xff0000) {
167 +       switch (c->processor_id & PRID_COMP_MASK) {
168  
169         case PRID_COMP_LEGACY:
170                 cpu_probe_legacy(c);
171 @@ -571,6 +595,9 @@
172         case PRID_COMP_ALCHEMY:
173                 cpu_probe_alchemy(c);
174                 break;
175 +       case PRID_COMP_BROADCOM:
176 +               cpu_probe_broadcom(c);
177 +               break;
178         case PRID_COMP_SIBYTE:
179                 cpu_probe_sibyte(c);
180                 break;
181 Index: linux-2.4.35.4/arch/mips/kernel/head.S
182 ===================================================================
183 --- linux-2.4.35.4.orig/arch/mips/kernel/head.S 2007-12-15 05:19:44.866977862 +0100
184 +++ linux-2.4.35.4/arch/mips/kernel/head.S      2007-12-15 05:20:13.944634901 +0100
185 @@ -28,12 +28,20 @@
186  #include <asm/mipsregs.h>
187  #include <asm/stackframe.h>
188  
189 +#ifdef CONFIG_BCM4710
190 +#undef eret
191 +#define eret nop; nop; eret
192 +#endif
193 +
194                 .text
195 +               j       kernel_entry
196 +               nop
197 +
198                 /*
199                  * Reserved space for exception handlers.
200                  * Necessary for machines which link their kernels at KSEG0.
201                  */
202 -               .fill   0x400
203 +               .fill   0x3f4
204  
205                 /* The following two symbols are used for kernel profiling. */
206                 EXPORT(stext)
207 Index: linux-2.4.35.4/arch/mips/kernel/proc.c
208 ===================================================================
209 --- linux-2.4.35.4.orig/arch/mips/kernel/proc.c 2007-12-15 05:19:36.358492990 +0100
210 +++ linux-2.4.35.4/arch/mips/kernel/proc.c      2007-12-15 05:20:13.944634901 +0100
211 @@ -78,9 +78,10 @@
212         [CPU_AU1550]    "Au1550",
213         [CPU_24K]       "MIPS 24K",
214         [CPU_AU1200]    "Au1200",
215 +       [CPU_BCM4710]   "BCM4710",
216 +       [CPU_BCM3302]   "BCM3302",
217  };
218  
219 -
220  static int show_cpuinfo(struct seq_file *m, void *v)
221  {
222         unsigned int version = current_cpu_data.processor_id;
223 Index: linux-2.4.35.4/arch/mips/kernel/setup.c
224 ===================================================================
225 --- linux-2.4.35.4.orig/arch/mips/kernel/setup.c        2007-12-15 05:19:44.866977862 +0100
226 +++ linux-2.4.35.4/arch/mips/kernel/setup.c     2007-12-15 05:20:13.944634901 +0100
227 @@ -493,6 +493,7 @@
228         void swarm_setup(void);
229         void hp_setup(void);
230         void au1x00_setup(void);
231 +       void brcm_setup(void);
232         void frame_info_init(void);
233  
234         frame_info_init();
235 @@ -691,6 +692,11 @@
236                  pmc_yosemite_setup();
237                  break;
238  #endif
239 +#if defined(CONFIG_BCM4710) || defined(CONFIG_BCM4310)
240 +       case MACH_GROUP_BRCM:
241 +                       brcm_setup();
242 +                       break;
243 +#endif 
244         default:
245                 panic("Unsupported architecture");
246         }
247 Index: linux-2.4.35.4/arch/mips/kernel/traps.c
248 ===================================================================
249 --- linux-2.4.35.4.orig/arch/mips/kernel/traps.c        2007-12-15 05:19:44.870978088 +0100
250 +++ linux-2.4.35.4/arch/mips/kernel/traps.c     2007-12-15 05:20:13.944634901 +0100
251 @@ -920,6 +920,7 @@
252  void __init trap_init(void)
253  {
254         extern char except_vec1_generic;
255 +       extern char except_vec2_generic;
256         extern char except_vec3_generic, except_vec3_r4000;
257         extern char except_vec_ejtag_debug;
258         extern char except_vec4;
259 @@ -927,6 +928,7 @@
260  
261         /* Copy the generic exception handler code to it's final destination. */
262         memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
263 +       memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
264  
265         /*
266          * Setup default vectors
267 @@ -985,6 +987,12 @@
268         set_except_vector(13, handle_tr);
269         set_except_vector(22, handle_mdmx);
270  
271 +       if (current_cpu_data.cputype == CPU_SB1) {
272 +               /* Enable timer interrupt and scd mapped interrupt */
273 +               clear_c0_status(0xf000);
274 +               set_c0_status(0xc00);
275 +       }
276 +
277         if (cpu_has_fpu && !cpu_has_nofpuex)
278                 set_except_vector(15, handle_fpe);
279  
280 Index: linux-2.4.35.4/arch/mips/Makefile
281 ===================================================================
282 --- linux-2.4.35.4.orig/arch/mips/Makefile      2007-12-15 05:19:51.215339635 +0100
283 +++ linux-2.4.35.4/arch/mips/Makefile   2007-12-15 05:20:13.948635130 +0100
284 @@ -726,6 +726,19 @@
285  endif
286  
287  #
288 +# Broadcom BCM947XX variants
289 +#
290 +ifdef CONFIG_BCM947XX
291 +LIBS           += arch/mips/bcm947xx/generic/brcm.o arch/mips/bcm947xx/bcm947xx.o 
292 +SUBDIRS                += arch/mips/bcm947xx/generic arch/mips/bcm947xx 
293 +LOADADDR       := 0x80001000
294 +
295 +zImage: vmlinux
296 +       $(MAKE) -C arch/$(ARCH)/bcm947xx/compressed
297 +export LOADADDR
298 +endif
299 +
300 +#
301  # Choosing incompatible machines durings configuration will result in
302  # error messages during linking.  Select a default linkscript if
303  # none has been choosen above.
304 @@ -779,6 +792,7 @@
305         $(MAKE) -C arch/$(ARCH)/tools clean
306         $(MAKE) -C arch/mips/baget clean
307         $(MAKE) -C arch/mips/lasat clean
308 +       $(MAKE) -C arch/mips/bcm947xx/compressed clean
309  
310  archmrproper:
311         @$(MAKEBOOT) mrproper
312 Index: linux-2.4.35.4/arch/mips/mm/c-r4k.c
313 ===================================================================
314 --- linux-2.4.35.4.orig/arch/mips/mm/c-r4k.c    2007-12-15 05:19:44.874978317 +0100
315 +++ linux-2.4.35.4/arch/mips/mm/c-r4k.c 2007-12-15 05:20:13.948635130 +0100
316 @@ -1118,3 +1118,47 @@
317         build_clear_page();
318         build_copy_page();
319  }
320 +
321 +#ifdef CONFIG_BCM4704
322 +static void __init mips32_icache_fill(unsigned long addr, uint nbytes)
323 +{
324 +       unsigned long ic_lsize = current_cpu_data.icache.linesz;
325 +       int i;
326 +       for (i = 0; i < nbytes; i += ic_lsize)
327 +               fill_icache_line((addr + i));
328 +}
329 +
330 +/*
331 + *  This must be run from the cache on 4704A0
332 + *  so there are no mips core BIU ops in progress
333 + *  when the PFC is enabled.
334 + */
335 +#define PFC_CR0         0xff400000      /* control reg 0 */
336 +#define PFC_CR1         0xff400004      /* control reg 1 */
337 +static void __init enable_pfc(u32 mode)
338 +{
339 +       /* write range */
340 +       *(volatile u32 *)PFC_CR1 = 0xffff0000;
341 +
342 +       /* enable */
343 +       *(volatile u32 *)PFC_CR0 = mode;
344 +}
345 +#endif
346 +
347 +
348 +void check_enable_mips_pfc(int val)
349 +{
350 +
351 +#ifdef CONFIG_BCM4704
352 +       struct cpuinfo_mips *c = &current_cpu_data;
353 +
354 +       /* enable prefetch cache */
355 +       if (((c->processor_id & (PRID_COMP_MASK | PRID_IMP_MASK)) == PRID_IMP_BCM3302) 
356 +               && (read_c0_diag() & (1 << 29))) {
357 +                       mips32_icache_fill((unsigned long) &enable_pfc, 64);
358 +                       enable_pfc(val);
359 +       }
360 +#endif
361 +}
362 +
363 +
364 Index: linux-2.4.35.4/arch/mips/pci/Makefile
365 ===================================================================
366 --- linux-2.4.35.4.orig/arch/mips/pci/Makefile  2007-12-15 05:19:36.398495270 +0100
367 +++ linux-2.4.35.4/arch/mips/pci/Makefile       2007-12-15 05:20:13.948635130 +0100
368 @@ -13,7 +13,9 @@
369  obj-$(CONFIG_MIPS_MSC)         += ops-msc.o
370  obj-$(CONFIG_MIPS_NILE4)       += ops-nile4.o
371  obj-$(CONFIG_SNI_RM200_PCI)    += ops-sni.o
372 +ifndef CONFIG_BCM947XX
373  obj-y                          += pci.o
374 +endif
375  obj-$(CONFIG_PCI_AUTO)         += pci_auto.o
376  
377  include $(TOPDIR)/Rules.make
378 Index: linux-2.4.35.4/drivers/char/serial.c
379 ===================================================================
380 --- linux-2.4.35.4.orig/drivers/char/serial.c   2007-12-15 05:20:00.539871010 +0100
381 +++ linux-2.4.35.4/drivers/char/serial.c        2007-12-15 05:20:13.952635360 +0100
382 @@ -444,6 +444,10 @@
383                 return inb(info->port+1);
384  #endif
385         case SERIAL_IO_MEM:
386 +#ifdef CONFIG_BCM4310
387 +               readb((unsigned long) info->iomem_base +
388 +                               (UART_SCR<<info->iomem_reg_shift));
389 +#endif
390                 return readb((unsigned long) info->iomem_base +
391                              (offset<<info->iomem_reg_shift));
392         default:
393 @@ -464,6 +468,9 @@
394         case SERIAL_IO_MEM:
395                 writeb(value, (unsigned long) info->iomem_base +
396                               (offset<<info->iomem_reg_shift));
397 +#ifdef CONFIG_BCM4704
398 +               *((volatile unsigned int *) KSEG1ADDR(0x18000000));
399 +#endif
400                 break;
401         default:
402                 outb(value, info->port+offset);
403 @@ -1728,7 +1735,7 @@
404                         /* Special case since 134 is really 134.5 */
405                         quot = (2*baud_base / 269);
406                 else if (baud)
407 -                       quot = baud_base / baud;
408 +                       quot = (baud_base + (baud / 2)) / baud;
409         }
410         /* If the quotient is zero refuse the change */
411         if (!quot && old_termios) {
412 @@ -1745,12 +1752,12 @@
413                                 /* Special case since 134 is really 134.5 */
414                                 quot = (2*baud_base / 269);
415                         else if (baud)
416 -                               quot = baud_base / baud;
417 +                               quot = (baud_base + (baud / 2)) / baud;
418                 }
419         }
420         /* As a last resort, if the quotient is zero, default to 9600 bps */
421         if (!quot)
422 -               quot = baud_base / 9600;
423 +               quot = (baud_base + 4800) / 9600;
424         /*
425          * Work around a bug in the Oxford Semiconductor 952 rev B
426          * chip which causes it to seriously miscalculate baud rates
427 @@ -5994,6 +6001,13 @@
428          *      Divisor, bytesize and parity
429          */
430         state = rs_table + co->index;
431 +       /*
432 +        * Safe guard: state structure must have been initialized
433 +        */
434 +       if (state->iomem_base == NULL) {
435 +               printk("!unable to setup serial console!\n");
436 +               return -1;
437 +       }
438         if (doflow)
439                 state->flags |= ASYNC_CONS_FLOW;
440         info = &async_sercons;
441 @@ -6007,7 +6021,7 @@
442         info->io_type = state->io_type;
443         info->iomem_base = state->iomem_base;
444         info->iomem_reg_shift = state->iomem_reg_shift;
445 -       quot = state->baud_base / baud;
446 +       quot = (state->baud_base + (baud / 2)) / baud;
447         cval = cflag & (CSIZE | CSTOPB);
448  #if defined(__powerpc__) || defined(__alpha__)
449         cval >>= 8;
450 Index: linux-2.4.35.4/drivers/net/Makefile
451 ===================================================================
452 --- linux-2.4.35.4.orig/drivers/net/Makefile    2007-12-15 05:20:10.804455954 +0100
453 +++ linux-2.4.35.4/drivers/net/Makefile 2007-12-15 05:20:13.952635360 +0100
454 @@ -3,6 +3,8 @@
455  # Makefile for the Linux network (ethercard) device drivers.
456  #
457  
458 +EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include
459 +
460  obj-y           :=
461  obj-m           :=
462  obj-n           :=
463 Index: linux-2.4.35.4/drivers/parport/Config.in
464 ===================================================================
465 --- linux-2.4.35.4.orig/drivers/parport/Config.in       2007-12-15 05:19:36.422496639 +0100
466 +++ linux-2.4.35.4/drivers/parport/Config.in    2007-12-15 05:20:13.956635587 +0100
467 @@ -11,6 +11,7 @@
468  tristate 'Parallel port support' CONFIG_PARPORT
469  if [ "$CONFIG_PARPORT" != "n" ]; then
470     dep_tristate '  PC-style hardware' CONFIG_PARPORT_PC $CONFIG_PARPORT
471 +   dep_tristate '  Asus WL500g parallel port' CONFIG_PARPORT_SPLINK $CONFIG_PARPORT
472     if [ "$CONFIG_PARPORT_PC" != "n" -a "$CONFIG_SERIAL" != "n" ]; then
473        if [ "$CONFIG_SERIAL" = "m" ]; then
474           define_tristate CONFIG_PARPORT_PC_CML1 m
475 Index: linux-2.4.35.4/drivers/parport/Makefile
476 ===================================================================
477 --- linux-2.4.35.4.orig/drivers/parport/Makefile        2007-12-15 05:19:36.430497094 +0100
478 +++ linux-2.4.35.4/drivers/parport/Makefile     2007-12-15 05:20:13.956635587 +0100
479 @@ -22,6 +22,7 @@
480  
481  obj-$(CONFIG_PARPORT)          += parport.o
482  obj-$(CONFIG_PARPORT_PC)       += parport_pc.o
483 +obj-$(CONFIG_PARPORT_SPLINK)   += parport_splink.o
484  obj-$(CONFIG_PARPORT_PC_PCMCIA)        += parport_cs.o
485  obj-$(CONFIG_PARPORT_AMIGA)    += parport_amiga.o
486  obj-$(CONFIG_PARPORT_MFC3)     += parport_mfc3.o
487 Index: linux-2.4.35.4/include/asm-mips/bootinfo.h
488 ===================================================================
489 --- linux-2.4.35.4.orig/include/asm-mips/bootinfo.h     2007-12-15 05:19:45.026986980 +0100
490 +++ linux-2.4.35.4/include/asm-mips/bootinfo.h  2007-12-15 05:20:13.956635587 +0100
491 @@ -37,6 +37,7 @@
492  #define MACH_GROUP_HP_LJ       20 /* Hewlett Packard LaserJet               */
493  #define MACH_GROUP_LASAT       21
494  #define MACH_GROUP_TITAN       22 /* PMC-Sierra Titan                      */
495 +#define MACH_GROUP_BRCM                   23 /* Broadcom */
496  
497  /*
498   * Valid machtype values for group unknown (low order halfword of mips_machtype)
499 @@ -197,6 +198,15 @@
500  #define MACH_TANBAC_TB0229     7       /* TANBAC TB0229 (VR4131DIMM) */
501  
502  /*
503 + * Valid machtypes for group Broadcom
504 + */
505 +#define MACH_BCM93725          0
506 +#define MACH_BCM93725_VJ       1
507 +#define MACH_BCM93730          2
508 +#define MACH_BCM947XX          3
509 +#define MACH_BCM933XX          4
510 +
511 +/*
512   * Valid machtype for group TITAN
513   */
514  #define        MACH_TITAN_YOSEMITE     1       /* PMC-Sierra Yosemite */
515 Index: linux-2.4.35.4/include/asm-mips/cpu.h
516 ===================================================================
517 --- linux-2.4.35.4.orig/include/asm-mips/cpu.h  2007-12-15 05:19:36.442497779 +0100
518 +++ linux-2.4.35.4/include/asm-mips/cpu.h       2007-12-15 05:20:13.956635587 +0100
519 @@ -22,6 +22,11 @@
520     spec.
521  */
522  
523 +#define PRID_COPT_MASK         0xff000000
524 +#define PRID_COMP_MASK         0x00ff0000
525 +#define PRID_IMP_MASK          0x0000ff00
526 +#define PRID_REV_MASK          0x000000ff
527 +
528  #define PRID_COMP_LEGACY       0x000000
529  #define PRID_COMP_MIPS         0x010000
530  #define PRID_COMP_BROADCOM     0x020000
531 @@ -58,6 +63,7 @@
532  #define PRID_IMP_RM7000                0x2700
533  #define PRID_IMP_NEVADA                0x2800          /* RM5260 ??? */
534  #define PRID_IMP_RM9000                0x3400
535 +#define PRID_IMP_BCM4710       0x4000
536  #define PRID_IMP_R5432         0x5400
537  #define PRID_IMP_R5500         0x5500
538  #define PRID_IMP_4KC           0x8000
539 @@ -66,10 +72,16 @@
540  #define PRID_IMP_4KEC          0x8400
541  #define PRID_IMP_4KSC          0x8600
542  #define PRID_IMP_25KF          0x8800
543 +#define PRID_IMP_BCM3302       0x9000
544 +#define PRID_IMP_BCM3303       0x9100
545  #define PRID_IMP_24K           0x9300
546  
547  #define PRID_IMP_UNKNOWN       0xff00
548  
549 +#define       BCM330X(id) \
550 +       (((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) \
551 +       || ((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3303)))
552 +
553  /*
554   * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
555   */
556 @@ -174,7 +186,9 @@
557  #define CPU_AU1550             57
558  #define CPU_24K                        58
559  #define CPU_AU1200             59
560 -#define CPU_LAST               59
561 +#define CPU_BCM4710            60
562 +#define CPU_BCM3302            61
563 +#define CPU_LAST               61
564  
565  /*
566   * ISA Level encodings
567 Index: linux-2.4.35.4/include/asm-mips/r4kcache.h
568 ===================================================================
569 --- linux-2.4.35.4.orig/include/asm-mips/r4kcache.h     2007-12-15 05:19:36.450498234 +0100
570 +++ linux-2.4.35.4/include/asm-mips/r4kcache.h  2007-12-15 05:20:13.960635812 +0100
571 @@ -567,4 +567,17 @@
572                         cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
573  }
574  
575 +extern inline void fill_icache_line(unsigned long addr)
576 +{       
577 +       __asm__ __volatile__(
578 +               ".set noreorder\n\t"
579 +               ".set mips3\n\t"
580 +               "cache %1, (%0)\n\t"
581 +               ".set mips0\n\t"
582 +               ".set reorder"
583 +               :
584 +               : "r" (addr),
585 +               "i" (Fill));
586 +}      
587 +
588  #endif /* __ASM_R4KCACHE_H */
589 Index: linux-2.4.35.4/include/asm-mips/serial.h
590 ===================================================================
591 --- linux-2.4.35.4.orig/include/asm-mips/serial.h       2007-12-15 05:19:36.458498689 +0100
592 +++ linux-2.4.35.4/include/asm-mips/serial.h    2007-12-15 05:20:13.960635812 +0100
593 @@ -223,6 +223,13 @@
594  #define TXX927_SERIAL_PORT_DEFNS
595  #endif
596  
597 +#ifdef CONFIG_BCM947XX
598 +/* reserve 4 ports to be configured at runtime */
599 +#define BCM947XX_SERIAL_PORT_DEFNS { 0, }, { 0, }, { 0, }, { 0, },
600 +#else
601 +#define BCM947XX_SERIAL_PORT_DEFNS
602 +#endif
603 +
604  #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
605  #define STD_SERIAL_PORT_DEFNS                  \
606         /* UART CLK   PORT IRQ     FLAGS        */                      \
607 @@ -470,6 +477,7 @@
608  #define SERIAL_PORT_DFNS                       \
609         ATLAS_SERIAL_PORT_DEFNS                 \
610         AU1000_SERIAL_PORT_DEFNS                \
611 +       BCM947XX_SERIAL_PORT_DEFNS              \
612         COBALT_SERIAL_PORT_DEFNS                \
613         DDB5477_SERIAL_PORT_DEFNS               \
614         EV96100_SERIAL_PORT_DEFNS               \
615 Index: linux-2.4.35.4/init/do_mounts.c
616 ===================================================================
617 --- linux-2.4.35.4.orig/init/do_mounts.c        2007-12-15 05:19:48.667194423 +0100
618 +++ linux-2.4.35.4/init/do_mounts.c     2007-12-15 05:20:13.960635812 +0100
619 @@ -254,7 +254,13 @@
620         { "ftlb", 0x2c08 },
621         { "ftlc", 0x2c10 },
622         { "ftld", 0x2c18 },
623 +#if defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO)
624         { "mtdblock", 0x1f00 },
625 +       { "mtdblock0",0x1f00 },
626 +       { "mtdblock1",0x1f01 },
627 +       { "mtdblock2",0x1f02 },
628 +       { "mtdblock3",0x1f03 },
629 +#endif
630         { "nb", 0x2b00 },
631         { NULL, 0 }
632  };