f4e86b921175a4978afecea0c824b446f9cda7a2
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches / 210-machtypes.patch
1 Index: linux-3.1/arch/mips/lantiq/machtypes.h
2 ===================================================================
3 --- linux-3.1.orig/arch/mips/lantiq/machtypes.h 2011-11-03 10:32:53.117317313 +0100
4 +++ linux-3.1/arch/mips/lantiq/machtypes.h 2011-11-03 15:57:57.106151011 +0100
5 @@ -20,9 +20,34 @@
6 LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
7 LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
8 LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
9 + LANTIQ_MACH_EASY98020, /* EASY98020 Eval Board */
10 + LANTIQ_MACH_EASY98020_1LAN, /* EASY98020 Eval Board (1 LAN port) */
11 + LANTIQ_MACH_EASY98020_2LAN, /* EASY98020 Eval Board (2 LAN port) */
12 + LANTIQ_MACH_95C3AM1, /* 95C3AM1 Eval Board */
13
14 /* FRITZ!BOX */
15 LANTIQ_MACH_FRITZ3370, /* FRITZ!BOX 3370 vdsl cpe */
16 +
17 + /* Arcadyan */
18 + LANTIQ_MACH_ARV3527P, /* Arcor easybox a401 */
19 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
20 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
21 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
22 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
23 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
24 + LANTIQ_MACH_ARV7525PW, /* Speedport W303V */
25 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */
26 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
27 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
28 +
29 + /* Netgear */
30 + LANTIQ_MACH_DGN3500B, /* Netgear DGN3500 */
31 +
32 + /* Gigaset */
33 + LANTIQ_MACH_GIGASX76X, /* Gigaset SX76x */
34 +
35 + /* Buffalo */
36 + LANTIQ_MACH_WBMR, /* WBMR-HP-G300H */
37 };
38
39 #endif
40 Index: linux-3.1/arch/mips/lantiq/xway/Kconfig
41 ===================================================================
42 --- linux-3.1.orig/arch/mips/lantiq/xway/Kconfig 2011-11-03 10:32:53.117317313 +0100
43 +++ linux-3.1/arch/mips/lantiq/xway/Kconfig 2011-11-03 10:32:53.409317325 +0100
44 @@ -6,6 +6,22 @@
45 bool "Easy50712 - Danube"
46 default y
47
48 +config LANTIQ_MACH_ARV45XX
49 + bool "ARV45XX"
50 + default y
51 +
52 +config LANTIQ_MACH_NETGEAR
53 + bool "Netgear"
54 + default y
55 +
56 +config LANTIQ_MACH_GIGASX76X
57 + bool "GIGASX76X"
58 + default y
59 +
60 +config LANTIQ_MACH_WBMR
61 + bool "WBMR-HP-G300H"
62 + default y
63 +
64 endmenu
65
66 endif
67 Index: linux-3.1/arch/mips/lantiq/xway/Makefile
68 ===================================================================
69 --- linux-3.1.orig/arch/mips/lantiq/xway/Makefile 2011-11-03 10:32:53.117317313 +0100
70 +++ linux-3.1/arch/mips/lantiq/xway/Makefile 2011-11-03 15:57:59.222151170 +0100
71 @@ -7,3 +7,7 @@
72 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
73 obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
74 obj-$(CONFIG_LANTIQ_MACH_FRITZ3370) += mach-fritz.o
75 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
76 +obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o
77 +obj-$(CONFIG_LANTIQ_MACH_GIGASX76X) += mach-gigasx76x.o
78 +obj-$(CONFIG_LANTIQ_MACH_WBMR) += mach-wbmr.o
79 Index: linux-3.1/arch/mips/lantiq/falcon/Kconfig
80 ===================================================================
81 --- linux-3.1.orig/arch/mips/lantiq/falcon/Kconfig 2011-11-03 10:32:52.697317294 +0100
82 +++ linux-3.1/arch/mips/lantiq/falcon/Kconfig 2011-11-03 10:32:53.409317325 +0100
83 @@ -6,6 +6,14 @@
84 bool "Easy98000"
85 default y
86
87 +config LANTIQ_MACH_EASY98020
88 + bool "Easy98020"
89 + default y
90 +
91 +config LANTIQ_MACH_95C3AM1
92 + bool "95C3AM1"
93 + default y
94 +
95 endmenu
96
97 endif
98 Index: linux-3.1/arch/mips/lantiq/falcon/Makefile
99 ===================================================================
100 --- linux-3.1.orig/arch/mips/lantiq/falcon/Makefile 2011-11-03 10:32:53.033317309 +0100
101 +++ linux-3.1/arch/mips/lantiq/falcon/Makefile 2011-11-03 10:32:53.409317325 +0100
102 @@ -1,2 +1,6 @@
103 obj-y := clk.o prom.o reset.o sysctrl.o devices.o gpio.o softdog_vpe.o
104 +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
105 +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
106 obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
107 +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
108 +obj-$(CONFIG_LANTIQ_MACH_95C3AM1) += mach-95C3AM1.o
109 Index: linux-3.1/arch/mips/lantiq/falcon/mach-easy98000.c
110 ===================================================================
111 --- linux-3.1.orig/arch/mips/lantiq/falcon/mach-easy98000.c 2011-11-03 10:32:52.805317298 +0100
112 +++ linux-3.1/arch/mips/lantiq/falcon/mach-easy98000.c 2011-11-03 10:32:53.413317324 +0100
113 @@ -1,23 +1,38 @@
114 -/*
115 - * This program is free software; you can redistribute it and/or modify it
116 - * under the terms of the GNU General Public License version 2 as published
117 - * by the Free Software Foundation.
118 - *
119 - * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
120 - * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
121 - */
122 -
123 +#include <linux/init.h>
124 #include <linux/platform_device.h>
125 +#include <linux/leds.h>
126 +#include <linux/gpio.h>
127 +#include <linux/gpio_buttons.h>
128 +#include <linux/etherdevice.h>
129 +#include <linux/mtd/mtd.h>
130 #include <linux/mtd/partitions.h>
131 +#include <linux/mtd/physmap.h>
132 +#include <linux/input.h>
133 +#include <linux/interrupt.h>
134 +#include <linux/dm9000.h>
135 +#include <linux/i2c.h>
136 +#include <linux/i2c-gpio.h>
137 #include <linux/spi/spi.h>
138 #include <linux/spi/spi_gpio.h>
139 #include <linux/spi/eeprom.h>
140 +#include <falcon/lantiq_soc.h>
141
142 #include "../machtypes.h"
143
144 #include "devices.h"
145 +#include "dev-leds-gpio.h"
146 +
147 +#define EASY98000_GPIO_LED_0 9
148 +#define EASY98000_GPIO_LED_1 10
149 +#define EASY98000_GPIO_LED_2 11
150 +#define EASY98000_GPIO_LED_3 12
151 +#define EASY98000_GPIO_LED_4 13
152 +#define EASY98000_GPIO_LED_5 14
153 +
154 +extern unsigned char ltq_ethaddr[6];
155
156 -static struct mtd_partition easy98000_nor_partitions[] = {
157 +static struct mtd_partition easy98000_nor_partitions[] =
158 +{
159 {
160 .name = "uboot",
161 .offset = 0x0,
162 @@ -35,7 +50,7 @@
163 },
164 };
165
166 -struct physmap_flash_data easy98000_nor_flash_data = {
167 +static struct physmap_flash_data easy98000_nor_flash_data = {
168 .nr_parts = ARRAY_SIZE(easy98000_nor_partitions),
169 .parts = easy98000_nor_partitions,
170 };
171 @@ -55,12 +70,105 @@
172 .platform_data = &easy98000_spi_flash_platform_data
173 };
174
175 +static struct gpio_led easy98000_leds_gpio[] __initdata = {
176 + {
177 + .name = "easy98000:green:0",
178 + .gpio = EASY98000_GPIO_LED_0,
179 + .active_low = 0,
180 + }, {
181 + .name = "easy98000:green:1",
182 + .gpio = EASY98000_GPIO_LED_1,
183 + .active_low = 0,
184 + }, {
185 + .name = "easy98000:green:2",
186 + .gpio = EASY98000_GPIO_LED_2,
187 + .active_low = 0,
188 + }, {
189 + .name = "easy98000:green:3",
190 + .gpio = EASY98000_GPIO_LED_3,
191 + .active_low = 0,
192 + }, {
193 + .name = "easy98000:green:4",
194 + .gpio = EASY98000_GPIO_LED_4,
195 + .active_low = 0,
196 + }, {
197 + .name = "easy98000:green:5",
198 + .gpio = EASY98000_GPIO_LED_5,
199 + .active_low = 0,
200 + }
201 +};
202 +
203 +#define CONFIG_DM9000_BASE 0x14000000
204 +#define DM9000_IO (CONFIG_DM9000_BASE + 3)
205 +#define DM9000_DATA (CONFIG_DM9000_BASE + 1)
206 +
207 +static struct dm9000_plat_data dm9000_plat_data = {
208 + .flags = DM9000_PLATF_8BITONLY,
209 + //.dev_addr = { }, /* possibility to provide an ethernet address for the chip */
210 +};
211 +
212 +static struct resource dm9000_resources[] = {
213 + MEM_RES("dm9000_io", DM9000_IO, DM9000_IO),
214 + MEM_RES("dm9000_data", DM9000_DATA, DM9000_DATA),
215 + [2] = {
216 + /* with irq (210 -> gpio 110) the driver is very unreliable */
217 + .start = -1, /* use polling */
218 + .end = -1,
219 + .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
220 + },
221 +};
222 +
223 +static struct platform_device dm9000_platform = {
224 + .name = "dm9000",
225 + .id = 0,
226 + .num_resources = ARRAY_SIZE(dm9000_resources),
227 + .resource = dm9000_resources,
228 + .dev = {
229 + .platform_data = (void *) &dm9000_plat_data,
230 + }
231 +};
232 +
233 +extern int easy98000_addon_has_dm9000(void);
234 +static void __init register_davicom(void)
235 +{
236 + if (!easy98000_addon_has_dm9000())
237 + return;
238 +
239 + if (!is_valid_ether_addr(ltq_ethaddr))
240 + random_ether_addr(dm9000_plat_data.dev_addr);
241 + else {
242 + memcpy(dm9000_plat_data.dev_addr, ltq_ethaddr, 6);
243 + /* change to "Locally Administered Address" */
244 + dm9000_plat_data.dev_addr[0] |= 0x2;
245 + }
246 + platform_device_register(&dm9000_platform);
247 +}
248 +
249 +static struct i2c_gpio_platform_data easy98000_i2c_gpio_data = {
250 + .sda_pin = 107,
251 + .scl_pin = 108,
252 +};
253 +
254 +static struct platform_device easy98000_i2c_gpio_device = {
255 + .name = "i2c-gpio",
256 + .id = 0,
257 + .dev = {
258 + .platform_data = &easy98000_i2c_gpio_data,
259 + }
260 +};
261 +
262 +void __init register_easy98000_cpld(void)
263 +{
264 + platform_device_register_simple("easy98000_cpld_led", 0, NULL, 0);
265 + platform_device_register_simple("easy98000_addon", 0, NULL, 0);
266 +}
267 +
268 /* setup gpio based spi bus/device for access to the eeprom on the board */
269 -#define SPI_GPIO_MRST 102
270 -#define SPI_GPIO_MTSR 103
271 -#define SPI_GPIO_CLK 104
272 -#define SPI_GPIO_CS0 105
273 -#define SPI_GPIO_CS1 106
274 +#define SPI_GPIO_MRST 102
275 +#define SPI_GPIO_MTSR 103
276 +#define SPI_GPIO_CLK 104
277 +#define SPI_GPIO_CS0 105
278 +#define SPI_GPIO_CS1 106
279 #define SPI_GPIO_BUS_NUM 1
280
281 static struct spi_gpio_platform_data easy98000_spi_gpio_data = {
282 @@ -93,29 +201,36 @@
283 .platform_data = &at25160n,
284 };
285
286 -static void __init
287 -easy98000_init_common(void)
288 +static void __init easy98000_spi_gpio_init(void)
289 {
290 spi_register_board_info(&easy98000_spi_gpio_devices, 1);
291 platform_device_register(&easy98000_spi_gpio_device);
292 }
293
294 -static void __init
295 -easy98000_init(void)
296 +static void __init easy98000_init_common(void)
297 +{
298 + falcon_register_i2c();
299 + platform_device_register(&easy98000_i2c_gpio_device);
300 + register_davicom();
301 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98000_leds_gpio),
302 + easy98000_leds_gpio);
303 + register_easy98000_cpld();
304 + easy98000_spi_gpio_init();
305 +}
306 +
307 +static void __init easy98000_init(void)
308 {
309 easy98000_init_common();
310 ltq_register_nor(&easy98000_nor_flash_data);
311 }
312
313 -static void __init
314 -easy98000sf_init(void)
315 +static void __init easy98000sf_init(void)
316 {
317 easy98000_init_common();
318 falcon_register_spi_flash(&easy98000_spi_flash_data);
319 }
320
321 -static void __init
322 -easy98000nand_init(void)
323 +static void __init easy98000nand_init(void)
324 {
325 easy98000_init_common();
326 falcon_register_nand();