[lantiq] Support booting the Speedport W502V using BRN-BOOT.
[15.05/openwrt.git] / target / linux / lantiq / files-3.1 / arch / mips / lantiq / xway / mach-arv45xx.c
1 /*
2  *  This program is free software; you can redistribute it and/or modify it
3  *  under the terms of the GNU General Public License version 2 as published
4  *  by the Free Software Foundation.
5  *
6  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7  */
8
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/leds.h>
12 #include <linux/gpio.h>
13 #include <linux/gpio_buttons.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/input.h>
18 #include <linux/etherdevice.h>
19 #include <linux/ath5k_platform.h>
20 #include <linux/pci.h>
21
22 #include <lantiq_soc.h>
23 #include <lantiq_platform.h>
24 #include <dev-gpio-leds.h>
25 #include <dev-gpio-buttons.h>
26
27 #include "../machtypes.h"
28 #include "dev-wifi-rt2x00.h"
29 #include "dev-wifi-ath5k.h"
30 #include "devices.h"
31 #include "dev-dwc_otg.h"
32
33 static struct mtd_partition arv4510_partitions[] =
34 {
35         {
36                 .name   = "uboot",
37                 .offset = 0x0,
38                 .size   = 0x20000,
39         },
40         {
41                 .name   = "uboot_env",
42                 .offset = 0x20000,
43                 .size   = 0x120000,
44         },
45         {
46                 .name   = "linux",
47                 .offset = 0x40000,
48                 .size   = 0xfa0000,
49         },
50         {
51                 .name   = "board_config",
52                 .offset = 0xfe0000,
53                 .size   = 0x20000,
54         },
55 };
56
57 static struct mtd_partition arv45xx_partitions[] =
58 {
59         {
60                 .name   = "uboot",
61                 .offset = 0x0,
62                 .size   = 0x20000,
63         },
64         {
65                 .name   = "uboot_env",
66                 .offset = 0x20000,
67                 .size   = 0x10000,
68         },
69         {
70                 .name   = "linux",
71                 .offset = 0x30000,
72                 .size   = 0x3c0000,
73         },
74         {
75                 .name   = "board_config",
76                 .offset = 0x3f0000,
77                 .size   = 0x10000,
78         },
79 };
80
81 static struct mtd_partition arv45xx_brnboot_partitions[] =
82 {
83         {
84                 .name   = "brn-boot",
85                 .offset = 0x0,
86                 .size   = 0x20000,
87         },
88         {
89                 .name   = "config",
90                 .offset = 0x20000,
91                 .size   = 0x30000,
92         },
93         {
94                 .name   = "linux",
95                 .offset = 0x50000,
96                 .size   = 0x390000,
97         },
98         {
99                 .name   = "reserved", /* 12-byte signature at 0x3efff4 :/ */
100                 .offset = 0x3e0000,
101                 .size   = 0x010000,
102         },
103         {
104                 .name   = "eeprom",
105                 .offset = 0x3f0000,
106                 .size   = 0x10000,
107         },
108 };
109
110 static struct mtd_partition arv7525_partitions[] =
111 {
112         {
113                 .name   = "uboot",
114                 .offset = 0x0,
115                 .size   = 0x10000,
116         },
117         {
118                 .name   = "uboot_env",
119                 .offset = 0x10000,
120                 .size   = 0x10000,
121         },
122         {
123                 .name   = "linux",
124                 .offset = 0x20000,
125                 .size   = 0x3d0000,
126         },
127         {
128                 .name   = "board_config",
129                 .offset = 0x3f0000,
130                 .size   = 0x10000,
131         },
132 };
133
134 static struct mtd_partition arv75xx_partitions[] =
135 {
136         {
137                 .name   = "uboot",
138                 .offset = 0x0,
139                 .size   = 0x10000,
140         },
141         {
142                 .name   = "uboot_env",
143                 .offset = 0x10000,
144                 .size   = 0x10000,
145         },
146         {
147                 .name   = "linux",
148                 .offset = 0x20000,
149                 .size   = 0x7d0000,
150         },
151         {
152                 .name   = "board_config",
153                 .offset = 0x7f0000,
154                 .size   = 0x10000,
155         },
156 };
157
158 static struct physmap_flash_data arv4510_flash_data = {
159         .nr_parts       = ARRAY_SIZE(arv4510_partitions),
160         .parts          = arv4510_partitions,
161 };
162
163 static struct physmap_flash_data arv45xx_flash_data = {
164         .nr_parts       = ARRAY_SIZE(arv45xx_partitions),
165         .parts          = arv45xx_partitions,
166 };
167
168 static struct physmap_flash_data arv45xx_brnboot_flash_data = {
169         .nr_parts       = ARRAY_SIZE(arv45xx_brnboot_partitions),
170         .parts          = arv45xx_brnboot_partitions,
171 };
172
173 static struct physmap_flash_data arv7525_flash_data = {
174         .nr_parts       = ARRAY_SIZE(arv7525_partitions),
175         .parts          = arv7525_partitions,
176 };
177
178 static struct physmap_flash_data arv75xx_flash_data = {
179         .nr_parts       = ARRAY_SIZE(arv75xx_partitions),
180         .parts          = arv75xx_partitions,
181 };
182
183 static struct ltq_pci_data ltq_pci_data = {
184         .clock  = PCI_CLOCK_EXT,
185         .gpio   = PCI_GNT1 | PCI_REQ1,
186         .irq    = {
187                 [14] = INT_NUM_IM0_IRL0 + 22,
188         },
189 };
190
191 static struct ltq_eth_data ltq_eth_data = {
192         .mii_mode       = PHY_INTERFACE_MODE_RMII,
193 };
194
195 static struct gpio_led
196 arv4510pw_gpio_leds[] __initdata = {
197         { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
198 };
199
200 static struct gpio_led
201 arv4518pw_gpio_leds[] __initdata = {
202         { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
203         { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
204         { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
205         { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
206         { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
207         { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
208         { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
209         { .name = "soc:green:voip", .gpio = 100, .active_low = 1, .default_trigger = "default-on" },
210         { .name = "soc:green:fxs1", .gpio = 101, .active_low = 1, .default_trigger = "default-on" },
211         { .name = "soc:green:fxs2", .gpio = 102, .active_low = 1, .default_trigger = "default-on" },
212         { .name = "soc:green:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
213 };
214
215 static struct gpio_keys_button
216 arv4518pw_gpio_keys[] __initdata = {
217         {
218                 .desc           = "wifi",
219                 .type           = EV_KEY,
220                 .code           = BTN_0,
221                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
222                 .gpio           = 28,
223                 .active_low     = 1,
224         },
225         {
226                 .desc           = "reset",
227                 .type           = EV_KEY,
228                 .code           = BTN_1,
229                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
230                 .gpio           = 30,
231                 .active_low     = 1,
232         },
233         {
234                 .desc           = "wps",
235                 .type           = EV_KEY,
236                 .code           = BTN_2,
237                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
238                 .gpio           = 29,
239                 .active_low     = 1,
240         },
241 };
242
243 static struct gpio_led
244 arv4520pw_gpio_leds[] __initdata = {
245         { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
246         { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
247         { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
248         { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
249         { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, },
250         { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
251         { .name = "soc:blue:voip", .gpio = 100, .active_low = 1, },
252         { .name = "soc:blue:fxs1", .gpio = 101, .active_low = 1, },
253         { .name = "soc:blue:fxs2", .gpio = 102, .active_low = 1, },
254         { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, },
255         { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, },
256         { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, },
257         { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, },
258 };
259
260 static struct gpio_led
261 arv452cpw_gpio_leds[] __initdata = {
262         { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
263         { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
264         { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
265         { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
266         { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
267         { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
268         { .name = "soc:blue:fxs1", .gpio = 100, .active_low = 1, .default_trigger = "default-on" },
269         { .name = "soc:blue:fxs2", .gpio = 101, .active_low = 1, .default_trigger = "default-on" },
270         { .name = "soc:blue:wps", .gpio = 102, .active_low = 1, .default_trigger = "default-on" },
271         { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
272         { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" },
273         { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" },
274         { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" },
275         { .name = "soc:blue:internet", .gpio = 108, .active_low = 1, .default_trigger = "default-on" },
276         { .name = "soc:red:internet", .gpio = 109, .active_low = 1, .default_trigger = "default-on" },
277 };
278
279 static struct gpio_led
280 arv4525pw_gpio_leds[] __initdata = {
281         { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
282         { .name = "soc:green:wifi", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
283         { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
284         { .name = "soc:green:fxs-internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
285         { .name = "soc:green:fxs-festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
286 };
287
288 #define ARV4525PW_PHYRESET 13
289 #define ARV4525PW_RELAY    31
290
291 static struct gpio arv4525pw_gpios[] __initdata = {
292         { ARV4525PW_PHYRESET, GPIOF_OUT_INIT_HIGH, "phyreset" },
293         { ARV4525PW_RELAY,    GPIOF_OUT_INIT_HIGH, "relay"    },
294 };
295
296
297 static struct gpio_led
298 arv752dpw22_gpio_leds[] __initdata = {
299         { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
300         { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
301         { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
302         { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
303         { .name = "soc:red:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
304         { .name = "soc:red:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" },
305         { .name = "soc:green:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" },
306         { .name = "soc:green:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" },
307         { .name = "soc:green:wifi1", .gpio = 107, .active_low = 1, .default_trigger = "default-on" },
308         { .name = "soc:blue:wifi", .gpio = 108, .active_low = 1, .default_trigger = "default-on" },
309         { .name = "soc:blue:wifi1", .gpio = 109, .active_low = 1, .default_trigger = "default-on" },
310         { .name = "soc:green:eth1", .gpio = 111, .active_low = 1, .default_trigger = "default-on" },
311         { .name = "soc:green:eth2", .gpio = 112, .active_low = 1, .default_trigger = "default-on" },
312         { .name = "soc:green:eth3", .gpio = 113, .active_low = 1, .default_trigger = "default-on" },
313         { .name = "soc:green:eth4", .gpio = 114, .active_low = 1, .default_trigger = "default-on", },
314 };
315
316 static struct gpio_keys_button
317 arv752dpw22_gpio_keys[] __initdata = {
318         {
319                 .desc           = "btn0",
320                 .type           = EV_KEY,
321                 .code           = BTN_0,
322                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
323                 .gpio           = 12,
324                 .active_low     = 1,
325         },
326         {
327                 .desc           = "btn1",
328                 .type           = EV_KEY,
329                 .code           = BTN_1,
330                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
331                 .gpio           = 13,
332                 .active_low     = 1,
333         },
334         {
335                 .desc           = "btn2",
336                 .type           = EV_KEY,
337                 .code           = BTN_2,
338                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
339                 .gpio           = 28,
340                 .active_low     = 1,
341         },
342 };
343
344 static struct gpio_led
345 arv7518pw_gpio_leds[] __initdata = {
346         { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
347         { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
348         { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
349         { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, },
350         { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
351         { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
352 };
353
354 static struct gpio_keys_button
355 arv7518pw_gpio_keys[] __initdata = {
356         {
357                 .desc           = "reset",
358                 .type           = EV_KEY,
359                 .code           = BTN_0,
360                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
361                 .gpio           = 23,
362                 .active_low     = 1,
363         },
364         {
365                 .desc           = "wifi",
366                 .type           = EV_KEY,
367                 .code           = BTN_1,
368                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
369                 .gpio           = 25,
370                 .active_low     = 1,
371         },
372 };
373
374 static struct gpio_keys_button
375 arv7525pw_gpio_keys[] __initdata = {
376         {
377                 .desc           = "restart",
378                 .type           = EV_KEY,
379                 .code           = BTN_0,
380                 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
381                 .gpio           = 29,
382                 .active_low     = 1,
383         },
384 };
385
386 static void
387 arv45xx_register_ethernet(void)
388 {
389 #define ARV45XX_BRN_MAC                 0x3f0016
390         memcpy_fromio(&ltq_eth_data.mac.sa_data,
391                 (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
392         ltq_register_etop(&ltq_eth_data);
393 }
394
395 static void
396 arv75xx_register_ethernet(void)
397 {
398 #define ARV75XX_BRN_MAC                 0x7f0016
399         memcpy_fromio(&ltq_eth_data.mac.sa_data,
400                 (void *)KSEG1ADDR(LTQ_FLASH_START + ARV75XX_BRN_MAC), 6);
401         ltq_register_etop(&ltq_eth_data);
402 }
403
404 static void
405 bewan_register_ethernet(void)
406 {
407 #define BEWAN_BRN_MAC                   0x3f0014
408         memcpy_fromio(&ltq_eth_data.mac.sa_data,
409                 (void *)KSEG1ADDR(LTQ_FLASH_START + BEWAN_BRN_MAC), 6);
410         ltq_register_etop(&ltq_eth_data);
411 }
412
413 static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
414 static u8 arv45xx_ath5k_eeprom_mac[6];
415
416 void __init
417 arv45xx_register_ath5k(void)
418 {
419 #define ARV45XX_BRN_ATH         0x3f0478
420         int i;
421         static u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
422         u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
423
424         memcpy_fromio(arv45xx_ath5k_eeprom_mac,
425                 (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_MAC), 6);
426         arv45xx_ath5k_eeprom_mac[5]++;
427         memcpy_fromio(arv45xx_ath5k_eeprom_data,
428                 (void *)KSEG1ADDR(LTQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
429         // swap eeprom bytes
430         for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
431                 //arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
432                 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);
433                 if (i == 0xbf>>1){
434                         // printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
435                         /* regdomain is invalid?? how did original fw convert 
436                         * value to 0x82d4 ??
437                         * for now, force to 0x67 */
438                         p[i] &= 0xffff0000;
439                         p[i] |= 0x67;
440                 }
441         }
442 }
443
444 static void __init
445 arv3527p_init(void)
446 {
447         ltq_register_gpio_stp();
448         //ltq_add_device_gpio_leds(arv3527p_gpio_leds, ARRAY_SIZE(arv3527p_gpio_leds));
449         ltq_register_nor(&arv45xx_flash_data);
450         arv45xx_register_ethernet();
451 }
452
453 MIPS_MACHINE(LANTIQ_MACH_ARV3527P,
454                         "ARV3527P",
455                         "ARV3527P - Arcor Easybox 401",
456                         arv3527p_init);
457
458 static void __init
459 arv4510pw_init(void)
460 {
461         ltq_register_gpio_stp();
462         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4510pw_gpio_leds), arv4510pw_gpio_leds);
463         ltq_register_nor(&arv4510_flash_data);
464         ltq_pci_data.irq[12] = (INT_NUM_IM2_IRL0 + 31);
465         ltq_pci_data.irq[15] = (INT_NUM_IM0_IRL0 + 26);
466         ltq_pci_data.gpio |= PCI_EXIN2 | PCI_REQ2;
467         ltq_register_pci(&ltq_pci_data);
468         bewan_register_ethernet();
469 }
470
471 MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
472                         "ARV4510PW",
473                         "ARV4510PW - Wippies Homebox",
474                         arv4510pw_init);
475
476 static void __init
477 arv4518pw_init(void)
478 {
479 #define ARV4518PW_EBU                   0
480 #define ARV4518PW_USB                   14
481 #define ARV4518PW_SWITCH_RESET          13
482 #define ARV4518PW_MADWIFI_ADDR          0xb07f0400
483
484         ltq_register_gpio_ebu(ARV4518PW_EBU);
485         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4518pw_gpio_leds), arv4518pw_gpio_leds);
486         ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
487                                 ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys);
488         ltq_register_nor(&arv45xx_flash_data);
489         ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
490         ltq_register_pci(&ltq_pci_data);
491         ltq_register_madwifi_eep(ARV4518PW_MADWIFI_ADDR);
492         ltq_register_ath5k(arv45xx_ath5k_eeprom_data, arv45xx_ath5k_eeprom_mac);
493         xway_register_dwc(ARV4518PW_USB);
494         arv45xx_register_ethernet();
495
496         gpio_request(ARV4518PW_SWITCH_RESET, "switch");
497         gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
498         gpio_export(ARV4518PW_SWITCH_RESET, 0);
499 }
500
501 MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
502                         "ARV4518PW",
503                         "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
504                         arv4518pw_init);
505
506 static void __init
507 arv4520pw_init(void)
508 {
509 #define ARV4520PW_EBU                   0x400
510 #define ARV4520PW_USB                   28
511 #define ARV4520PW_SWITCH_RESET          110
512
513         ltq_register_gpio_ebu(ARV4520PW_EBU);
514         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4520pw_gpio_leds), arv4520pw_gpio_leds);
515         ltq_register_nor(&arv45xx_flash_data);
516         ltq_register_pci(&ltq_pci_data);
517         ltq_register_tapi();
518         arv45xx_register_ethernet();
519         xway_register_dwc(ARV4520PW_USB);
520
521         gpio_request(ARV4520PW_SWITCH_RESET, "switch");
522         gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
523 }
524
525 MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
526                         "ARV4520PW",
527                         "ARV4520PW - Airties WAV-281, Arcor A800",
528                         arv4520pw_init);
529
530 static void __init
531 arv452Cpw_init(void)
532 {
533 #define ARV452CPW_EBU                   0x77f
534 #define ARV452CPW_USB                   28
535 #define ARV452CPW_RELAY1                31
536 #define ARV452CPW_RELAY2                107
537 #define ARV452CPW_SWITCH_RESET          110
538 #define ARV452CPW_MADWIFI_ADDR          0xb07f0400
539
540         ltq_register_gpio_ebu(ARV452CPW_EBU);
541         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv452cpw_gpio_leds), arv452cpw_gpio_leds);
542         ltq_register_nor(&arv45xx_flash_data);
543         ltq_register_pci(&ltq_pci_data);
544         ltq_register_madwifi_eep(ARV452CPW_MADWIFI_ADDR);
545         xway_register_dwc(ARV452CPW_USB);
546         arv45xx_register_ethernet();
547         arv45xx_register_ath5k();
548
549         gpio_request(ARV452CPW_SWITCH_RESET, "switch");
550         gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
551         gpio_export(ARV452CPW_SWITCH_RESET, 0);
552
553         gpio_request(ARV452CPW_RELAY1, "relay1");
554         gpio_direction_output(ARV452CPW_RELAY1, 1);
555         gpio_export(ARV452CPW_RELAY1, 0);
556
557         gpio_request(ARV452CPW_RELAY2, "relay2");
558         gpio_set_value(ARV452CPW_RELAY2, 1);
559         gpio_export(ARV452CPW_RELAY2, 0);
560 }
561
562 MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
563                         "ARV452CPW",
564                         "ARV452CPW - Arcor A801",
565                         arv452Cpw_init);
566
567 static void __init
568 arv4525pw_init(void)
569 {
570 #define ARV4525PW_MADWIFI_ADDR          0xb03f0400
571         if (ltq_brn_boot)
572                 ltq_register_nor(&arv45xx_brnboot_flash_data);
573         else
574                 ltq_register_nor(&arv45xx_flash_data);
575
576         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
577         gpio_request_array(arv4525pw_gpios, ARRAY_SIZE(arv4525pw_gpios));
578         gpio_export(ARV4525PW_RELAY, false);
579         gpio_export(ARV4525PW_PHYRESET, false);
580         ltq_pci_data.clock = PCI_CLOCK_INT;
581         ltq_register_pci(&ltq_pci_data);
582         ltq_register_madwifi_eep(ARV4525PW_MADWIFI_ADDR);
583         arv45xx_register_ath5k();
584         ltq_register_ath5k(arv45xx_ath5k_eeprom_data, arv45xx_ath5k_eeprom_mac);
585         ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
586         arv45xx_register_ethernet();
587 }
588
589 MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
590                         "ARV4525PW",
591                         "ARV4525PW - Speedport W502V",
592                         arv4525pw_init);
593
594 static void __init
595 arv7525pw_init(void)
596 {
597         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
598         ltq_register_nor(&arv7525_flash_data);
599         ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
600                                 ARRAY_SIZE(arv7525pw_gpio_keys), arv7525pw_gpio_keys);
601         ltq_pci_data.clock = PCI_CLOCK_INT;
602         ltq_pci_data.gpio = PCI_GNT1 | PCI_EXIN1;
603         ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
604         ltq_register_pci(&ltq_pci_data);
605         ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
606         ltq_register_rt2x00("RT2860.eeprom");
607         ltq_register_tapi();
608         arv45xx_register_ethernet();
609 }
610
611 MIPS_MACHINE(LANTIQ_MACH_ARV7525PW,
612                         "ARV7525PW",
613                         "ARV7525PW - Speedport W303V",
614                         arv7525pw_init);
615
616 static void __init
617 arv7518pw_init(void)
618 {
619 #define ARV7518PW_EBU                   0x2
620 #define ARV7518PW_USB                   14
621
622         ltq_register_gpio_ebu(ARV7518PW_EBU);
623         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv7518pw_gpio_leds), arv7518pw_gpio_leds);
624         ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
625                                 ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys);
626         ltq_register_nor(&arv75xx_flash_data);
627         ltq_register_pci(&ltq_pci_data);
628         ltq_register_tapi();
629         xway_register_dwc(ARV7518PW_USB);
630         arv75xx_register_ethernet();
631         //arv7518_register_ath9k(mac);
632 }
633
634 MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
635                         "ARV7518PW",
636                         "ARV7518PW - ASTORIA",
637                         arv7518pw_init);
638
639 static void __init
640 arv752dpw22_init(void)
641 {
642 #define ARV752DPW22_EBU                 0x2
643 #define ARV752DPW22_USB                 100
644 #define ARV752DPW22_RELAY               101
645
646         ltq_register_gpio_ebu(ARV752DPW22_EBU);
647         ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv752dpw22_gpio_leds), arv752dpw22_gpio_leds);
648         ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
649                                 ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
650         ltq_register_nor(&arv75xx_flash_data);
651         ltq_pci_data.irq[15] = (INT_NUM_IM3_IRL0 + 31);
652         ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
653         ltq_register_pci(&ltq_pci_data);
654         xway_register_dwc(ARV752DPW22_USB);
655         arv75xx_register_ethernet();
656
657         gpio_request(ARV752DPW22_RELAY, "relay");
658         gpio_set_value(ARV752DPW22_RELAY, 1);
659         gpio_export(ARV752DPW22_RELAY, 0);
660 }
661
662 MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
663                         "ARV752DPW22",
664                         "ARV752DPW22 - Arcor A803",
665                         arv752dpw22_init);