Fix brcm63xx support. Now a kernel is booting, detecting the flash, and can probably...
[openwrt.git] / target / linux / brcm63xx-2.6 / patches / 000-arch_mips.patch
1 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/Kconfig linux-2.6.16.7-patched/arch/mips/Kconfig
2 --- linux-2.6.16.7-generic-patched/arch/mips/Kconfig    2006-04-17 23:53:25.000000000 +0200
3 +++ linux-2.6.16.7-patched/arch/mips/Kconfig    2006-07-05 15:21:58.000000000 +0200
4 @@ -10,7 +10,16 @@ menu "Machine selection"
5  
6  choice
7         prompt "System type"
8 -       default SGI_IP22
9 +       default MIPS_BRCM
10 +
11 +config MIPS_BRCM
12 +       bool "Support for the Broadcom boards"
13 +       select SYS_SUPPORTS_32BIT_KERNEL
14 +       select SYS_SUPPORTS_BIG_ENDIAN
15 +       select SYS_HAS_CPU_MIPS32_R1
16 +       select IRQ_CPU
17 +       help
18 +        This is a fmaily of boards based on the Broadcom MIPS32
19  
20  config MIPS_MTX1
21         bool "Support for 4G Systems MTX-1 board"
22 @@ -777,6 +786,7 @@ config TOSHIBA_RBTX4938
23  
24  endchoice
25  
26 +source "arch/mips/brcm-boards/bcm963xx/Kconfig"
27  source "arch/mips/ddb5xxx/Kconfig"
28  source "arch/mips/gt64120/ev64120/Kconfig"
29  source "arch/mips/jazz/Kconfig"
30 @@ -1046,7 +1056,7 @@ menu "CPU selection"
31  
32  choice
33         prompt "CPU type"
34 -       default CPU_R4X00
35 +       default CPU_MIPS32_R1
36  
37  config CPU_MIPS32_R1
38         bool "MIPS32 Release 1"
39 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/Makefile linux-2.6.16.7-patched/arch/mips/Makefile
40 --- linux-2.6.16.7-generic-patched/arch/mips/Makefile   2006-04-17 23:53:25.000000000 +0200
41 +++ linux-2.6.16.7-patched/arch/mips/Makefile   2006-07-05 15:21:58.000000000 +0200
42 @@ -279,6 +279,20 @@ libs-$(CONFIG_SIBYTE_CFE)  += arch/mips/s
43  #
44  
45  #
46 +# Broadcom board
47 +#
48 +core-$(CONFIG_MIPS_BRCM)       += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm963xx/
49 +core-$(CONFIG_MIPS_BRCM)       += bcmdrivers/opensource/char/serial/impl1/
50 +#core-$(CONFIG_MIPS_BRCM)      += bcmdrivers/opensource/char/board/bcm963xx/impl1/
51 +#core-$(CONFIG_MIPS_BRCM)      += boardparms/bcm963xx/
52 +cflags-$(CONFIG_MIPS_BRCM)             += -Iinclude/asm-mips/mach-bcm963xx
53 +cflags-$(CONFIG_MIPS_BRCM)             += -Iarch/mips/brcm-boards/generic/include
54 +cflags-$(CONFIG_MIPS_BRCM)             += -Ibcmdrivers/opensource/include/bcm963xx
55 +cflags-$(CONFIG_MIPS_BRCM)             += -Iboardparms/bcm963xx
56 +load-$(CONFIG_MIPS_BRCM)       += 0xffffffff80010000
57 +
58 +
59 +#
60  # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
61  #
62  core-$(CONFIG_MACH_JAZZ)       += arch/mips/jazz/
63 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/kernel/cpu-probe.c linux-2.6.16.7-patched/arch/mips/kernel/cpu-probe.c
64 --- linux-2.6.16.7-generic-patched/arch/mips/kernel/cpu-probe.c 2006-04-17 23:53:25.000000000 +0200
65 +++ linux-2.6.16.7-patched/arch/mips/kernel/cpu-probe.c 2006-07-05 15:21:58.000000000 +0200
66 @@ -558,6 +558,25 @@ static inline void decode_configs(struct
67                 return;
68  }
69  
70 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
71 +{
72 +       decode_configs(c);
73 +       switch (c->processor_id & 0xff00) {
74 +       case PRID_IMP_BCM6338:          
75 +               c->cputype = CPU_BCM6338;
76 +               break;
77 +       case PRID_IMP_BCM6345:
78 +               c->cputype = CPU_BCM6345;
79 +               break;
80 +       case PRID_IMP_BCM6348:
81 +               c->cputype = CPU_BCM6348;
82 +               break;
83 +       default:
84 +               c->cputype = CPU_UNKNOWN;
85 +               break;
86 +       }
87 +}
88 +
89  static inline void cpu_probe_mips(struct cpuinfo_mips *c)
90  {
91         decode_configs(c);
92 @@ -691,6 +710,9 @@ __init void cpu_probe(void)
93         case PRID_COMP_LEGACY:
94                 cpu_probe_legacy(c);
95                 break;
96 +       case PRID_COMP_BROADCOM:
97 +               cpu_probe_broadcom(c);
98 +               break;
99         case PRID_COMP_MIPS:
100                 cpu_probe_mips(c);
101                 break;
102 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/kernel/proc.c linux-2.6.16.7-patched/arch/mips/kernel/proc.c
103 --- linux-2.6.16.7-generic-patched/arch/mips/kernel/proc.c      2006-04-17 23:53:25.000000000 +0200
104 +++ linux-2.6.16.7-patched/arch/mips/kernel/proc.c      2006-07-05 15:21:58.000000000 +0200
105 @@ -81,6 +81,9 @@ static const char *cpu_name[] = {
106         [CPU_VR4133]    = "NEC VR4133",
107         [CPU_VR4181]    = "NEC VR4181",
108         [CPU_VR4181A]   = "NEC VR4181A",
109 +       [CPU_BCM6338]   = "BCM6338",
110 +       [CPU_BCM6345]   = "BCM6345",
111 +       [CPU_BCM6348]   = "BCM6348",
112         [CPU_SR71000]   = "Sandcraft SR71000",
113         [CPU_PR4450]    = "Philips PR4450",
114  };
115 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/mm/c-r4k.c linux-2.6.16.7-patched/arch/mips/mm/c-r4k.c
116 --- linux-2.6.16.7-generic-patched/arch/mips/mm/c-r4k.c 2006-04-17 23:53:25.000000000 +0200
117 +++ linux-2.6.16.7-patched/arch/mips/mm/c-r4k.c 2006-07-05 15:21:58.000000000 +0200
118 @@ -889,6 +889,12 @@ static void __init probe_pcache(void)
119                 if (!(config & MIPS_CONF_M))
120                         panic("Don't know how to probe P-caches on this cpu.");
121  
122 +               if (c->cputype == CPU_BCM6338 || c->cputype == CPU_BCM6345 || c->cputype == CPU_BCM6348){
123 +                       printk("brcm mips: enabling icache and dcache...\n");
124 +                       /* Enable caches */
125 +                       write_c0_diag(read_c0_diag() | 0xC0000000);
126 +               }
127 +
128                 /*
129                  * So we seem to be a MIPS32 or MIPS64 CPU
130                  * So let's probe the I-cache ...
131 diff -Naurp -x brcm-boards -x pci linux-2.6.16.7-generic-patched/arch/mips/mm/tlbex.c linux-2.6.16.7-patched/arch/mips/mm/tlbex.c
132 --- linux-2.6.16.7-generic-patched/arch/mips/mm/tlbex.c 2006-04-17 23:53:25.000000000 +0200
133 +++ linux-2.6.16.7-patched/arch/mips/mm/tlbex.c 2006-07-05 15:21:58.000000000 +0200
134 @@ -858,6 +858,9 @@ static __init void build_tlb_write_entry
135         case CPU_4KSC:
136         case CPU_20KC:
137         case CPU_25KF:
138 +       case CPU_BCM6338:
139 +       case CPU_BCM6345:
140 +       case CPU_BCM6348:
141                 tlbw(p);
142                 break;
143