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_ARV3527P, /* Arcor easybox a401 */
10 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
11 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
12 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
13 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
14 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
15 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */
16 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
17 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
19 --- a/arch/mips/lantiq/xway/Kconfig
20 +++ b/arch/mips/lantiq/xway/Kconfig
25 +config LANTIQ_MACH_ARV45XX
32 --- a/arch/mips/lantiq/xway/Makefile
33 +++ b/arch/mips/lantiq/xway/Makefile
35 obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
36 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
37 obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
38 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
40 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
43 + * This program is free software; you can redistribute it and/or modify it
44 + * under the terms of the GNU General Public License version 2 as published
45 + * by the Free Software Foundation.
47 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
50 +#include <linux/init.h>
51 +#include <linux/platform_device.h>
52 +#include <linux/leds.h>
53 +#include <linux/gpio.h>
54 +#include <linux/gpio_buttons.h>
55 +#include <linux/mtd/mtd.h>
56 +#include <linux/mtd/partitions.h>
57 +#include <linux/mtd/physmap.h>
58 +#include <linux/input.h>
59 +#include <linux/etherdevice.h>
60 +#include <linux/ath5k_platform.h>
61 +#include <linux/pci.h>
66 +#include <lantiq_platform.h>
69 +#include "dev-dwc_otg.h"
71 +#ifdef CONFIG_MTD_PARTITIONS
72 +static struct mtd_partition arv45xx_partitions[] =
80 + .name = "uboot_env",
90 + .name = "board_config",
96 +static struct mtd_partition arv75xx_partitions[] =
104 + .name = "uboot_env",
114 + .name = "board_config",
115 + .offset = 0x7f0000,
122 +static struct physmap_flash_data arv45xx_flash_data = {
123 +#ifdef CONFIG_MTD_PARTITIONS
124 + .nr_parts = ARRAY_SIZE(arv45xx_partitions),
125 + .parts = arv45xx_partitions,
129 +static struct physmap_flash_data arv75xx_flash_data = {
130 +#ifdef CONFIG_MTD_PARTITIONS
131 + .nr_parts = ARRAY_SIZE(arv75xx_partitions),
132 + .parts = arv75xx_partitions,
136 +static struct lq_pci_data lq_pci_data = {
137 + .clock = PCI_CLOCK_EXT,
138 + .gpio = PCI_GNT1 | PCI_REQ1,
140 + [14] = INT_NUM_IM0_IRL0 + 22,
144 +static struct lq_eth_data lq_eth_data = {
145 + .mii_mode = REV_MII_MODE,
146 + .mac = "\xff\xff\xff\xff\xff\xff",
149 +static struct gpio_led
150 +arv4510pw_leds_gpio[] __initdata = {
151 + { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
154 +static struct gpio_led
155 +arv4518pw_leds_gpio[] __initdata = {
156 + { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
157 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
158 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
159 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
160 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
161 + { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
162 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
163 + { .name = "soc:green:voip", .gpio = 32, .active_low = 1, .default_trigger = "default-on" },
164 + { .name = "soc:green:fxs1", .gpio = 33, .active_low = 1, .default_trigger = "default-on" },
165 + { .name = "soc:green:fxs2", .gpio = 34, .active_low = 1, .default_trigger = "default-on" },
166 + { .name = "soc:green:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
169 +static struct gpio_button
170 +arv4518pw_gpio_buttons[] __initdata = {
171 + { .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
172 + { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
173 + { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
176 +static struct gpio_led
177 +arv4520pw_leds_gpio[] __initdata = {
178 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
179 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
180 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
181 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
182 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, },
183 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
184 + { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
185 + { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
186 + { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
187 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
188 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
189 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
190 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
193 +static struct gpio_led
194 +arv452cpw_leds_gpio[] __initdata = {
195 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
196 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
197 + { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
198 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
199 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
200 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
201 + { .name = "soc:blue:fxs1", .gpio = 32, .active_low = 1, .default_trigger = "default-on" },
202 + { .name = "soc:blue:fxs2", .gpio = 33, .active_low = 1, .default_trigger = "default-on" },
203 + { .name = "soc:blue:wps", .gpio = 34, .active_low = 1, .default_trigger = "default-on" },
204 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
205 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
206 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
207 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
208 + { .name = "soc:blue:internet", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
209 + { .name = "soc:red:internet", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
212 +static struct gpio_led
213 +arv4525pw_leds_gpio[] __initdata = {
214 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
215 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
216 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
217 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
218 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
221 +static struct gpio_led
222 +arv752dpw22_leds_gpio[] __initdata = {
223 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
224 + { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
225 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
226 + { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
227 + { .name = "soc:red:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
228 + { .name = "soc:red:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
229 + { .name = "soc:green:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
230 + { .name = "soc:green:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
231 + { .name = "soc:green:wlan1", .gpio = 39, .active_low = 1, .default_trigger = "default-on" },
232 + { .name = "soc:blue:wlan", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
233 + { .name = "soc:blue:wlan1", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
234 + { .name = "soc:green:eth1", .gpio = 43, .active_low = 1, .default_trigger = "default-on" },
235 + { .name = "soc:green:eth2", .gpio = 44, .active_low = 1, .default_trigger = "default-on" },
236 + { .name = "soc:green:eth3", .gpio = 45, .active_low = 1, .default_trigger = "default-on" },
237 + { .name = "soc:green:eth4", .gpio = 46, .active_low = 1, .default_trigger = "default-on", },
240 +static struct gpio_button
241 +arv752dpw22_gpio_buttons[] __initdata = {
242 + { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
243 + { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
244 + { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
247 +static struct gpio_led
248 +arv7518pw_leds_gpio[] __initdata = {
249 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
250 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
251 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
252 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
253 + { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
254 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
257 +static struct gpio_button
258 +arv7518pw_gpio_buttons[] __initdata = {
259 + { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
260 + { .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
264 +arv45xx_register_ethernet(void)
266 +#define ARV45XX_BRN_MAC 0x3f0016
267 + memcpy_fromio(lq_eth_data.mac,
268 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
269 + lq_register_ethernet(&lq_eth_data);
273 +arv75xx_register_ethernet(void)
275 +#define ARV75XX_BRN_MAC 0x7f0016
276 + memcpy_fromio(lq_eth_data.mac,
277 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV75XX_BRN_MAC), 6);
278 + lq_register_ethernet(&lq_eth_data);
282 +bewan_register_ethernet(void)
284 +#define BEWAN_BRN_MAC 0x3f0014
285 + memcpy_fromio(lq_eth_data.mac,
286 + (void *)KSEG1ADDR(LQ_FLASH_START + BEWAN_BRN_MAC), 6);
287 + lq_register_ethernet(&lq_eth_data);
290 +static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
291 +static struct ath5k_platform_data arv45xx_ath5k_platform_data;
293 +static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
295 + dev->dev.platform_data = &arv45xx_ath5k_platform_data;
300 +arv45xx_register_ath5k(void)
302 +#define ARV45XX_BRN_ATH 0x3f0478
304 + unsigned char eeprom_mac[6];
305 + static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
306 + u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
308 + memcpy_fromio(eeprom_mac,
309 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
311 + memcpy_fromio(arv45xx_ath5k_eeprom_data,
312 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
313 + // swap eeprom bytes
314 + for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
315 + //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
316 + 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);
318 + // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
319 + /* regdomain is invalid?? how did original fw convert
320 + * value to 0x82d4 ??
321 + * for now, force to 0x67 */
322 + p[i] &= 0xffff0000;
326 + arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
327 + arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
328 + lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
334 + lq_register_gpio();
335 + lq_register_gpio_stp();
336 + //lq_register_gpio_leds(arv3527p_leds_gpio, ARRAY_SIZE(arv3527p_leds_gpio));
337 + lq_register_asc(0);
338 + lq_register_asc(1);
339 + lq_register_nor(&arv45xx_flash_data);
341 + arv45xx_register_ethernet();
344 +MIPS_MACHINE(LANTIQ_MACH_ARV3527P,
346 + "ARV3527P - Arcor Easybox 401",
350 +arv4510pw_init(void)
352 + lq_register_gpio();
353 + lq_register_gpio_stp();
354 + lq_register_gpio_leds(arv4510pw_leds_gpio, ARRAY_SIZE(arv4510pw_leds_gpio));
355 + lq_register_asc(0);
356 + lq_register_asc(1);
357 + lq_register_nor(&arv45xx_flash_data);
358 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
359 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
360 + lq_register_pci(&lq_pci_data);
362 + bewan_register_ethernet();
365 +MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
367 + "ARV4510PW - Wippies Homebox",
371 +arv4518pw_init(void)
373 +#define ARV4518PW_EBU 0
374 +#define ARV4518PW_USB 14
375 +#define ARV4518PW_SWITCH_RESET 13
377 + lq_register_gpio();
378 + lq_register_gpio_ebu(ARV4518PW_EBU);
379 + lq_register_gpio_leds(arv4518pw_leds_gpio, ARRAY_SIZE(arv4518pw_leds_gpio));
380 + lq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
381 + lq_register_asc(0);
382 + lq_register_asc(1);
383 + lq_register_nor(&arv45xx_flash_data);
384 + lq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
385 + lq_register_pci(&lq_pci_data);
387 + lq_register_madwifi_eep();
388 + xway_register_dwc(ARV4518PW_USB);
389 + arv45xx_register_ethernet();
390 + arv45xx_register_ath5k();
392 + gpio_request(ARV4518PW_SWITCH_RESET, "switch");
393 + gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
394 + gpio_export(ARV4518PW_SWITCH_RESET, 0);
397 +MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
399 + "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
403 +arv4520pw_init(void)
405 +#define ARV4520PW_EBU 0x400
406 +#define ARV4520PW_USB 28
407 +#define ARV4520PW_SWITCH_RESET 42
409 + lq_register_gpio();
410 + lq_register_gpio_ebu(ARV4520PW_EBU);
411 + lq_register_gpio_leds(arv4520pw_leds_gpio, ARRAY_SIZE(arv4520pw_leds_gpio));
412 + lq_register_asc(0);
413 + lq_register_asc(1);
414 + lq_register_nor(&arv45xx_flash_data);
415 + lq_register_pci(&lq_pci_data);
417 + lq_register_tapi();
418 + arv45xx_register_ethernet();
419 + xway_register_dwc(ARV4520PW_USB);
421 + gpio_request(ARV4520PW_SWITCH_RESET, "switch");
422 + gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
425 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
427 + "ARV4520PW - Airties WAV-281, Arcor A800",
431 +arv452Cpw_init(void)
433 +#define ARV452CPW_EBU 0x77f
434 +#define ARV452CPW_USB 28
435 +#define ARV452CPW_RELAY1 31
436 +#define ARV452CPW_RELAY2 39
437 +#define ARV452CPW_SWITCH_RESET 42
439 + lq_register_gpio();
440 + lq_register_gpio_ebu(ARV452CPW_EBU);
441 + lq_register_gpio_leds(arv452cpw_leds_gpio, ARRAY_SIZE(arv452cpw_leds_gpio));
442 + lq_register_asc(0);
443 + lq_register_asc(1);
444 + lq_register_nor(&arv45xx_flash_data);
445 + lq_register_pci(&lq_pci_data);
447 + lq_register_madwifi_eep();
448 + xway_register_dwc(ARV452CPW_USB);
449 + arv45xx_register_ethernet();
450 + arv45xx_register_ath5k();
452 + gpio_request(ARV452CPW_SWITCH_RESET, "switch");
453 + gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
454 + gpio_export(ARV452CPW_SWITCH_RESET, 0);
456 + gpio_request(ARV452CPW_RELAY1, "relay1");
457 + gpio_direction_output(ARV452CPW_RELAY1, 1);
458 + gpio_export(ARV452CPW_RELAY1, 0);
460 + gpio_request(ARV452CPW_RELAY2, "relay2");
461 + gpio_set_value(ARV452CPW_RELAY2, 1);
462 + gpio_export(ARV452CPW_RELAY2, 0);
465 +MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
467 + "ARV452CPW - Arcor A801",
471 +arv4525pw_init(void)
473 + lq_register_gpio();
474 + lq_register_gpio_leds(arv4525pw_leds_gpio, ARRAY_SIZE(arv4525pw_leds_gpio));
475 + lq_register_asc(0);
476 + lq_register_asc(1);
477 + lq_register_nor(&arv45xx_flash_data);
478 + lq_pci_data.clock = PCI_CLOCK_INT;
479 + lq_register_pci(&lq_pci_data);
481 + lq_register_madwifi_eep();
482 + lq_eth_data.mii_mode = MII_MODE;
483 + arv45xx_register_ethernet();
486 +MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
488 + "ARV4525PW - Speedport W502V",
492 +arv7518pw_init(void)
494 +#define ARV7518PW_EBU 0x2
495 +#define ARV7518PW_USB -1
497 + lq_register_gpio();
498 + lq_register_gpio_ebu(ARV7518PW_EBU);
499 + lq_register_asc(0);
500 + lq_register_asc(1);
501 + lq_register_gpio_leds(arv7518pw_leds_gpio, ARRAY_SIZE(arv7518pw_leds_gpio));
502 + lq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
503 + lq_register_nor(&arv75xx_flash_data);
504 + lq_register_pci(&lq_pci_data);
506 + xway_register_dwc(ARV7518PW_USB);
507 + arv75xx_register_ethernet();
508 + //arv7518_register_ath9k(mac);
511 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
513 + "ARV7518PW - ASTORIA",
517 +arv752dpw22_init(void)
519 +#define ARV752DPW22_EBU 0x2
520 +#define ARV752DPW22_USB 32
521 +#define ARV752DPW22_RELAY 33
523 + lq_register_gpio();
524 + lq_register_gpio_ebu(ARV752DPW22_EBU);
525 + lq_register_asc(0);
526 + lq_register_asc(1);
527 + lq_register_gpio_leds(arv752dpw22_leds_gpio, ARRAY_SIZE(arv752dpw22_leds_gpio));
528 + lq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
529 + lq_register_nor(&arv75xx_flash_data);
530 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
531 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
532 + lq_register_pci(&lq_pci_data);
534 + xway_register_dwc(ARV752DPW22_USB);
535 + arv75xx_register_ethernet();
537 + gpio_request(ARV752DPW22_RELAY, "relay");
538 + gpio_set_value(ARV752DPW22_RELAY, 1);
539 + gpio_export(ARV752DPW22_RELAY, 0);
542 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
544 + "ARV752DPW22 - Arcor A803",