* adds arv4518pw mach support * fixes arv4525pw * make sure all mach names have the...
[openwrt/openwrt.git] / target / linux / lantiq / patches / 400-mach-arv45xx.patch
1 --- a/arch/mips/include/asm/mach-lantiq/machine.h
2 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
3 @@ -11,4 +11,13 @@
4 LANTIQ_MACH_EASY4010, /* Twinpass evalkit */
5 LANTIQ_MACH_EASY50712, /* Danube evalkit */
6 LANTIQ_MACH_EASY50812, /* AR9 eval board */
7 +
8 + /* Arcadyan */
9 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
10 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
11 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
12 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
13 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
14 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a803 */
15 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
16 };
17 --- a/arch/mips/lantiq/xway/Kconfig
18 +++ b/arch/mips/lantiq/xway/Kconfig
19 @@ -14,6 +14,10 @@
20 bool "Easy4010"
21 default y
22
23 +config LANTIQ_MACH_ARV45XX
24 + bool "ARV45XX"
25 + default y
26 +
27 endmenu
28
29 endif
30 --- a/arch/mips/lantiq/xway/Makefile
31 +++ b/arch/mips/lantiq/xway/Makefile
32 @@ -3,3 +3,4 @@
33 obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
34 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
35 obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
36 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
37 --- /dev/null
38 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
39 @@ -0,0 +1,389 @@
40 +/*
41 + * This program is free software; you can redistribute it and/or modify it
42 + * under the terms of the GNU General Public License version 2 as published
43 + * by the Free Software Foundation.
44 + *
45 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
46 + */
47 +
48 +#include <linux/init.h>
49 +#include <linux/platform_device.h>
50 +#include <linux/leds.h>
51 +#include <linux/gpio.h>
52 +#include <linux/gpio_buttons.h>
53 +#include <linux/mtd/mtd.h>
54 +#include <linux/mtd/partitions.h>
55 +#include <linux/mtd/physmap.h>
56 +#include <linux/input.h>
57 +#include <linux/etherdevice.h>
58 +
59 +#include <machine.h>
60 +
61 +#include <xway.h>
62 +#include <lantiq_platform.h>
63 +
64 +#include "devices.h"
65 +#include "dev-dwc_otg.h"
66 +
67 +#define ARV4520PW_LATCH_SWITCH (1 << 10)
68 +#define ARV752DPW_LATCH_DEFAULT (2)
69 +
70 +#ifdef CONFIG_MTD_PARTITIONS
71 +static struct mtd_partition arv45xx_partitions[] =
72 +{
73 + {
74 + .name = "uboot",
75 + .offset = 0x0,
76 + .size = 0x20000,
77 + },
78 + {
79 + .name = "uboot_env",
80 + .offset = 0x20000,
81 + .size = 0x10000,
82 + },
83 + {
84 + .name = "linux",
85 + .offset = 0x30000,
86 + .size = 0x3c0000,
87 + },
88 + {
89 + .name = "board_config",
90 + .offset = 0x3f0000,
91 + .size = 0x10000,
92 + },
93 +};
94 +
95 +static struct mtd_partition arv4518_partitions[] =
96 +{
97 + {
98 + .name = "uboot",
99 + .offset = 0x0,
100 + .size = 0x40000,
101 + },
102 + {
103 + .name = "uboot_env",
104 + .offset = 0x40000,
105 + .size = 0x10000,
106 + },
107 + {
108 + .name = "linux",
109 + .offset = 0x50000,
110 + .size = 0x3a0000,
111 + },
112 + {
113 + .name = "board_config",
114 + .offset = 0x3f0000,
115 + .size = 0x10000,
116 + },
117 +};
118 +
119 +static struct mtd_partition arv75xx_partitions[] =
120 +{
121 + {
122 + .name = "uboot",
123 + .offset = 0x0,
124 + .size = 0x40000,
125 + },
126 + {
127 + .name = "uboot_env",
128 + .offset = 0x40000,
129 + .size = 0x10000,
130 + },
131 + {
132 + .name = "linux",
133 + .offset = 0x50000,
134 + .size = 0x7a0000,
135 + },
136 + {
137 + .name = "board_config",
138 + .offset = 0x7f0000,
139 + .size = 0x10000,
140 + },
141 +};
142 +
143 +#endif
144 +
145 +static struct physmap_flash_data arv45xx_flash_data = {
146 +#ifdef CONFIG_MTD_PARTITIONS
147 + .nr_parts = ARRAY_SIZE(arv45xx_partitions),
148 + .parts = arv45xx_partitions,
149 +#endif
150 +};
151 +
152 +static struct physmap_flash_data arv4518_flash_data = {
153 +#ifdef CONFIG_MTD_PARTITIONS
154 + .nr_parts = ARRAY_SIZE(arv4518_partitions),
155 + .parts = arv4518_partitions,
156 +#endif
157 +};
158 +
159 +static struct physmap_flash_data arv75xx_flash_data = {
160 +#ifdef CONFIG_MTD_PARTITIONS
161 + .nr_parts = ARRAY_SIZE(arv75xx_partitions),
162 + .parts = arv75xx_partitions,
163 +#endif
164 +};
165 +
166 +static struct lq_pci_data lq_pci_data = {
167 + .clock = PCI_CLOCK_EXT,
168 + .gpio = PCI_GNT1 | PCI_REQ1,
169 + .irq = {
170 + [14] = INT_NUM_IM0_IRL0 + 22,
171 + },
172 +};
173 +
174 +static struct lq_eth_data lq_eth_data = {
175 + .mii_mode = REV_MII_MODE,
176 + .mac = "\xff\xff\xff\xff\xff\xff",
177 +};
178 +
179 +static struct gpio_led
180 +arv4510pw_leds_gpio[] __initdata = {
181 + { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
182 +};
183 +
184 +static struct gpio_led
185 +arv4518pw_leds_gpio[] __initdata = {
186 + { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
187 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
188 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
189 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
190 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
191 + { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
192 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
193 + { .name = "soc:green:voip", .gpio = 32, .active_low = 1, .default_trigger = "default-on" },
194 + { .name = "soc:green:fxs1", .gpio = 33, .active_low = 1, .default_trigger = "default-on" },
195 + { .name = "soc:green:fxs2", .gpio = 34, .active_low = 1, .default_trigger = "default-on" },
196 + { .name = "soc:green:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
197 +};
198 +
199 +static struct gpio_button
200 +arv4518pw_gpio_buttons[] __initdata = {
201 + { .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
202 + { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
203 + { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
204 +};
205 +
206 +static struct gpio_led
207 +arv4520pw_leds_gpio[] __initdata = {
208 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
209 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
210 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
211 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
212 + { .name = "soc:yello:wps", .gpio = 7, .active_low = 1, },
213 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
214 + { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
215 + { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
216 + { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
217 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
218 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
219 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
220 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
221 +};
222 +
223 +static struct gpio_led
224 +arv4525pw_leds_gpio[] __initdata = {
225 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
226 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
227 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
228 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
229 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
230 +};
231 +
232 +static struct gpio_led
233 +arv752dpw_leds_gpio[] __initdata = {
234 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
235 + { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
236 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
237 + { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
238 + { .name = "soc:red:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
239 + { .name = "soc:red:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
240 + { .name = "soc:green:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
241 + { .name = "soc:green:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
242 + { .name = "soc:green:wlan1", .gpio = 39, .active_low = 1, .default_trigger = "default-on" },
243 + { .name = "soc:blue:wlan", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
244 + { .name = "soc:blue:wlan1", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
245 + { .name = "soc:green:eth1", .gpio = 43, .active_low = 1, .default_trigger = "default-on" },
246 + { .name = "soc:green:eth2", .gpio = 44, .active_low = 1, .default_trigger = "default-on" },
247 + { .name = "soc:green:eth3", .gpio = 45, .active_low = 1, .default_trigger = "default-on" },
248 + { .name = "soc:green:eth4", .gpio = 46, .active_low = 1, .default_trigger = "default-on", },
249 +};
250 +
251 +static struct gpio_button
252 +arv752dpw_gpio_buttons[] __initdata = {
253 + { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
254 + { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
255 + { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
256 +};
257 +
258 +static struct gpio_led
259 +arv7518pw_leds_gpio[] __initdata = {
260 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
261 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
262 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
263 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
264 + { .name = "sco:red:internet", .gpio = 8, .active_low = 1, },
265 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
266 +};
267 +
268 +static void
269 +arv45xx_register_ethernet(void)
270 +{
271 +#define ARV45XX_BRN_MAC 0x3f0016
272 + memcpy_fromio(lq_eth_data.mac,
273 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
274 + lq_register_ethernet(&lq_eth_data);
275 +}
276 +
277 +static void
278 +arv75xx_register_ethernet(void)
279 +{
280 +#define ARV75XX_BRN_MAC 0x7f0016
281 + memcpy_fromio(lq_eth_data.mac,
282 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV75XX_BRN_MAC), 6);
283 + lq_register_ethernet(&lq_eth_data);
284 +}
285 +
286 +static void
287 +bewan_register_ethernet(void)
288 +{
289 +#define BEWAN_BRN_MAC 0x3f0014
290 + memcpy_fromio(lq_eth_data.mac,
291 + (void *)KSEG1ADDR(LQ_FLASH_START + BEWAN_BRN_MAC), 6);
292 + lq_register_ethernet(&lq_eth_data);
293 +}
294 +
295 +static void __init
296 +arv4510pw_init(void)
297 +{
298 + lq_register_gpio();
299 + lq_register_gpio_stp();
300 + lq_register_gpio_leds(arv4510pw_leds_gpio, ARRAY_SIZE(arv4510pw_leds_gpio));
301 + lq_register_asc(0);
302 + lq_register_asc(1);
303 + lq_register_nor(&arv45xx_flash_data);
304 + lq_register_pci(&lq_pci_data);
305 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
306 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
307 + lq_register_pci(&lq_pci_data);
308 + lq_register_wdt();
309 + bewan_register_ethernet();
310 +}
311 +
312 +MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
313 + "ARV4510PW",
314 + "ARV4510PW - Wippies Homebox",
315 + arv4510pw_init);
316 +
317 +static void __init
318 +arv4518pw_init(void)
319 +{
320 + lq_register_gpio();
321 + lq_register_gpio_ebu(0);
322 + lq_register_gpio_leds(arv4518pw_leds_gpio, ARRAY_SIZE(arv4518pw_leds_gpio));
323 + lq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
324 + lq_register_asc(0);
325 + lq_register_asc(1);
326 + lq_register_nor(&arv4518_flash_data);
327 + lq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
328 + lq_register_pci(&lq_pci_data);
329 + lq_register_wdt();
330 + arv45xx_register_ethernet();
331 + xway_register_dwc(14);
332 + gpio_request(13, "switch-reset");
333 + gpio_direction_output(13, 1);
334 + gpio_export(13, 0);
335 +}
336 +
337 +MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
338 + "ARV4518PW",
339 + "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
340 + arv4518pw_init);
341 +
342 +static void __init
343 +arv4520pw_init(void)
344 +{
345 + lq_register_gpio();
346 + lq_register_gpio_ebu(ARV4520PW_LATCH_SWITCH);
347 + lq_register_gpio_leds(arv4520pw_leds_gpio, ARRAY_SIZE(arv4520pw_leds_gpio));
348 + lq_register_asc(0);
349 + lq_register_asc(1);
350 + lq_register_nor(&arv45xx_flash_data);
351 + lq_register_pci(&lq_pci_data);
352 + lq_register_wdt();
353 + arv45xx_register_ethernet();
354 + xway_register_dwc(28);
355 +}
356 +
357 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
358 + "ARV4520PW",
359 + "ARV4520PW - Airties WAV-281, Arcor A800",
360 + arv4520pw_init);
361 +
362 +static void __init
363 +arv4525pw_init(void)
364 +{
365 + lq_register_gpio();
366 + lq_register_gpio_leds(arv4525pw_leds_gpio, ARRAY_SIZE(arv4525pw_leds_gpio));
367 + lq_register_asc(0);
368 + lq_register_asc(1);
369 + lq_register_nor(&arv45xx_flash_data);
370 + lq_pci_data.clock = PCI_CLOCK_INT;
371 + lq_register_pci(&lq_pci_data);
372 + lq_register_wdt();
373 + lq_eth_data.mii_mode = MII_MODE;
374 + arv45xx_register_ethernet();
375 +}
376 +
377 +MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
378 + "ARV4525PW",
379 + "ARV4525PW - Speedport W502V",
380 + arv4525pw_init);
381 +
382 +static void __init
383 +arv7518pw_init(void)
384 +{
385 + lq_register_gpio();
386 + lq_register_gpio_ebu(ARV4520PW_LATCH_SWITCH);
387 + lq_register_asc(0);
388 + lq_register_asc(1);
389 + lq_register_gpio_leds(arv7518pw_leds_gpio, ARRAY_SIZE(arv7518pw_leds_gpio));
390 + lq_register_nor(&arv75xx_flash_data);
391 + lq_register_pci(&lq_pci_data);
392 + lq_register_wdt();
393 + arv75xx_register_ethernet();
394 + //arv7518_register_ath9k(mac);
395 +}
396 +
397 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
398 + "ARV7518PW",
399 + "ARV7518PW - ASTORIA",
400 + arv7518pw_init);
401 +
402 +static void __init
403 +arv752dpw_init(void)
404 +{
405 + lq_register_gpio();
406 + lq_register_gpio_ebu(ARV752DPW_LATCH_DEFAULT);
407 + lq_register_asc(0);
408 + lq_register_asc(1);
409 + lq_register_gpio_leds(arv752dpw_leds_gpio, ARRAY_SIZE(arv752dpw_leds_gpio));
410 + lq_register_gpio_buttons(arv752dpw_gpio_buttons, ARRAY_SIZE(arv752dpw_gpio_buttons));
411 + lq_register_nor(&arv75xx_flash_data);
412 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
413 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
414 + lq_register_pci(&lq_pci_data);
415 + lq_register_wdt();
416 + arv75xx_register_ethernet();
417 + gpio_request(32, "usb-power");
418 + gpio_direction_output(32, 0);
419 + mdelay(1);
420 + __gpio_set_value(32, 1);
421 + gpio_request(33, "relay");
422 + gpio_direction_output(33, 1);
423 +}
424 +
425 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW,
426 + "ARV752DPW",
427 + "ARV752DPW - Arcor A803",
428 + arv752dpw_init);