2867bc4c3a6e41cacb3491f920f7a4d6be334066
[openwrt/openwrt.git] / target / linux / aruba-2.6 / patches / 000-aruba.patch
1 diff -Nur linux-2.6.21.1/arch/mips/Kconfig linux-2.6.21.1-owrt/arch/mips/Kconfig
2 --- linux-2.6.21.1/arch/mips/Kconfig 2007-04-27 23:49:26.000000000 +0200
3 +++ linux-2.6.21.1-owrt/arch/mips/Kconfig 2007-05-23 23:34:01.000000000 +0200
4 @@ -220,6 +220,17 @@
5 <http://www.marvell.com/>. Say Y here if you wish to build a
6 kernel for this platform.
7
8 +config MACH_ARUBA
9 + bool "Support for the ARUBA product line"
10 + select DMA_NONCOHERENT
11 + select CPU_HAS_PREFETCH
12 + select HW_HAS_PCI
13 + select SWAP_IO_SPACE
14 + select SYS_SUPPORTS_32BIT_KERNEL
15 + select SYS_HAS_CPU_MIPS32_R1
16 + select SYS_SUPPORTS_BIG_ENDIAN
17 +
18 +
19 config MACH_JAZZ
20 bool "Jazz family of machines"
21 select ARC
22 diff -Nur linux-2.6.21.1/arch/mips/Makefile linux-2.6.21.1-owrt/arch/mips/Makefile
23 --- linux-2.6.21.1/arch/mips/Makefile 2007-04-27 23:49:26.000000000 +0200
24 +++ linux-2.6.21.1-owrt/arch/mips/Makefile 2007-05-23 23:34:01.000000000 +0200
25 @@ -158,6 +158,14 @@
26 #
27
28 #
29 +# Aruba
30 +#
31 +
32 +core-$(CONFIG_MACH_ARUBA) += arch/mips/aruba/
33 +cflags-$(CONFIG_MACH_ARUBA) += -Iinclude/asm-mips/aruba
34 +load-$(CONFIG_MACH_ARUBA) += 0x80100000
35 +
36 +#
37 # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
38 #
39 core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
40 diff -Nur linux-2.6.21.1/drivers/net/Kconfig linux-2.6.21.1-owrt/drivers/net/Kconfig
41 --- linux-2.6.21.1/drivers/net/Kconfig 2007-04-27 23:49:26.000000000 +0200
42 +++ linux-2.6.21.1-owrt/drivers/net/Kconfig 2007-05-24 10:45:57.000000000 +0200
43 @@ -201,6 +201,13 @@
44
45 source "drivers/net/arm/Kconfig"
46
47 +config IDT_RC32434_ETH
48 + tristate "IDT RC32434 Local Ethernet support"
49 + depends on NET_ETHERNET
50 + help
51 + IDT RC32434 has one local ethernet port. Say Y here to enable it.
52 + To compile this driver as a module, choose M here.
53 +
54 config MACE
55 tristate "MACE (Power Mac ethernet) support"
56 depends on NET_ETHERNET && PPC_PMAC && PPC32
57 diff -Nur linux-2.6.21.1/drivers/net/Makefile linux-2.6.21.1-owrt/drivers/net/Makefile
58 --- linux-2.6.21.1/drivers/net/Makefile 2007-04-27 23:49:26.000000000 +0200
59 +++ linux-2.6.21.1-owrt/drivers/net/Makefile 2007-05-24 10:45:57.000000000 +0200
60 @@ -38,6 +38,7 @@
61 obj-$(CONFIG_MACE) += mace.o
62 obj-$(CONFIG_BMAC) += bmac.o
63
64 +obj-$(CONFIG_IDT_RC32434_ETH) += rc32434_eth.o
65 obj-$(CONFIG_DGRS) += dgrs.o
66 obj-$(CONFIG_VORTEX) += 3c59x.o
67 obj-$(CONFIG_TYPHOON) += typhoon.o
68 diff -Nur linux-2.6.21.1/drivers/net/natsemi.c linux-2.6.21.1-owrt/drivers/net/natsemi.c
69 --- linux-2.6.21.1/drivers/net/natsemi.c 2007-04-27 23:49:26.000000000 +0200
70 +++ linux-2.6.21.1-owrt/drivers/net/natsemi.c 2007-05-23 23:34:01.000000000 +0200
71 @@ -656,6 +656,49 @@
72 static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
73 static const struct ethtool_ops ethtool_ops;
74
75 +#ifdef CONFIG_MACH_ARUBA
76 +
77 +#include <linux/ctype.h>
78 +
79 +#ifndef ERR
80 +#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
81 +#endif
82 +
83 +static int parse_mac_addr(struct net_device *dev, char* macstr)
84 +{
85 + int i, j;
86 + unsigned char result, value;
87 +
88 + for (i=0; i<6; i++) {
89 + result = 0;
90 + if (i != 5 && *(macstr+2) != ':') {
91 + ERR("invalid mac address format: %d %c\n",
92 + i, *(macstr+2));
93 + return -EINVAL;
94 + }
95 + for (j=0; j<2; j++) {
96 + if (isxdigit(*macstr) && (value = isdigit(*macstr) ? *macstr-'0' :
97 + toupper(*macstr)-'A'+10) < 16) {
98 + result = result*16 + value;
99 + macstr++;
100 + }
101 + else {
102 + ERR("invalid mac address "
103 + "character: %c\n", *macstr);
104 + return -EINVAL;
105 + }
106 + }
107 +
108 + macstr++;
109 + dev->dev_addr[i] = result;
110 + }
111 +
112 + dev->dev_addr[5]++;
113 + return 0;
114 +}
115 +
116 +#endif
117 +
118 static inline void __iomem *ns_ioaddr(struct net_device *dev)
119 {
120 return (void __iomem *) dev->base_addr;
121 @@ -794,6 +837,7 @@
122 goto err_ioremap;
123 }
124
125 +#ifndef CONFIG_MACH_ARUBA
126 /* Work around the dropped serial bit. */
127 prev_eedata = eeprom_read(ioaddr, 6);
128 for (i = 0; i < 3; i++) {
129 @@ -802,6 +846,19 @@
130 dev->dev_addr[i*2+1] = eedata >> 7;
131 prev_eedata = eedata;
132 }
133 +#else
134 + {
135 + char mac[32];
136 + unsigned char def_mac[6] = {00, 0x0b, 0x86, 0xba, 0xdb, 0xad};
137 + extern char *getenv(char *e);
138 + memset(mac, 0, 32);
139 + memcpy(mac, getenv("ethaddr"), 17);
140 + if (parse_mac_addr(dev, mac)){
141 + printk("%s: MAC address not found\n", __func__);
142 + memcpy(dev->dev_addr, def_mac, 6);
143 + }
144 + }
145 +#endif
146
147 dev->base_addr = (unsigned long __force) ioaddr;
148 dev->irq = irq;
149 diff -Nur linux-2.6.21.1/include/asm-mips/bootinfo.h linux-2.6.21.1-owrt/include/asm-mips/bootinfo.h
150 --- linux-2.6.21.1/include/asm-mips/bootinfo.h 2007-04-27 23:49:26.000000000 +0200
151 +++ linux-2.6.21.1-owrt/include/asm-mips/bootinfo.h 2007-05-23 23:34:01.000000000 +0200
152 @@ -213,6 +213,17 @@
153 #define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
154 #define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
155
156 +
157 +/*
158 + * Valid machtype for group ARUBA
159 + */
160 +#define MACH_GROUP_ARUBA 23
161 +#define MACH_ARUBA_UNKNOWN 0
162 +#define MACH_ARUBA_AP60 1
163 +#define MACH_ARUBA_AP65 2
164 +#define MACH_ARUBA_AP70 3
165 +#define MACH_ARUBA_AP40 4
166 +
167 #define CL_SIZE COMMAND_LINE_SIZE
168
169 const char *get_system_type(void);
170 diff -Nur linux-2.6.21.1/include/asm-mips/cpu.h linux-2.6.21.1-owrt/include/asm-mips/cpu.h
171 --- linux-2.6.21.1/include/asm-mips/cpu.h 2007-04-27 23:49:26.000000000 +0200
172 +++ linux-2.6.21.1-owrt/include/asm-mips/cpu.h 2007-05-23 23:34:01.000000000 +0200
173 @@ -54,6 +54,9 @@
174 #define PRID_IMP_R14000 0x0f00
175 #define PRID_IMP_R8000 0x1000
176 #define PRID_IMP_PR4450 0x1200
177 +#define PRID_IMP_RC32334 0x1800
178 +#define PRID_IMP_RC32355 0x1900
179 +#define PRID_IMP_RC32365 0x1900
180 #define PRID_IMP_R4600 0x2000
181 #define PRID_IMP_R4700 0x2100
182 #define PRID_IMP_TX39 0x2200
183 @@ -200,7 +203,8 @@
184 #define CPU_SB1A 62
185 #define CPU_74K 63
186 #define CPU_R14000 64
187 -#define CPU_LAST 64
188 +#define CPU_RC32300 65
189 +#define CPU_LAST 65
190
191 /*
192 * ISA Level encodings
193 diff -Nur linux-2.6.21.1/include/asm-mips/mach-generic/irq.h linux-2.6.21.1-owrt/include/asm-mips/mach-generic/irq.h
194 --- linux-2.6.21.1/include/asm-mips/mach-generic/irq.h 2007-04-27 23:49:26.000000000 +0200
195 +++ linux-2.6.21.1-owrt/include/asm-mips/mach-generic/irq.h 2007-05-23 23:35:55.000000000 +0200
196 @@ -9,7 +9,7 @@
197 #define __ASM_MACH_GENERIC_IRQ_H
198
199 #ifndef NR_IRQS
200 -#define NR_IRQS 128
201 +#define NR_IRQS 256
202 #endif
203
204 #ifdef CONFIG_I8259
205 diff -Nur linux-2.6.21.1/include/linux/kernel.h linux-2.6.21.1-owrt/include/linux/kernel.h
206 --- linux-2.6.21.1/include/linux/kernel.h 2007-04-27 23:49:26.000000000 +0200
207 +++ linux-2.6.21.1-owrt/include/linux/kernel.h 2007-05-23 23:34:01.000000000 +0200
208 @@ -334,6 +334,7 @@
209 };
210
211 /* Force a compilation error if condition is true */
212 +extern void BUILD_BUG(void);
213 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
214
215 /* Force a compilation error if condition is true, but also produce a