1 --- a/arch/mips/lantiq/xway/Kconfig
2 +++ b/arch/mips/lantiq/xway/Kconfig
4 bool "Easy50712 - Danube"
7 +config LANTIQ_MACH_ARV45XX
14 --- a/arch/mips/lantiq/xway/Makefile
15 +++ b/arch/mips/lantiq/xway/Makefile
18 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
19 obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
20 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
22 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
25 + * This program is free software; you can redistribute it and/or modify it
26 + * under the terms of the GNU General Public License version 2 as published
27 + * by the Free Software Foundation.
29 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
32 +#include <linux/init.h>
33 +#include <linux/platform_device.h>
34 +#include <linux/leds.h>
35 +#include <linux/gpio.h>
36 +#include <linux/gpio_buttons.h>
37 +#include <linux/mtd/mtd.h>
38 +#include <linux/mtd/partitions.h>
39 +#include <linux/mtd/physmap.h>
40 +#include <linux/input.h>
41 +#include <linux/etherdevice.h>
42 +#include <linux/ath5k_platform.h>
43 +#include <linux/pci.h>
45 +#include <lantiq_soc.h>
46 +#include <lantiq_platform.h>
48 +#include "../machtypes.h"
50 +#include "dev-leds-gpio.h"
51 +#include "dev-dwc_otg.h"
53 +static struct mtd_partition arv4510_partitions[] =
61 + .name = "uboot_env",
71 + .name = "board_config",
77 +static struct mtd_partition arv45xx_partitions[] =
85 + .name = "uboot_env",
95 + .name = "board_config",
101 +static struct mtd_partition arv75xx_partitions[] =
109 + .name = "uboot_env",
119 + .name = "board_config",
120 + .offset = 0x7f0000,
125 +static struct physmap_flash_data arv4510_flash_data = {
126 + .nr_parts = ARRAY_SIZE(arv4510_partitions),
127 + .parts = arv4510_partitions,
130 +static struct physmap_flash_data arv45xx_flash_data = {
131 + .nr_parts = ARRAY_SIZE(arv45xx_partitions),
132 + .parts = arv45xx_partitions,
135 +static struct physmap_flash_data arv75xx_flash_data = {
136 + .nr_parts = ARRAY_SIZE(arv75xx_partitions),
137 + .parts = arv75xx_partitions,
140 +static struct ltq_pci_data ltq_pci_data = {
141 + .clock = PCI_CLOCK_EXT,
142 + .gpio = PCI_GNT1 | PCI_REQ1,
144 + [14] = INT_NUM_IM0_IRL0 + 22,
148 +static struct ltq_eth_data ltq_eth_data = {
149 + .mii_mode = PHY_INTERFACE_MODE_RMII,
152 +static struct gpio_led
153 +arv4510pw_leds_gpio[] __initdata = {
154 + { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
157 +static struct gpio_led
158 +arv4518pw_leds_gpio[] __initdata = {
159 + { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
160 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
161 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
162 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
163 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
164 + { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
165 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
166 + { .name = "soc:green:voip", .gpio = 72, .active_low = 1, .default_trigger = "default-on" },
167 + { .name = "soc:green:fxs1", .gpio = 73, .active_low = 1, .default_trigger = "default-on" },
168 + { .name = "soc:green:fxs2", .gpio = 74, .active_low = 1, .default_trigger = "default-on" },
169 + { .name = "soc:green:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
172 +static struct gpio_button
173 +arv4518pw_gpio_buttons[] __initdata = {
174 + { .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
175 + { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
176 + { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
179 +static struct gpio_led
180 +arv4520pw_leds_gpio[] __initdata = {
181 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
182 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
183 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
184 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
185 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, },
186 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
187 + { .name = "soc:blue:voip", .gpio = 72, .active_low = 1, },
188 + { .name = "soc:blue:fxs1", .gpio = 73, .active_low = 1, },
189 + { .name = "soc:blue:fxs2", .gpio = 74, .active_low = 1, },
190 + { .name = "soc:blue:fxo", .gpio = 75, .active_low = 1, },
191 + { .name = "soc:blue:voice", .gpio = 76, .active_low = 1, },
192 + { .name = "soc:blue:usb", .gpio = 77, .active_low = 1, },
193 + { .name = "soc:blue:wlan", .gpio = 78, .active_low = 1, },
196 +static struct gpio_led
197 +arv452cpw_leds_gpio[] __initdata = {
198 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
199 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
200 + { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
201 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
202 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
203 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
204 + { .name = "soc:blue:fxs1", .gpio = 72, .active_low = 1, .default_trigger = "default-on" },
205 + { .name = "soc:blue:fxs2", .gpio = 73, .active_low = 1, .default_trigger = "default-on" },
206 + { .name = "soc:blue:wps", .gpio = 74, .active_low = 1, .default_trigger = "default-on" },
207 + { .name = "soc:blue:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
208 + { .name = "soc:blue:voice", .gpio = 76, .active_low = 1, .default_trigger = "default-on" },
209 + { .name = "soc:blue:usb", .gpio = 77, .active_low = 1, .default_trigger = "default-on" },
210 + { .name = "soc:blue:wlan", .gpio = 78, .active_low = 1, .default_trigger = "default-on" },
211 + { .name = "soc:blue:internet", .gpio = 80, .active_low = 1, .default_trigger = "default-on" },
212 + { .name = "soc:red:internet", .gpio = 81, .active_low = 1, .default_trigger = "default-on" },
215 +static struct gpio_led
216 +arv4525pw_leds_gpio[] __initdata = {
217 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
218 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
219 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
220 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
221 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
224 +static struct gpio_led
225 +arv752dpw22_leds_gpio[] __initdata = {
226 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
227 + { .name = "soc:red:internet", .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:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
230 + { .name = "soc:red:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
231 + { .name = "soc:red:voice", .gpio = 76, .active_low = 1, .default_trigger = "default-on" },
232 + { .name = "soc:green:usb", .gpio = 77, .active_low = 1, .default_trigger = "default-on" },
233 + { .name = "soc:green:wlan", .gpio = 78, .active_low = 1, .default_trigger = "default-on" },
234 + { .name = "soc:green:wlan1", .gpio = 79, .active_low = 1, .default_trigger = "default-on" },
235 + { .name = "soc:blue:wlan", .gpio = 80, .active_low = 1, .default_trigger = "default-on" },
236 + { .name = "soc:blue:wlan1", .gpio = 81, .active_low = 1, .default_trigger = "default-on" },
237 + { .name = "soc:green:eth1", .gpio = 83, .active_low = 1, .default_trigger = "default-on" },
238 + { .name = "soc:green:eth2", .gpio = 84, .active_low = 1, .default_trigger = "default-on" },
239 + { .name = "soc:green:eth3", .gpio = 85, .active_low = 1, .default_trigger = "default-on" },
240 + { .name = "soc:green:eth4", .gpio = 86, .active_low = 1, .default_trigger = "default-on", },
243 +static struct gpio_button
244 +arv752dpw22_gpio_buttons[] __initdata = {
245 + { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
246 + { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
247 + { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
250 +static struct gpio_led
251 +arv7518pw_leds_gpio[] __initdata = {
252 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
253 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
254 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
255 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
256 + { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
257 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
260 +static struct gpio_button
261 +arv7518pw_gpio_buttons[] __initdata = {
262 + { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
263 + { .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
267 +arv45xx_register_ethernet(void)
269 +#define ARV45XX_BRN_MAC 0x3f0016
270 + memcpy_fromio(<q_eth_data.mac.sa_data,
271 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
272 + ltq_register_etop(<q_eth_data);
276 +arv75xx_register_ethernet(void)
278 +#define ARV75XX_BRN_MAC 0x7f0016
279 + memcpy_fromio(<q_eth_data.mac.sa_data,
280 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV75XX_BRN_MAC), 6);
281 + ltq_register_etop(<q_eth_data);
285 +bewan_register_ethernet(void)
287 +#define BEWAN_BRN_MAC 0x3f0014
288 + memcpy_fromio(<q_eth_data.mac.sa_data,
289 + (void *)KSEG1ADDR(LTQ_FLASH_START + BEWAN_BRN_MAC), 6);
290 + ltq_register_etop(<q_eth_data);
293 +static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
294 +static struct ath5k_platform_data arv45xx_ath5k_platform_data;
296 +/*static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
298 + dev->dev.platform_data = &arv45xx_ath5k_platform_data;
303 +arv45xx_register_ath5k(void)
305 +#define ARV45XX_BRN_ATH 0x3f0478
307 + unsigned char eeprom_mac[6];
308 + static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
309 + u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
311 + memcpy_fromio(eeprom_mac,
312 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
314 + memcpy_fromio(arv45xx_ath5k_eeprom_data,
315 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
316 + // swap eeprom bytes
317 + for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
318 + //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
319 + 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);
321 + // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
322 + /* regdomain is invalid?? how did original fw convert
323 + * value to 0x82d4 ??
324 + * for now, force to 0x67 */
325 + p[i] &= 0xffff0000;
329 + arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
330 + arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
331 + //lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
337 + ltq_register_gpio_stp();
338 + //ltq_add_device_leds_gpio(arv3527p_leds_gpio, ARRAY_SIZE(arv3527p_leds_gpio));
339 + ltq_register_nor(&arv45xx_flash_data);
340 + arv45xx_register_ethernet();
343 +MIPS_MACHINE(LANTIQ_MACH_ARV3527P,
345 + "ARV3527P - Arcor Easybox 401",
349 +arv4510pw_init(void)
351 + ltq_register_gpio_stp();
352 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4510pw_leds_gpio), arv4510pw_leds_gpio);
353 + ltq_register_nor(&arv4510_flash_data);
354 + ltq_pci_data.irq[12] = (INT_NUM_IM2_IRL0 + 31);
355 + ltq_pci_data.irq[15] = (INT_NUM_IM0_IRL0 + 26);
356 + ltq_pci_data.gpio |= PCI_EXIN2 | PCI_REQ2;
357 + ltq_register_pci(<q_pci_data);
358 + bewan_register_ethernet();
361 +MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
363 + "ARV4510PW - Wippies Homebox",
367 +arv4518pw_init(void)
369 +#define ARV4518PW_EBU 0
370 +#define ARV4518PW_USB 14
371 +#define ARV4518PW_SWITCH_RESET 13
373 + ltq_register_gpio_ebu(ARV4518PW_EBU);
374 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4518pw_leds_gpio), arv4518pw_leds_gpio);
375 + ltq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
376 + ltq_register_nor(&arv45xx_flash_data);
377 + ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
378 + ltq_register_pci(<q_pci_data);
379 + ltq_register_madwifi_eep();
380 + xway_register_dwc(ARV4518PW_USB);
381 + arv45xx_register_ethernet();
382 + arv45xx_register_ath5k();
384 + gpio_request(ARV4518PW_SWITCH_RESET, "switch");
385 + gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
386 + gpio_export(ARV4518PW_SWITCH_RESET, 0);
389 +MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
391 + "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
395 +arv4520pw_init(void)
397 +#define ARV4520PW_EBU 0x400
398 +#define ARV4520PW_USB 28
399 +#define ARV4520PW_SWITCH_RESET 82
401 + ltq_register_gpio_ebu(ARV4520PW_EBU);
402 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4520pw_leds_gpio), arv4520pw_leds_gpio);
403 + ltq_register_nor(&arv45xx_flash_data);
404 + ltq_register_pci(<q_pci_data);
405 + ltq_register_tapi();
406 + arv45xx_register_ethernet();
407 + xway_register_dwc(ARV4520PW_USB);
409 + gpio_request(ARV4520PW_SWITCH_RESET, "switch");
410 + gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
413 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
415 + "ARV4520PW - Airties WAV-281, Arcor A800",
419 +arv452Cpw_init(void)
421 +#define ARV452CPW_EBU 0x77f
422 +#define ARV452CPW_USB 28
423 +#define ARV452CPW_RELAY1 31
424 +#define ARV452CPW_RELAY2 79
425 +#define ARV452CPW_SWITCH_RESET 82
427 + ltq_register_gpio_ebu(ARV452CPW_EBU);
428 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv452cpw_leds_gpio), arv452cpw_leds_gpio);
429 + ltq_register_nor(&arv45xx_flash_data);
430 + ltq_register_pci(<q_pci_data);
431 + ltq_register_madwifi_eep();
432 + xway_register_dwc(ARV452CPW_USB);
433 + arv45xx_register_ethernet();
434 + arv45xx_register_ath5k();
436 + gpio_request(ARV452CPW_SWITCH_RESET, "switch");
437 + gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
438 + gpio_export(ARV452CPW_SWITCH_RESET, 0);
440 + gpio_request(ARV452CPW_RELAY1, "relay1");
441 + gpio_direction_output(ARV452CPW_RELAY1, 1);
442 + gpio_export(ARV452CPW_RELAY1, 0);
444 + gpio_request(ARV452CPW_RELAY2, "relay2");
445 + gpio_set_value(ARV452CPW_RELAY2, 1);
446 + gpio_export(ARV452CPW_RELAY2, 0);
449 +MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
451 + "ARV452CPW - Arcor A801",
455 +arv4525pw_init(void)
457 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4525pw_leds_gpio), arv4525pw_leds_gpio);
458 + ltq_register_nor(&arv45xx_flash_data);
459 + ltq_pci_data.clock = PCI_CLOCK_INT;
460 + ltq_register_pci(<q_pci_data);
461 + ltq_register_madwifi_eep();
462 + ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
463 + arv45xx_register_ethernet();
466 +MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
468 + "ARV4525PW - Speedport W502V",
472 +arv7518pw_init(void)
474 +#define ARV7518PW_EBU 0x2
475 +#define ARV7518PW_USB 14
477 + ltq_register_gpio_ebu(ARV7518PW_EBU);
478 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv7518pw_leds_gpio), arv7518pw_leds_gpio);
479 + ltq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
480 + ltq_register_nor(&arv75xx_flash_data);
481 + ltq_register_pci(<q_pci_data);
482 + ltq_register_tapi();
483 + xway_register_dwc(ARV7518PW_USB);
484 + arv75xx_register_ethernet();
485 + //arv7518_register_ath9k(mac);
488 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
490 + "ARV7518PW - ASTORIA",
494 +arv752dpw22_init(void)
496 +#define ARV752DPW22_EBU 0x2
497 +#define ARV752DPW22_USB 72
498 +#define ARV752DPW22_RELAY 73
500 + ltq_register_gpio_ebu(ARV752DPW22_EBU);
501 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv752dpw22_leds_gpio), arv752dpw22_leds_gpio);
502 + ltq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
503 + ltq_register_nor(&arv75xx_flash_data);
504 + ltq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
505 + ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
506 + ltq_register_pci(<q_pci_data);
507 + xway_register_dwc(ARV752DPW22_USB);
508 + arv75xx_register_ethernet();
510 + gpio_request(ARV752DPW22_RELAY, "relay");
511 + gpio_set_value(ARV752DPW22_RELAY, 1);
512 + gpio_export(ARV752DPW22_RELAY, 0);
515 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
517 + "ARV752DPW22 - Arcor A803",
519 --- a/arch/mips/lantiq/machtypes.h
520 +++ b/arch/mips/lantiq/machtypes.h
522 LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
523 LANTIQ_MACH_EASY98020, /* Falcon Reference Board */
524 LANTIQ_MACH_95C3AM1, /* Board 95C3AM1 */
527 + LANTIQ_MACH_ARV3527P, /* Arcor easybox a401 */
528 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
529 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
530 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
531 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
532 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
533 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */
534 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
535 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */