f85ceb9c8db54bee3d8728c26f806a51bb788f6c
[openwrt/openwrt.git] / target / linux / brcm63xx / patches / 001-bcm963xx.patch
1 diff -urN linux-2.6.19/arch/mips/Kconfig linux-2.6.19.new/arch/mips/Kconfig
2 --- linux-2.6.19/arch/mips/Kconfig 2006-11-29 22:57:37.000000000 +0100
3 +++ linux-2.6.19.new/arch/mips/Kconfig 2006-12-16 18:46:31.000000000 +0100
4 @@ -4,6 +4,10 @@
5 # Horrible source of confusion. Die, die, die ...
6 select EMBEDDED
7
8 +config CFE
9 + bool
10 + # Common Firmware Environment
11 +
12 mainmenu "Linux/MIPS Kernel Configuration"
13
14 menu "Machine selection"
15 @@ -15,6 +15,18 @@
16 prompt "System type"
17 default SGI_IP22
18
19 +config BCM963XX
20 + bool "Support for Broadcom BCM963xx SoC"
21 + select SYS_SUPPORTS_32BIT_KERNEL
22 + select SYS_SUPPORTS_BIG_ENDIAN
23 + select SYS_HAS_CPU_MIPS32_R1
24 + select HW_HAS_PCI
25 + select DMA_NONCOHERENT
26 + select IRQ_CPU
27 + select CFE
28 + help
29 + This is a fmaily of boards based on the Broadcom MIPS32
30 +
31 config MACH_ALCHEMY
32 bool "Alchemy processor based machines"
33
34 diff -urN linux-2.6.19/arch/mips/Makefile linux-2.6.19.new/arch/mips/Makefile
35 --- linux-2.6.19/arch/mips/Makefile 2006-12-16 17:36:29.000000000 +0100
36 +++ linux-2.6.19.new/arch/mips/Makefile 2006-12-16 18:46:31.000000000 +0100
37 @@ -158,6 +158,19 @@
38 #
39
40 #
41 +# Broadcom BCM963xx SoC
42 +#
43 +core-$(CONFIG_BCM963XX) += arch/mips/bcm963xx/
44 +cflags-$(CONFIG_BCM963XX) += -Iinclude/asm-mips/mach-bcm963xx
45 +load-$(CONFIG_BCM963XX) += 0xffffffff80010000
46 +
47 +
48 +#
49 +# Common Firmware Environment
50 +#
51 +core-$(CONFIG_CFE) += arch/mips/cfe/
52 +
53 +#
54 # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
55 #
56 core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
57 diff -urN linux-2.6.19/arch/mips/kernel/cpu-probe.c linux-2.6.19.new/arch/mips/kernel/cpu-probe.c
58 --- linux-2.6.19/arch/mips/kernel/cpu-probe.c 2006-11-29 22:57:37.000000000 +0100
59 +++ linux-2.6.19.new/arch/mips/kernel/cpu-probe.c 2006-12-16 18:46:31.000000000 +0100
60 @@ -590,6 +590,28 @@
61 return;
62 }
63
64 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
65 +{
66 + decode_configs(c);
67 + switch (c->processor_id & 0xff00) {
68 + case PRID_IMP_BCM6338:
69 + c->cputype = CPU_BCM6338;
70 + break;
71 + case PRID_IMP_BCM6345:
72 + c->cputype = CPU_BCM6345;
73 + break;
74 + case PRID_IMP_BCM6348:
75 + c->cputype = CPU_BCM6348;
76 + break;
77 + case PRID_IMP_BCM6358:
78 + c->cputype = CPU_BCM6358;
79 + break;
80 + default:
81 + c->cputype = CPU_UNKNOWN;
82 + break;
83 + }
84 +}
85 +
86 static inline void cpu_probe_mips(struct cpuinfo_mips *c)
87 {
88 decode_configs(c);
89 @@ -724,6 +743,9 @@
90 case PRID_COMP_LEGACY:
91 cpu_probe_legacy(c);
92 break;
93 + case PRID_COMP_BROADCOM:
94 + cpu_probe_broadcom(c);
95 + break;
96 case PRID_COMP_MIPS:
97 cpu_probe_mips(c);
98 break;
99 diff -urN linux-2.6.19/arch/mips/kernel/proc.c linux-2.6.19.new/arch/mips/kernel/proc.c
100 --- linux-2.6.19/arch/mips/kernel/proc.c 2006-11-29 22:57:37.000000000 +0100
101 +++ linux-2.6.19.new/arch/mips/kernel/proc.c 2006-12-16 18:46:31.000000000 +0100
102 @@ -84,6 +84,10 @@
103 [CPU_VR4181A] = "NEC VR4181A",
104 [CPU_SR71000] = "Sandcraft SR71000",
105 [CPU_PR4450] = "Philips PR4450",
106 + [CPU_BCM6338] = "BCM6338",
107 + [CPU_BCM6345] = "BCM6345",
108 + [CPU_BCM6348] = "BCM6348",
109 + [CPU_BCM6358] = "BCM6358",
110 };
111
112
113 diff -urN linux-2.6.19/arch/mips/mm/c-r4k.c linux-2.6.19.new/arch/mips/mm/c-r4k.c
114 --- linux-2.6.19/arch/mips/mm/c-r4k.c 2006-11-29 22:57:37.000000000 +0100
115 +++ linux-2.6.19.new/arch/mips/mm/c-r4k.c 2006-12-16 18:46:31.000000000 +0100
116 @@ -852,6 +852,13 @@
117 if (!(config & MIPS_CONF_M))
118 panic("Don't know how to probe P-caches on this cpu.");
119
120 + if (c->cputype == CPU_BCM6338 || c->cputype == CPU_BCM6345 || c->cputype == CPU_BCM6348 || c->cputype == CPU_BCM6358)
121 + {
122 + printk("bcm963xx: enabling icache and dcache...\n");
123 + /* Enable caches */
124 + write_c0_diag(read_c0_diag() | 0xC0000000);
125 + }
126 +
127 /*
128 * So we seem to be a MIPS32 or MIPS64 CPU
129 * So let's probe the I-cache ...
130 diff -urN linux-2.6.19/arch/mips/mm/tlbex.c linux-2.6.19.new/arch/mips/mm/tlbex.c
131 --- linux-2.6.19/arch/mips/mm/tlbex.c 2006-11-29 22:57:37.000000000 +0100
132 +++ linux-2.6.19.new/arch/mips/mm/tlbex.c 2006-12-16 18:46:31.000000000 +0100
133 @@ -892,6 +892,10 @@
134 case CPU_4KSC:
135 case CPU_20KC:
136 case CPU_25KF:
137 + case CPU_BCM6338:
138 + case CPU_BCM6345:
139 + case CPU_BCM6348:
140 + case CPU_BCM6358:
141 tlbw(p);
142 break;
143
144 diff -urN linux-2.6.19/arch/mips/pci/Makefile linux-2.6.19.new/arch/mips/pci/Makefile
145 --- linux-2.6.19/arch/mips/pci/Makefile 2006-11-29 22:57:37.000000000 +0100
146 +++ linux-2.6.19.new/arch/mips/pci/Makefile 2006-12-16 18:48:18.000000000 +0100
147 @@ -16,6 +16,7 @@
148 obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
149 obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
150 obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
151 +obj-$(CONFIG_BCM963XX) += fixup-bcm96348.o pci-bcm96348.o ops-bcm96348.o
152
153 #
154 # These are still pretty much in the old state, watch, go blind.
155 diff -urN linux-2.6.19/include/asm-mips/bootinfo.h linux-2.6.19.new/include/asm-mips/bootinfo.h
156 --- linux-2.6.19/include/asm-mips/bootinfo.h 2006-11-29 22:57:37.000000000 +0100
157 +++ linux-2.6.19.new/include/asm-mips/bootinfo.h 2006-12-16 18:46:31.000000000 +0100
158 @@ -213,6 +213,15 @@
159 #define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
160 #define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
161
162 +/*
163 + * Valid machtype for group BRCM
164 + */
165 +#define MACH_GROUP_BRCM 23 /* Broadcom boards */
166 +#define MACH_BCM96338 0
167 +#define MACH_BCM96345 1
168 +#define MACH_BCM96348 2
169 +#define MACH_BCM96358 3
170 +
171 #define CL_SIZE COMMAND_LINE_SIZE
172
173 const char *get_system_type(void);
174 diff -urN linux-2.6.19/include/asm-mips/cpu.h linux-2.6.19.new/include/asm-mips/cpu.h
175 --- linux-2.6.19/include/asm-mips/cpu.h 2006-11-29 22:57:37.000000000 +0100
176 +++ linux-2.6.19.new/include/asm-mips/cpu.h 2006-12-16 18:46:31.000000000 +0100
177 @@ -103,6 +103,14 @@
178
179 #define PRID_IMP_SR71000 0x0400
180
181 +/* These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
182 + */
183 +
184 +#define PRID_IMP_BCM6338 0x9000
185 +#define PRID_IMP_BCM6345 0x8000
186 +#define PRID_IMP_BCM6348 0x9100
187 +#define PRID_IMP_BCM6358 0xA000
188 +
189 /*
190 * Definitions for 7:0 on legacy processors
191 */
192 @@ -200,7 +207,11 @@
193 #define CPU_SB1A 62
194 #define CPU_74K 63
195 #define CPU_R14000 64
196 -#define CPU_LAST 64
197 +#define CPU_BCM6338 65
198 +#define CPU_BCM6345 66
199 +#define CPU_BCM6348 67
200 +#define CPU_BCM6358 68
201 +#define CPU_LAST 68
202
203 /*
204 * ISA Level encodings
205 diff -urN linux-2.6.19/include/asm-mips/module.h linux-2.6.19.new/include/asm-mips/module.h
206 --- linux-2.6.19/include/asm-mips/module.h 2006-11-29 22:57:37.000000000 +0100
207 +++ linux-2.6.19.new/include/asm-mips/module.h 2006-12-16 19:03:22.000000000 +0100
208 @@ -112,6 +112,14 @@
209 #define MODULE_PROC_FAMILY "RM9000 "
210 #elif defined CONFIG_CPU_SB1
211 #define MODULE_PROC_FAMILY "SB1 "
212 +#elif defined CONFIG_CPU_BCM6338
213 +#define MODULE_PROC_FAMILY "BCM6338 "
214 +#elif defined CONFIG_CPU_BCM6345
215 +#define MODULE_PROC_FAMILY "BCM6345 "
216 +#elif defined CONFIG_CPU_BCM6348
217 +#define MODULE_PROC_FAMILY "BCM6348 "
218 +#elif defined CONFIG_CPU_BCM6358
219 +#define MODULE_PROC_FAMILY "BCM6358 "
220 #else
221 #error MODULE_PROC_FAMILY undefined for your processor configuration
222 #endif