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 +#ifdef CONFIG_MTD_PARTITIONS
54 +static struct mtd_partition arv4510_partitions[] =
62 + .name = "uboot_env",
72 + .name = "board_config",
78 +static struct mtd_partition arv45xx_partitions[] =
86 + .name = "uboot_env",
96 + .name = "board_config",
102 +static struct mtd_partition arv75xx_partitions[] =
110 + .name = "uboot_env",
120 + .name = "board_config",
121 + .offset = 0x7f0000,
128 +static struct physmap_flash_data arv4510_flash_data = {
129 +#ifdef CONFIG_MTD_PARTITIONS
130 + .nr_parts = ARRAY_SIZE(arv4510_partitions),
131 + .parts = arv4510_partitions,
135 +static struct physmap_flash_data arv45xx_flash_data = {
136 +#ifdef CONFIG_MTD_PARTITIONS
137 + .nr_parts = ARRAY_SIZE(arv45xx_partitions),
138 + .parts = arv45xx_partitions,
142 +static struct physmap_flash_data arv75xx_flash_data = {
143 +#ifdef CONFIG_MTD_PARTITIONS
144 + .nr_parts = ARRAY_SIZE(arv75xx_partitions),
145 + .parts = arv75xx_partitions,
149 +static struct ltq_pci_data ltq_pci_data = {
150 + .clock = PCI_CLOCK_EXT,
151 + .gpio = PCI_GNT1 | PCI_REQ1,
153 + [14] = INT_NUM_IM0_IRL0 + 22,
157 +static struct ltq_eth_data ltq_eth_data = {
158 + .mii_mode = PHY_INTERFACE_MODE_RMII,
161 +static struct gpio_led
162 +arv4510pw_leds_gpio[] __initdata = {
163 + { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
166 +static struct gpio_led
167 +arv4518pw_leds_gpio[] __initdata = {
168 + { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
169 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
170 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
171 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
172 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
173 + { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
174 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
175 + { .name = "soc:green:voip", .gpio = 72, .active_low = 1, .default_trigger = "default-on" },
176 + { .name = "soc:green:fxs1", .gpio = 73, .active_low = 1, .default_trigger = "default-on" },
177 + { .name = "soc:green:fxs2", .gpio = 74, .active_low = 1, .default_trigger = "default-on" },
178 + { .name = "soc:green:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
181 +static struct gpio_button
182 +arv4518pw_gpio_buttons[] __initdata = {
183 + { .desc = "wlan", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 28, .active_low = 1, },
184 + { .desc = "wps", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 29, .active_low = 1, },
185 + { .desc = "reset", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 30, .active_low = 1, },
188 +static struct gpio_led
189 +arv4520pw_leds_gpio[] __initdata = {
190 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
191 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
192 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
193 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
194 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, },
195 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
196 + { .name = "soc:blue:voip", .gpio = 72, .active_low = 1, },
197 + { .name = "soc:blue:fxs1", .gpio = 73, .active_low = 1, },
198 + { .name = "soc:blue:fxs2", .gpio = 74, .active_low = 1, },
199 + { .name = "soc:blue:fxo", .gpio = 75, .active_low = 1, },
200 + { .name = "soc:blue:voice", .gpio = 76, .active_low = 1, },
201 + { .name = "soc:blue:usb", .gpio = 77, .active_low = 1, },
202 + { .name = "soc:blue:wlan", .gpio = 78, .active_low = 1, },
205 +static struct gpio_led
206 +arv452cpw_leds_gpio[] __initdata = {
207 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
208 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
209 + { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
210 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
211 + { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
212 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
213 + { .name = "soc:blue:fxs1", .gpio = 72, .active_low = 1, .default_trigger = "default-on" },
214 + { .name = "soc:blue:fxs2", .gpio = 73, .active_low = 1, .default_trigger = "default-on" },
215 + { .name = "soc:blue:wps", .gpio = 74, .active_low = 1, .default_trigger = "default-on" },
216 + { .name = "soc:blue:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
217 + { .name = "soc:blue:voice", .gpio = 76, .active_low = 1, .default_trigger = "default-on" },
218 + { .name = "soc:blue:usb", .gpio = 77, .active_low = 1, .default_trigger = "default-on" },
219 + { .name = "soc:blue:wlan", .gpio = 78, .active_low = 1, .default_trigger = "default-on" },
220 + { .name = "soc:blue:internet", .gpio = 80, .active_low = 1, .default_trigger = "default-on" },
221 + { .name = "soc:red:internet", .gpio = 81, .active_low = 1, .default_trigger = "default-on" },
224 +static struct gpio_led
225 +arv4525pw_leds_gpio[] __initdata = {
226 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
227 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
228 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
229 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
230 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
233 +static struct gpio_led
234 +arv752dpw22_leds_gpio[] __initdata = {
235 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
236 + { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
237 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
238 + { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
239 + { .name = "soc:red:fxo", .gpio = 75, .active_low = 1, .default_trigger = "default-on" },
240 + { .name = "soc:red:voice", .gpio = 76, .active_low = 1, .default_trigger = "default-on" },
241 + { .name = "soc:green:usb", .gpio = 77, .active_low = 1, .default_trigger = "default-on" },
242 + { .name = "soc:green:wlan", .gpio = 78, .active_low = 1, .default_trigger = "default-on" },
243 + { .name = "soc:green:wlan1", .gpio = 79, .active_low = 1, .default_trigger = "default-on" },
244 + { .name = "soc:blue:wlan", .gpio = 80, .active_low = 1, .default_trigger = "default-on" },
245 + { .name = "soc:blue:wlan1", .gpio = 81, .active_low = 1, .default_trigger = "default-on" },
246 + { .name = "soc:green:eth1", .gpio = 83, .active_low = 1, .default_trigger = "default-on" },
247 + { .name = "soc:green:eth2", .gpio = 84, .active_low = 1, .default_trigger = "default-on" },
248 + { .name = "soc:green:eth3", .gpio = 85, .active_low = 1, .default_trigger = "default-on" },
249 + { .name = "soc:green:eth4", .gpio = 86, .active_low = 1, .default_trigger = "default-on", },
252 +static struct gpio_button
253 +arv752dpw22_gpio_buttons[] __initdata = {
254 + { .desc = "btn0", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 12, .active_low = 1, },
255 + { .desc = "btn1", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 13, .active_low = 1, },
256 + { .desc = "btn2", .type = EV_KEY, .code = BTN_2, .threshold = 3, .gpio = 28, .active_low = 1, },
259 +static struct gpio_led
260 +arv7518pw_leds_gpio[] __initdata = {
261 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
262 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
263 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
264 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
265 + { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
266 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
269 +static struct gpio_button
270 +arv7518pw_gpio_buttons[] __initdata = {
271 + { .desc = "reset", .type = EV_KEY, .code = BTN_0, .threshold = 3, .gpio = 23, .active_low = 1, },
272 + { .desc = "wlan", .type = EV_KEY, .code = BTN_1, .threshold = 3, .gpio = 25, .active_low = 1, },
276 +arv45xx_register_ethernet(void)
278 +#define ARV45XX_BRN_MAC 0x3f0016
279 + memcpy_fromio(<q_eth_data.mac,
280 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
281 + ltq_register_etop(<q_eth_data);
285 +arv75xx_register_ethernet(void)
287 +#define ARV75XX_BRN_MAC 0x7f0016
288 + memcpy_fromio(<q_eth_data.mac,
289 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV75XX_BRN_MAC), 6);
290 + ltq_register_etop(<q_eth_data);
294 +bewan_register_ethernet(void)
296 +#define BEWAN_BRN_MAC 0x3f0014
297 + memcpy_fromio(<q_eth_data.mac,
298 + (void *)KSEG1ADDR(LTQ_FLASH_START + BEWAN_BRN_MAC), 6);
299 + ltq_register_etop(<q_eth_data);
302 +static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
303 +static struct ath5k_platform_data arv45xx_ath5k_platform_data;
305 +static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
307 + dev->dev.platform_data = &arv45xx_ath5k_platform_data;
312 +arv45xx_register_ath5k(void)
314 +#define ARV45XX_BRN_ATH 0x3f0478
316 + unsigned char eeprom_mac[6];
317 + static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
318 + u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
320 + memcpy_fromio(eeprom_mac,
321 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
323 + memcpy_fromio(arv45xx_ath5k_eeprom_data,
324 + (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
325 + // swap eeprom bytes
326 + for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
327 + //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
328 + 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);
330 + // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
331 + /* regdomain is invalid?? how did original fw convert
332 + * value to 0x82d4 ??
333 + * for now, force to 0x67 */
334 + p[i] &= 0xffff0000;
338 + arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
339 + arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
340 + //lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
346 + ltq_register_gpio_stp();
347 + //ltq_add_device_leds_gpio(arv3527p_leds_gpio, ARRAY_SIZE(arv3527p_leds_gpio));
348 + ltq_register_nor(&arv45xx_flash_data);
349 + arv45xx_register_ethernet();
352 +MIPS_MACHINE(LANTIQ_MACH_ARV3527P,
354 + "ARV3527P - Arcor Easybox 401",
358 +arv4510pw_init(void)
360 + ltq_register_gpio_stp();
361 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4510pw_leds_gpio), arv4510pw_leds_gpio);
362 + ltq_register_nor(&arv4510_flash_data);
363 + ltq_pci_data.irq[12] = (INT_NUM_IM2_IRL0 + 31);
364 + ltq_pci_data.irq[15] = (INT_NUM_IM0_IRL0 + 26);
365 + ltq_pci_data.gpio |= PCI_EXIN2 | PCI_REQ2;
366 + ltq_register_pci(<q_pci_data);
367 + bewan_register_ethernet();
370 +MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
372 + "ARV4510PW - Wippies Homebox",
376 +arv4518pw_init(void)
378 +#define ARV4518PW_EBU 0
379 +#define ARV4518PW_USB 14
380 +#define ARV4518PW_SWITCH_RESET 13
382 + ltq_register_gpio_ebu(ARV4518PW_EBU);
383 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4518pw_leds_gpio), arv4518pw_leds_gpio);
384 + ltq_register_gpio_buttons(arv4518pw_gpio_buttons, ARRAY_SIZE(arv4518pw_gpio_buttons));
385 + ltq_register_nor(&arv45xx_flash_data);
386 + ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
387 + ltq_register_pci(<q_pci_data);
388 + ltq_register_madwifi_eep();
389 + xway_register_dwc(ARV4518PW_USB);
390 + arv45xx_register_ethernet();
391 + arv45xx_register_ath5k();
393 + gpio_request(ARV4518PW_SWITCH_RESET, "switch");
394 + gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
395 + gpio_export(ARV4518PW_SWITCH_RESET, 0);
398 +MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
400 + "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
404 +arv4520pw_init(void)
406 +#define ARV4520PW_EBU 0x400
407 +#define ARV4520PW_USB 28
408 +#define ARV4520PW_SWITCH_RESET 82
410 + ltq_register_gpio_ebu(ARV4520PW_EBU);
411 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4520pw_leds_gpio), arv4520pw_leds_gpio);
412 + ltq_register_nor(&arv45xx_flash_data);
413 + ltq_register_pci(<q_pci_data);
414 + ltq_register_tapi();
415 + arv45xx_register_ethernet();
416 + xway_register_dwc(ARV4520PW_USB);
418 + gpio_request(ARV4520PW_SWITCH_RESET, "switch");
419 + gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
422 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
424 + "ARV4520PW - Airties WAV-281, Arcor A800",
428 +arv452Cpw_init(void)
430 +#define ARV452CPW_EBU 0x77f
431 +#define ARV452CPW_USB 28
432 +#define ARV452CPW_RELAY1 31
433 +#define ARV452CPW_RELAY2 79
434 +#define ARV452CPW_SWITCH_RESET 82
436 + ltq_register_gpio_ebu(ARV452CPW_EBU);
437 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv452cpw_leds_gpio), arv452cpw_leds_gpio);
438 + ltq_register_nor(&arv45xx_flash_data);
439 + ltq_register_pci(<q_pci_data);
440 + ltq_register_madwifi_eep();
441 + xway_register_dwc(ARV452CPW_USB);
442 + arv45xx_register_ethernet();
443 + arv45xx_register_ath5k();
445 + gpio_request(ARV452CPW_SWITCH_RESET, "switch");
446 + gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
447 + gpio_export(ARV452CPW_SWITCH_RESET, 0);
449 + gpio_request(ARV452CPW_RELAY1, "relay1");
450 + gpio_direction_output(ARV452CPW_RELAY1, 1);
451 + gpio_export(ARV452CPW_RELAY1, 0);
453 + gpio_request(ARV452CPW_RELAY2, "relay2");
454 + gpio_set_value(ARV452CPW_RELAY2, 1);
455 + gpio_export(ARV452CPW_RELAY2, 0);
458 +MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
460 + "ARV452CPW - Arcor A801",
464 +arv4525pw_init(void)
466 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv4525pw_leds_gpio), arv4525pw_leds_gpio);
467 + ltq_register_nor(&arv45xx_flash_data);
468 + ltq_pci_data.clock = PCI_CLOCK_INT;
469 + ltq_register_pci(<q_pci_data);
470 + ltq_register_madwifi_eep();
471 + ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
472 + arv45xx_register_ethernet();
475 +MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
477 + "ARV4525PW - Speedport W502V",
481 +arv7518pw_init(void)
483 +#define ARV7518PW_EBU 0x2
484 +#define ARV7518PW_USB 14
486 + ltq_register_gpio_ebu(ARV7518PW_EBU);
487 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv7518pw_leds_gpio), arv7518pw_leds_gpio);
488 + ltq_register_gpio_buttons(arv7518pw_gpio_buttons, ARRAY_SIZE(arv7518pw_gpio_buttons));
489 + ltq_register_nor(&arv75xx_flash_data);
490 + ltq_register_pci(<q_pci_data);
491 + ltq_register_tapi();
492 + xway_register_dwc(ARV7518PW_USB);
493 + arv75xx_register_ethernet();
494 + //arv7518_register_ath9k(mac);
497 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
499 + "ARV7518PW - ASTORIA",
503 +arv752dpw22_init(void)
505 +#define ARV752DPW22_EBU 0x2
506 +#define ARV752DPW22_USB 72
507 +#define ARV752DPW22_RELAY 73
509 + ltq_register_gpio_ebu(ARV752DPW22_EBU);
510 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(arv752dpw22_leds_gpio), arv752dpw22_leds_gpio);
511 + ltq_register_gpio_buttons(arv752dpw22_gpio_buttons, ARRAY_SIZE(arv752dpw22_gpio_buttons));
512 + ltq_register_nor(&arv75xx_flash_data);
513 + ltq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
514 + ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
515 + ltq_register_pci(<q_pci_data);
516 + xway_register_dwc(ARV752DPW22_USB);
517 + arv75xx_register_ethernet();
519 + gpio_request(ARV752DPW22_RELAY, "relay");
520 + gpio_set_value(ARV752DPW22_RELAY, 1);
521 + gpio_export(ARV752DPW22_RELAY, 0);
524 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
526 + "ARV752DPW22 - Arcor A803",
528 --- a/arch/mips/lantiq/machtypes.h
529 +++ b/arch/mips/lantiq/machtypes.h
531 LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
532 LANTIQ_MACH_EASY98020, /* Falcon Reference Board */
533 LANTIQ_MACH_95C3AM1, /* Board 95C3AM1 */
536 + LANTIQ_MACH_ARV3527P, /* Arcor easybox a401 */
537 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
538 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
539 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
540 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
541 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
542 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */
543 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
544 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */