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