1 --- a/arch/mips/include/asm/mach-lantiq/machine.h
2 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
4 LANTIQ_MACH_EASY4010, /* Twinpass evalkit */
5 LANTIQ_MACH_EASY50712, /* Danube evalkit */
6 LANTIQ_MACH_EASY50812, /* AR9 eval board */
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 a802 */
15 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
16 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
18 --- a/arch/mips/lantiq/xway/Kconfig
19 +++ b/arch/mips/lantiq/xway/Kconfig
24 +config LANTIQ_MACH_ARV45XX
31 --- a/arch/mips/lantiq/xway/Makefile
32 +++ b/arch/mips/lantiq/xway/Makefile
34 obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
35 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
36 obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
37 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
39 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
42 + * This program is free software; you can redistribute it and/or modify it
43 + * under the terms of the GNU General Public License version 2 as published
44 + * by the Free Software Foundation.
46 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
49 +#include <linux/init.h>
50 +#include <linux/platform_device.h>
51 +#include <linux/leds.h>
52 +#include <linux/gpio.h>
53 +#include <linux/gpio_buttons.h>
54 +#include <linux/mtd/mtd.h>
55 +#include <linux/mtd/partitions.h>
56 +#include <linux/mtd/physmap.h>
57 +#include <linux/input.h>
58 +#include <linux/etherdevice.h>
59 +#include <linux/ath5k_platform.h>
60 +#include <linux/pci.h>
65 +#include <lantiq_platform.h>
68 +#include "dev-dwc_otg.h"
70 +#ifdef CONFIG_MTD_PARTITIONS
71 +static struct mtd_partition arv45xx_partitions[] =
79 + .name = "uboot_env",
89 + .name = "board_config",
95 +static struct mtd_partition arv4518_partitions[] =
103 + .name = "uboot_env",
113 + .name = "board_config",
114 + .offset = 0x3f0000,
119 +static struct mtd_partition arv75xx_partitions[] =
127 + .name = "uboot_env",
137 + .name = "board_config",
138 + .offset = 0x7f0000,
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,
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,
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,
166 +static struct lq_pci_data lq_pci_data = {
167 + .clock = PCI_CLOCK_EXT,
168 + .gpio = PCI_GNT1 | PCI_REQ1,
170 + [14] = INT_NUM_IM0_IRL0 + 22,
174 +static struct lq_eth_data lq_eth_data = {
175 + .mii_mode = REV_MII_MODE,
176 + .mac = "\xff\xff\xff\xff\xff\xff",
179 +static struct gpio_led
180 +arv4510pw_leds_gpio[] __initdata = {
181 + { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
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" },
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, },
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:yellow: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, },
223 +static struct gpio_led
224 +arv452cpw_leds_gpio[] __initdata = {
225 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
226 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
227 + { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
228 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
229 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
230 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
231 + { .name = "soc:blue:fxs1", .gpio = 32, .active_low = 1, .default_trigger = "default-on" },
232 + { .name = "soc:blue:fxs2", .gpio = 33, .active_low = 1, .default_trigger = "default-on" },
233 + { .name = "soc:blue:wps", .gpio = 34, .active_low = 1, .default_trigger = "default-on" },
234 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
235 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
236 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
237 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
238 + { .name = "soc:blue:internet", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
239 + { .name = "soc:red:internet", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
242 +static struct gpio_led
243 +arv4525pw_leds_gpio[] __initdata = {
244 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
245 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
246 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
247 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
248 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
251 +static struct gpio_led
252 +arv752dpw22_leds_gpio[] __initdata = {
253 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
254 + { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
255 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
256 + { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
257 + { .name = "soc:red:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
258 + { .name = "soc:red:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
259 + { .name = "soc:green:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
260 + { .name = "soc:green:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
261 + { .name = "soc:green:wlan1", .gpio = 39, .active_low = 1, .default_trigger = "default-on" },
262 + { .name = "soc:blue:wlan", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
263 + { .name = "soc:blue:wlan1", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
264 + { .name = "soc:green:eth1", .gpio = 43, .active_low = 1, .default_trigger = "default-on" },
265 + { .name = "soc:green:eth2", .gpio = 44, .active_low = 1, .default_trigger = "default-on" },
266 + { .name = "soc:green:eth3", .gpio = 45, .active_low = 1, .default_trigger = "default-on" },
267 + { .name = "soc:green:eth4", .gpio = 46, .active_low = 1, .default_trigger = "default-on", },
270 +static struct gpio_button
271 +arv752dpw22_gpio_buttons[] __initdata = {
272 + { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
273 + { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
274 + { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
277 +static struct gpio_led
278 +arv7518pw_leds_gpio[] __initdata = {
279 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
280 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
281 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
282 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
283 + { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
284 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
287 +static struct gpio_button
288 +arv7518pw_gpio_buttons[] __initdata = {
289 + { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
290 + { .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
294 +arv45xx_register_ethernet(void)
296 +#define ARV45XX_BRN_MAC 0x3f0016
297 + memcpy_fromio(lq_eth_data.mac,
298 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
299 + lq_register_ethernet(&lq_eth_data);
303 +arv75xx_register_ethernet(void)
305 +#define ARV75XX_BRN_MAC 0x7f0016
306 + memcpy_fromio(lq_eth_data.mac,
307 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV75XX_BRN_MAC), 6);
308 + lq_register_ethernet(&lq_eth_data);
312 +bewan_register_ethernet(void)
314 +#define BEWAN_BRN_MAC 0x3f0014
315 + memcpy_fromio(lq_eth_data.mac,
316 + (void *)KSEG1ADDR(LQ_FLASH_START + BEWAN_BRN_MAC), 6);
317 + lq_register_ethernet(&lq_eth_data);
320 +static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
321 +static struct ath5k_platform_data arv45xx_ath5k_platform_data;
323 +static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
325 + dev->dev.platform_data = &arv45xx_ath5k_platform_data;
330 +arv45xx_register_ath5k(void)
332 +#define ARV45XX_BRN_ATH 0x3f0478
334 + unsigned char eeprom_mac[6];
335 + u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
336 + u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
338 + memcpy_fromio(eeprom_mac,
339 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
341 + memcpy_fromio(arv45xx_ath5k_eeprom_data,
342 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
343 + // swap eeprom bytes
344 + for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
345 + //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
346 + p[i] = ((eeprom_data[(i<<1)+1]&0xff)<<24)|((eeprom_data[(i<<1)+1]&0xff00)<<8)|((eeprom_data[i<<1]&0xff)<<8)|((eeprom_data[i<<1]&0xff00)>>8);
348 + // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
349 + /* regdomain is invalid?? how did original fw convert
350 + * value to 0x82d4 ??
351 + * for now, force to 0x67 */
352 + p[i] &= 0xffff0000;
356 + arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
357 + arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
358 + lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
362 +arv4510pw_init(void)
364 + lq_register_gpio();
365 + lq_register_gpio_stp();
366 + lq_register_gpio_leds(arv4510pw_leds_gpio, ARRAY_SIZE(arv4510pw_leds_gpio));
367 + lq_register_asc(0);
368 + lq_register_asc(1);
369 + lq_register_nor(&arv45xx_flash_data);
370 + lq_register_pci(&lq_pci_data);
371 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
372 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
373 + lq_register_pci(&lq_pci_data);
375 + bewan_register_ethernet();
378 +MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
380 + "ARV4510PW - Wippies Homebox",
384 +arv4518pw_init(void)
386 +#define ARV4518PW_EBU 0
387 +#define ARV4518PW_USB 14
388 +#define ARV4518PW_SWITCH_RESET 13
390 + lq_register_gpio();
391 + lq_register_gpio_ebu(ARV4518PW_EBU);
392 + lq_register_gpio_leds(arv4518pw_leds_gpio, ARRAY_SIZE(arv4518pw_leds_gpio));
393 + lq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
394 + lq_register_asc(0);
395 + lq_register_asc(1);
396 + lq_register_nor(&arv4518_flash_data);
397 + lq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
398 + lq_register_pci(&lq_pci_data);
400 + xway_register_dwc(ARV4518PW_USB);
401 + arv45xx_register_ethernet();
402 + arv45xx_register_ath5k();
404 + gpio_request(ARV4518PW_SWITCH_RESET, "switch");
405 + gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
406 + gpio_export(ARV4518PW_SWITCH_RESET, 0);
409 +MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
411 + "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
415 +arv4520pw_init(void)
417 +#define ARV4520PW_EBU 0x400
418 +#define ARV4520PW_USB 28
419 +#define ARV4520PW_SWITCH_RESET 42
421 + lq_register_gpio();
422 + lq_register_gpio_ebu(ARV4520PW_EBU);
423 + lq_register_gpio_leds(arv4520pw_leds_gpio, ARRAY_SIZE(arv4520pw_leds_gpio));
424 + lq_register_asc(0);
425 + lq_register_asc(1);
426 + lq_register_nor(&arv45xx_flash_data);
427 + lq_register_pci(&lq_pci_data);
429 + arv45xx_register_ethernet();
430 + xway_register_dwc(ARV4520PW_USB);
432 + gpio_request(ARV4520PW_SWITCH_RESET, "switch");
433 + gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
436 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
438 + "ARV4520PW - Airties WAV-281, Arcor A800",
442 +arv452Cpw_init(void)
444 +#define ARV452CPW_EBU 0x77f
445 +#define ARV452CPW_USB 28
446 +#define ARV452CPW_RELAY1 31
447 +#define ARV452CPW_RELAY2 39
448 +#define ARV452CPW_SWITCH_RESET 42
450 + lq_register_gpio();
451 + lq_register_gpio_ebu(ARV452CPW_EBU);
452 + lq_register_gpio_leds(arv452cpw_leds_gpio, ARRAY_SIZE(arv452cpw_leds_gpio));
453 + lq_register_asc(0);
454 + lq_register_asc(1);
455 + lq_register_nor(&arv4518_flash_data);
456 + lq_register_pci(&lq_pci_data);
458 + xway_register_dwc(ARV452CPW_USB);
459 + arv45xx_register_ethernet();
460 + arv45xx_register_ath5k();
462 + gpio_request(ARV452CPW_SWITCH_RESET, "switch");
463 + gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
464 + gpio_export(ARV452CPW_SWITCH_RESET, 0);
466 + gpio_request(ARV452CPW_RELAY1, "relay1");
467 + gpio_direction_output(ARV452CPW_RELAY1, 1);
468 + gpio_export(ARV452CPW_RELAY1, 0);
470 + gpio_request(ARV452CPW_RELAY2, "relay2");
471 + gpio_set_value(ARV452CPW_RELAY2, 1);
472 + gpio_export(ARV452CPW_RELAY2, 0);
475 +MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
477 + "ARV452CPW - Arcor A801",
481 +arv4525pw_init(void)
483 + lq_register_gpio();
484 + lq_register_gpio_leds(arv4525pw_leds_gpio, ARRAY_SIZE(arv4525pw_leds_gpio));
485 + lq_register_asc(0);
486 + lq_register_asc(1);
487 + lq_register_nor(&arv45xx_flash_data);
488 + lq_pci_data.clock = PCI_CLOCK_INT;
489 + lq_register_pci(&lq_pci_data);
491 + lq_eth_data.mii_mode = MII_MODE;
492 + arv45xx_register_ethernet();
495 +MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
497 + "ARV4525PW - Speedport W502V",
501 +arv7518pw_init(void)
503 +#define ARV7518PW_EBU 0x2
504 +#define ARV7518PW_USB -1
506 + lq_register_gpio();
507 + lq_register_gpio_ebu(ARV7518PW_EBU);
508 + lq_register_asc(0);
509 + lq_register_asc(1);
510 + lq_register_gpio_leds(arv7518pw_leds_gpio, ARRAY_SIZE(arv7518pw_leds_gpio));
511 + lq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
512 + lq_register_nor(&arv75xx_flash_data);
513 + lq_register_pci(&lq_pci_data);
515 + xway_register_dwc(ARV7518PW_USB);
516 + arv75xx_register_ethernet();
517 + //arv7518_register_ath9k(mac);
520 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
522 + "ARV7518PW - ASTORIA",
526 +arv752dpw22_init(void)
528 +#define ARV752DPW22_EBU 0x2
529 +#define ARV752DPW22_USB 32
530 +#define ARV752DPW22_RELAY 33
532 + lq_register_gpio();
533 + lq_register_gpio_ebu(ARV752DPW22_EBU);
534 + lq_register_asc(0);
535 + lq_register_asc(1);
536 + lq_register_gpio_leds(arv752dpw22_leds_gpio, ARRAY_SIZE(arv752dpw22_leds_gpio));
537 + lq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
538 + lq_register_nor(&arv75xx_flash_data);
539 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
540 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
541 + lq_register_pci(&lq_pci_data);
543 + xway_register_dwc(ARV752DPW22_USB);
544 + arv75xx_register_ethernet();
546 + gpio_request(ARV752DPW22_RELAY, "relay");
547 + gpio_set_value(ARV752DPW22_RELAY, 1);
548 + gpio_export(ARV752DPW22_RELAY, 0);
551 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
553 + "ARV752DPW22 - Arcor A803",