adds 3.3 patches and files
[openwrt/openwrt.git] / target / linux / lantiq / files-3.3 / arch / mips / lantiq / xway / mach-arv.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/ath9k_platform.h>
21 #include <linux/pci.h>
22
23 #include <lantiq_soc.h>
24 #include <lantiq_platform.h>
25 #include <dev-gpio-leds.h>
26 #include <dev-gpio-buttons.h>
27
28 #include "../machtypes.h"
29 #include "dev-wifi-rt2x00.h"
30 #include "dev-wifi-athxk.h"
31 #include "devices.h"
32 #include "dev-dwc_otg.h"
33 #include "pci-ath-fixup.h"
34
35 static struct mtd_partition arv45xx_brnboot_partitions[] =
36 {
37 {
38 .name = "brn-boot",
39 .offset = 0x0,
40 .size = 0x20000,
41 },
42 {
43 .name = "config",
44 .offset = 0x20000,
45 .size = 0x30000,
46 },
47 {
48 .name = "linux",
49 .offset = 0x50000,
50 .size = 0x390000,
51 },
52 {
53 .name = "reserved", /* 12-byte signature at 0x3efff4 :/ */
54 .offset = 0x3e0000,
55 .size = 0x010000,
56 },
57 {
58 .name = "eeprom",
59 .offset = 0x3f0000,
60 .size = 0x10000,
61 },
62 };
63
64 static struct mtd_partition arv75xx_brnboot_partitions[] =
65 {
66 {
67 .name = "brn-boot",
68 .offset = 0x0,
69 .size = 0x20000,
70 },
71 {
72 .name = "config",
73 .offset = 0x20000,
74 .size = 0x40000,
75 },
76 {
77 .name = "linux",
78 .offset = 0x440000,
79 .size = 0x3a0000,
80 },
81 {
82 .name = "reserved", /* 12-byte signature at 0x7efff4 :/ */
83 .offset = 0x7e0000,
84 .size = 0x010000,
85 },
86 {
87 .name = "board_config",
88 .offset = 0x7f0000,
89 .size = 0x10000,
90 },
91 };
92
93 /*
94 * this is generic configuration for all arv based boards, note that it can be
95 * rewriten in arv_load_nor()
96 */
97 static struct mtd_partition arv_partitions[] =
98 {
99 {
100 .name = "uboot",
101 .offset = 0x0,
102 .size = 0x20000,
103 },
104 {
105 .name = "uboot_env",
106 .offset = 0x20000,
107 .size = 0x10000,
108 },
109 {
110 .name = "linux",
111 .offset = 0x30000,
112 .size = 0x3c0000,
113 },
114 {
115 .name = "board_config",
116 .offset = 0x3f0000,
117 .size = 0x10000,
118 },
119 };
120
121 static struct physmap_flash_data arv45xx_brnboot_flash_data = {
122 .nr_parts = ARRAY_SIZE(arv45xx_brnboot_partitions),
123 .parts = arv45xx_brnboot_partitions,
124 };
125
126 static struct physmap_flash_data arv75xx_brnboot_flash_data = {
127 .nr_parts = ARRAY_SIZE(arv75xx_brnboot_partitions),
128 .parts = arv75xx_brnboot_partitions,
129 };
130
131 static struct physmap_flash_data arv_flash_data = {
132 .nr_parts = ARRAY_SIZE(arv_partitions),
133 .parts = arv_partitions,
134 };
135
136 static void arv_load_nor(unsigned int max)
137 {
138 #define UBOOT_MAGIC 0x27051956
139
140 int i;
141 int sector = -1;
142
143 if (ltq_brn_boot) {
144 if (max == 0x800000)
145 ltq_register_nor(&arv75xx_brnboot_flash_data);
146 else
147 ltq_register_nor(&arv45xx_brnboot_flash_data);
148 return;
149 }
150
151 for (i = 1; i < 4 && sector < 0; i++) {
152 unsigned int uboot_magic;
153 memcpy_fromio(&uboot_magic, (void *)KSEG1ADDR(LTQ_FLASH_START) + (i * 0x10000), 4);
154 if (uboot_magic == UBOOT_MAGIC)
155 sector = i;
156 }
157
158 if (sector < 0)
159 return;
160
161 arv_partitions[0].size = arv_partitions[1].offset = (sector - 1) * 0x10000;
162 arv_partitions[2].offset = arv_partitions[0].size + 0x10000;
163 arv_partitions[2].size = max - arv_partitions[2].offset - 0x10000;
164 arv_partitions[3].offset = max - 0x10000;
165 ltq_register_nor(&arv_flash_data);
166 }
167
168 static struct ltq_pci_data ltq_pci_data = {
169 .clock = PCI_CLOCK_EXT,
170 .gpio = PCI_GNT1 | PCI_REQ1,
171 .irq = {
172 [14] = INT_NUM_IM0_IRL0 + 22,
173 },
174 };
175
176 static struct ltq_eth_data ltq_eth_data = {
177 .mii_mode = PHY_INTERFACE_MODE_RMII,
178 };
179
180 static struct gpio_led
181 arv4510pw_gpio_leds[] __initdata = {
182 { .name = "soc:green:foo", .gpio = 4, .active_low = 1, },
183 };
184
185 static struct gpio_led
186 arv4518pw_gpio_leds[] __initdata = {
187 { .name = "soc:green:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
188 { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
189 { .name = "soc:green:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
190 { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
191 { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
192 { .name = "soc:red:fail", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
193 { .name = "soc:green:usb", .gpio = 19, .active_low = 1, .default_trigger = "default-on" },
194 { .name = "soc:green:voip", .gpio = 100, .active_low = 1, .default_trigger = "default-on" },
195 { .name = "soc:green:fxs1", .gpio = 101, .active_low = 1, .default_trigger = "default-on" },
196 { .name = "soc:green:fxs2", .gpio = 102, .active_low = 1, .default_trigger = "default-on" },
197 { .name = "soc:green:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
198 };
199
200 static struct gpio_keys_button
201 arv4518pw_gpio_keys[] __initdata = {
202 {
203 .desc = "wifi",
204 .type = EV_KEY,
205 .code = BTN_0,
206 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
207 .gpio = 28,
208 .active_low = 1,
209 },
210 {
211 .desc = "reset",
212 .type = EV_KEY,
213 .code = BTN_1,
214 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
215 .gpio = 30,
216 .active_low = 1,
217 },
218 {
219 .desc = "wps",
220 .type = EV_KEY,
221 .code = BTN_2,
222 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
223 .gpio = 29,
224 .active_low = 1,
225 },
226 };
227
228 static struct gpio_led
229 arv4519pw_gpio_leds[] __initdata = {
230 { .name = "soc:red:power", .gpio = 7, .active_low = 1, },
231 { .name = "soc:green:power", .gpio = 2, .active_low = 1, .default_trigger = "default-on" },
232 { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, },
233 { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
234 { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
235 { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
236 { .name = "soc:green:voip", .gpio = 100, .active_low = 1, },
237 { .name = "soc:green:phone1", .gpio = 101, .active_low = 1, },
238 { .name = "soc:green:phone2", .gpio = 102, .active_low = 1, },
239 { .name = "soc:green:fxo", .gpio = 103, .active_low = 1, },
240 { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
241 { .name = "soc:orange:wps", .gpio = 104, .active_low = 1, },
242 { .name = "soc:green:wps", .gpio = 105, .active_low = 1, },
243 { .name = "soc:red:wps", .gpio = 106, .active_low = 1, },
244
245 };
246
247 static struct gpio_keys_button
248 arv4519pw_gpio_keys[] __initdata = {
249 {
250 .desc = "reset",
251 .type = EV_KEY,
252 .code = BTN_1,
253 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
254 .gpio = 30,
255 .active_low = 1,
256 },
257 {
258 .desc = "wlan",
259 .type = EV_KEY,
260 .code = BTN_2,
261 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
262 .gpio = 28,
263 .active_low = 1,
264 },
265 };
266
267 static struct gpio_led
268 arv4520pw_gpio_leds[] __initdata = {
269 { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
270 { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
271 { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
272 { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
273 { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, },
274 { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
275 { .name = "soc:blue:voip", .gpio = 100, .active_low = 1, },
276 { .name = "soc:blue:fxs1", .gpio = 101, .active_low = 1, },
277 { .name = "soc:blue:fxs2", .gpio = 102, .active_low = 1, },
278 { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, },
279 { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, },
280 { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, },
281 { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, },
282 };
283
284 static struct gpio_led
285 arv452cpw_gpio_leds[] __initdata = {
286 { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
287 { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
288 { .name = "soc:blue:isdn", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
289 { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
290 { .name = "soc:yellow:wps", .gpio = 7, .active_low = 1, .default_trigger = "default-on" },
291 { .name = "soc:red:wps", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
292 { .name = "soc:blue:fxs1", .gpio = 100, .active_low = 1, .default_trigger = "default-on" },
293 { .name = "soc:blue:fxs2", .gpio = 101, .active_low = 1, .default_trigger = "default-on" },
294 { .name = "soc:blue:wps", .gpio = 102, .active_low = 1, .default_trigger = "default-on" },
295 { .name = "soc:blue:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
296 { .name = "soc:blue:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" },
297 { .name = "soc:blue:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" },
298 { .name = "soc:blue:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" },
299 { .name = "soc:blue:internet", .gpio = 108, .active_low = 1, .default_trigger = "default-on" },
300 { .name = "soc:red:internet", .gpio = 109, .active_low = 1, .default_trigger = "default-on" },
301 };
302
303 static struct gpio_led
304 arv4525pw_gpio_leds[] __initdata = {
305 { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
306 { .name = "soc:green:wifi", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
307 { .name = "soc:green:online", .gpio = 9, .active_low = 1, .default_trigger = "default-on" },
308 { .name = "soc:green:fxs-internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
309 { .name = "soc:green:fxs-festnetz", .gpio = 4, .active_low = 1, .default_trigger = "default-on" },
310 };
311
312 #define ARV4525PW_PHYRESET 13
313 #define ARV4525PW_RELAY 31
314
315 static struct gpio arv4525pw_gpios[] __initdata = {
316 { ARV4525PW_PHYRESET, GPIOF_OUT_INIT_HIGH, "phyreset" },
317 { ARV4525PW_RELAY, GPIOF_OUT_INIT_HIGH, "relay" },
318 };
319
320
321 static struct gpio_led
322 arv752dpw22_gpio_leds[] __initdata = {
323 { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
324 { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
325 { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
326 { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
327 { .name = "soc:red:fxo", .gpio = 103, .active_low = 1, .default_trigger = "default-on" },
328 { .name = "soc:red:voice", .gpio = 104, .active_low = 1, .default_trigger = "default-on" },
329 { .name = "soc:green:usb", .gpio = 105, .active_low = 1, .default_trigger = "default-on" },
330 { .name = "soc:green:wifi", .gpio = 106, .active_low = 1, .default_trigger = "default-on" },
331 { .name = "soc:green:wifi1", .gpio = 107, .active_low = 1, .default_trigger = "default-on" },
332 { .name = "soc:blue:wifi", .gpio = 108, .active_low = 1, .default_trigger = "default-on" },
333 { .name = "soc:blue:wifi1", .gpio = 109, .active_low = 1, .default_trigger = "default-on" },
334 { .name = "soc:green:eth1", .gpio = 111, .active_low = 1, .default_trigger = "default-on" },
335 { .name = "soc:green:eth2", .gpio = 112, .active_low = 1, .default_trigger = "default-on" },
336 { .name = "soc:green:eth3", .gpio = 113, .active_low = 1, .default_trigger = "default-on" },
337 { .name = "soc:green:eth4", .gpio = 114, .active_low = 1, .default_trigger = "default-on", },
338 };
339
340 static struct gpio_keys_button
341 arv752dpw22_gpio_keys[] __initdata = {
342 {
343 .desc = "btn0",
344 .type = EV_KEY,
345 .code = BTN_0,
346 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
347 .gpio = 12,
348 .active_low = 1,
349 },
350 {
351 .desc = "btn1",
352 .type = EV_KEY,
353 .code = BTN_1,
354 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
355 .gpio = 13,
356 .active_low = 1,
357 },
358 {
359 .desc = "btn2",
360 .type = EV_KEY,
361 .code = BTN_2,
362 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
363 .gpio = 28,
364 .active_low = 1,
365 },
366 };
367
368 static struct gpio_led
369 arv7518pw_gpio_leds[] __initdata = {
370 { .name = "soc:red:power", .gpio = 7, .active_low = 1, },
371 { .name = "soc:green:power", .gpio = 2, .active_low = 1, .default_trigger = "default-on" },
372 { .name = "soc:green:wifi", .gpio = 6, .active_low = 1, },
373 { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
374 { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
375 { .name = "soc:red:internet", .gpio = 8, .active_low = 1, },
376 { .name = "soc:green:voip", .gpio = 100, .active_low = 1, },
377 { .name = "soc:green:phone1", .gpio = 101, .active_low = 1, },
378 { .name = "soc:green:phone2", .gpio = 102, .active_low = 1, },
379 { .name = "soc:orange:fail", .gpio = 103, .active_low = 1, },
380 { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
381 { .name = "soc:orange:wps", .gpio = 104, .active_low = 1, },
382 { .name = "soc:green:wps", .gpio = 105, .active_low = 1, },
383 { .name = "soc:red:wps", .gpio = 106, .active_low = 1, },
384
385 };
386
387 static struct gpio_keys_button
388 arv7518pw_gpio_keys[] __initdata = {
389 /*{
390 .desc = "reset",
391 .type = EV_KEY,
392 .code = BTN_1,
393 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
394 .gpio = 23,
395 .active_low = 1,
396 },*/
397 {
398 .desc = "wifi",
399 .type = EV_KEY,
400 .code = BTN_2,
401 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
402 .gpio = 25,
403 .active_low = 1,
404 },
405 };
406
407 static struct gpio_keys_button
408 arv7525pw_gpio_keys[] __initdata = {
409 {
410 .desc = "restart",
411 .type = EV_KEY,
412 .code = BTN_0,
413 .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
414 .gpio = 29,
415 .active_low = 1,
416 },
417 };
418
419 static void
420 arv_register_ethernet(unsigned int mac_addr)
421 {
422 memcpy_fromio(&ltq_eth_data.mac.sa_data,
423 (void *)KSEG1ADDR(LTQ_FLASH_START + mac_addr), 6);
424 ltq_register_etop(&ltq_eth_data);
425 }
426
427 static u16 arv_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
428 static u16 arv_ath9k_eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
429 static u8 arv_athxk_eeprom_mac[6];
430
431 void __init
432 arv_register_ath5k(unsigned int ath_addr, unsigned int mac_addr)
433 {
434 int i;
435
436 memcpy_fromio(arv_athxk_eeprom_mac,
437 (void *)KSEG1ADDR(LTQ_FLASH_START + mac_addr), 6);
438 arv_athxk_eeprom_mac[5]++;
439 memcpy_fromio(arv_ath5k_eeprom_data,
440 (void *)KSEG1ADDR(LTQ_FLASH_START + ath_addr), ATH5K_PLAT_EEP_MAX_WORDS);
441 // swap eeprom bytes
442 for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++) {
443 arv_ath5k_eeprom_data[i] = swab16(arv_ath5k_eeprom_data[i]);
444 if (i == 0x17e>>1) {
445 /*
446 * regdomain is invalid. it's unknown how did original
447 * fw convered value to 0x82d4 so for now force to 0x67
448 */
449 arv_ath5k_eeprom_data[i] &= 0x0000;
450 arv_ath5k_eeprom_data[i] |= 0x67;
451 }
452 }
453 }
454
455 void __init
456 arv_register_ath9k(unsigned int ath_addr, unsigned int mac_addr)
457 {
458 int i;
459 u16 *eepdata, sum, el;
460
461 memcpy_fromio(arv_athxk_eeprom_mac,
462 (void *)KSEG1ADDR(LTQ_FLASH_START + mac_addr), 6);
463 arv_athxk_eeprom_mac[5]++;
464 memcpy_fromio(arv_ath9k_eeprom_data,
465 (void *)KSEG1ADDR(LTQ_FLASH_START + ath_addr), ATH9K_PLAT_EEP_MAX_WORDS);
466
467 // force regdomain to 0x67
468 arv_ath9k_eeprom_data[0x208>>1] = 0x67;
469
470 // calculate new checksum
471 sum = arv_ath9k_eeprom_data[0x200>>1];
472 el = sum / sizeof(u16) - 2; /* skip length and (old) checksum */
473 eepdata = (u16 *) (&arv_ath9k_eeprom_data[0x204>>1]); /* after checksum */
474 for (i = 0; i < el; i++)
475 sum ^= *eepdata++;
476 sum ^= 0xffff;
477 arv_ath9k_eeprom_data[0x202>>1] = sum;
478 }
479
480 static void __init
481 arv3527p_init(void)
482 {
483 #define ARV3527P_MAC_ADDR 0x3f0016
484
485 ltq_register_gpio_stp();
486 //ltq_add_device_gpio_leds(arv3527p_gpio_leds, ARRAY_SIZE(arv3527p_gpio_leds));
487 arv_load_nor(0x400000);
488 arv_register_ethernet(ARV3527P_MAC_ADDR);
489 }
490
491 MIPS_MACHINE(LANTIQ_MACH_ARV3527P,
492 "ARV3527P",
493 "ARV3527P - Arcor Easybox 401",
494 arv3527p_init);
495
496 static void __init
497 arv4510pw_init(void)
498 {
499 #define ARV4510PW_MAC_ADDR 0x3f0014
500
501 ltq_register_gpio_stp();
502 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4510pw_gpio_leds), arv4510pw_gpio_leds);
503 arv_load_nor(0x400000);
504 ltq_pci_data.irq[12] = (INT_NUM_IM2_IRL0 + 31);
505 ltq_pci_data.irq[15] = (INT_NUM_IM0_IRL0 + 26);
506 ltq_pci_data.gpio |= PCI_EXIN2 | PCI_REQ2;
507 ltq_register_pci(&ltq_pci_data);
508 arv_register_ethernet(ARV4510PW_MAC_ADDR);
509 }
510
511 MIPS_MACHINE(LANTIQ_MACH_ARV4510PW,
512 "ARV4510PW",
513 "ARV4510PW - Wippies Homebox",
514 arv4510pw_init);
515
516 static void __init
517 arv4518pw_init(void)
518 {
519 #define ARV4518PW_EBU 0
520 #define ARV4518PW_USB 14
521 #define ARV4518PW_SWITCH_RESET 13
522 #define ARV4518PW_ATH_ADDR 0x3f0400
523 #define ARV4518PW_MADWIFI_ADDR 0xb03f0400
524 #define ARV4518PW_MAC_ADDR 0x3f0016
525
526 ltq_register_gpio_ebu(ARV4518PW_EBU);
527 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4518pw_gpio_leds), arv4518pw_gpio_leds);
528 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
529 ARRAY_SIZE(arv4518pw_gpio_keys), arv4518pw_gpio_keys);
530 arv_load_nor(0x400000);
531 ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
532 ltq_register_pci(&ltq_pci_data);
533 xway_register_dwc(ARV4518PW_USB);
534 arv_register_ethernet(ARV4518PW_MAC_ADDR);
535 arv_register_ath5k(ARV4518PW_ATH_ADDR, ARV4518PW_MAC_ADDR);
536 ltq_register_ath5k(arv_ath5k_eeprom_data, arv_athxk_eeprom_mac);
537
538 gpio_request(ARV4518PW_SWITCH_RESET, "switch");
539 gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
540 gpio_export(ARV4518PW_SWITCH_RESET, 0);
541 }
542
543 MIPS_MACHINE(LANTIQ_MACH_ARV4518PW,
544 "ARV4518PW",
545 "ARV4518PW - SMC7908A-ISP, Airties WAV-221",
546 arv4518pw_init);
547
548 static void __init
549 arv4519pw_init(void)
550 {
551 #define ARV4519PW_EBU 0
552 #define ARV4519PW_USB 14
553 #define ARV4519PW_RELAY 31
554 #define ARV4519PW_SWITCH_RESET 13
555 #define ARV4519PW_ATH_ADDR 0x3f0400
556 #define ARV4519PW_MAC_ADDR 0x3f0016
557
558 arv_load_nor(0x400000);
559 ltq_register_gpio_ebu(ARV4519PW_EBU);
560 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4519pw_gpio_leds), arv4519pw_gpio_leds);
561 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
562 ARRAY_SIZE(arv4519pw_gpio_keys), arv4519pw_gpio_keys);
563 ltq_pci_data.gpio = PCI_GNT2 | PCI_REQ1;
564 ltq_register_pci(&ltq_pci_data);
565 xway_register_dwc(ARV4519PW_USB);
566 arv_register_ethernet(ARV4519PW_MAC_ADDR);
567 arv_register_ath5k(ARV4519PW_ATH_ADDR, ARV4519PW_MAC_ADDR);
568 ltq_register_ath5k(arv_ath5k_eeprom_data, arv_athxk_eeprom_mac);
569
570 gpio_request(ARV4519PW_RELAY, "relay");
571 gpio_direction_output(ARV4519PW_RELAY, 1);
572 gpio_export(ARV4519PW_RELAY, 0);
573
574 gpio_request(ARV4519PW_SWITCH_RESET, "switch");
575 gpio_set_value(ARV4519PW_SWITCH_RESET, 1);
576 gpio_export(ARV4519PW_SWITCH_RESET, 0);
577 }
578
579 MIPS_MACHINE(LANTIQ_MACH_ARV4519PW,
580 "ARV4519PW",
581 "ARV4519PW - Vodafone, Pirelli",
582 arv4519pw_init);
583
584 static void __init
585 arv4520pw_init(void)
586 {
587 #define ARV4520PW_EBU 0x400
588 #define ARV4520PW_USB 28
589 #define ARV4520PW_SWITCH_RESET 110
590 #define ARV4520PW_MAC_ADDR 0x3f0016
591
592 ltq_register_gpio_ebu(ARV4520PW_EBU);
593 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4520pw_gpio_leds), arv4520pw_gpio_leds);
594 arv_load_nor(0x400000);
595 ltq_register_pci(&ltq_pci_data);
596 ltq_register_tapi();
597 arv_register_ethernet(ARV4520PW_MAC_ADDR);
598 xway_register_dwc(ARV4520PW_USB);
599
600 gpio_request(ARV4520PW_SWITCH_RESET, "switch");
601 gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
602 }
603
604 MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
605 "ARV4520PW",
606 "ARV4520PW - Airties WAV-281, Arcor A800",
607 arv4520pw_init);
608
609 static void __init
610 arv452Cpw_init(void)
611 {
612 #define ARV452CPW_EBU 0x77f
613 #define ARV452CPW_USB 28
614 #define ARV452CPW_RELAY1 31
615 #define ARV452CPW_RELAY2 107
616 #define ARV452CPW_SWITCH_RESET 110
617 #define ARV452CPW_ATH_ADDR 0x3f0400
618 #define ARV452CPW_MADWIFI_ADDR 0xb03f0400
619 #define ARV452CPW_MAC_ADDR 0x3f0016
620
621 ltq_register_gpio_ebu(ARV452CPW_EBU);
622 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv452cpw_gpio_leds), arv452cpw_gpio_leds);
623 arv_load_nor(0x400000);
624 ltq_register_pci(&ltq_pci_data);
625 xway_register_dwc(ARV452CPW_USB);
626 arv_register_ethernet(ARV452CPW_MAC_ADDR);
627 arv_register_ath5k(ARV452CPW_ATH_ADDR, ARV452CPW_MAC_ADDR);
628 ltq_register_ath5k(arv_ath5k_eeprom_data, arv_athxk_eeprom_mac);
629
630 gpio_request(ARV452CPW_SWITCH_RESET, "switch");
631 gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
632 gpio_export(ARV452CPW_SWITCH_RESET, 0);
633
634 gpio_request(ARV452CPW_RELAY1, "relay1");
635 gpio_direction_output(ARV452CPW_RELAY1, 1);
636 gpio_export(ARV452CPW_RELAY1, 0);
637
638 gpio_request(ARV452CPW_RELAY2, "relay2");
639 gpio_set_value(ARV452CPW_RELAY2, 1);
640 gpio_export(ARV452CPW_RELAY2, 0);
641 }
642
643 MIPS_MACHINE(LANTIQ_MACH_ARV452CPW,
644 "ARV452CPW",
645 "ARV452CPW - Arcor A801",
646 arv452Cpw_init);
647
648 static void __init
649 arv4525pw_init(void)
650 {
651 #define ARV4525PW_ATH_ADDR 0x3f0400
652 #define ARV4525PW_MADWIFI_ADDR 0xb03f0400
653 #define ARV4525PW_MAC_ADDR 0x3f0016
654
655 arv_load_nor(0x400000);
656 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
657 gpio_request_array(arv4525pw_gpios, ARRAY_SIZE(arv4525pw_gpios));
658 gpio_export(ARV4525PW_RELAY, false);
659 gpio_export(ARV4525PW_PHYRESET, false);
660 ltq_pci_data.clock = PCI_CLOCK_INT;
661 ltq_register_pci(&ltq_pci_data);
662 arv_register_ath5k(ARV4525PW_ATH_ADDR, ARV4525PW_MADWIFI_ADDR);
663 ltq_register_ath5k(arv_ath5k_eeprom_data, arv_athxk_eeprom_mac);
664 ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
665 arv_register_ethernet(ARV4525PW_MAC_ADDR);
666 }
667
668 MIPS_MACHINE(LANTIQ_MACH_ARV4525PW,
669 "ARV4525PW",
670 "ARV4525PW - Speedport W502V",
671 arv4525pw_init);
672
673 static void __init
674 arv7525pw_init(void)
675 {
676 #define ARV7525P_MAC_ADDR 0x3f0016
677
678 arv_load_nor(0x400000);
679 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
680 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
681 ARRAY_SIZE(arv7525pw_gpio_keys), arv7525pw_gpio_keys);
682 ltq_pci_data.clock = PCI_CLOCK_INT;
683 ltq_pci_data.gpio = PCI_GNT1 | PCI_EXIN1;
684 ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
685 ltq_register_pci(&ltq_pci_data);
686 ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
687 ltq_register_rt2x00("RT2860.eeprom");
688 ltq_register_tapi();
689 arv_register_ethernet(ARV7525P_MAC_ADDR);
690 }
691
692 MIPS_MACHINE(LANTIQ_MACH_ARV7525PW,
693 "ARV7525PW",
694 "ARV7525PW - Speedport W303V",
695 arv7525pw_init);
696
697 static void __init
698 arv7518pw_init(void)
699 {
700 #define ARV7518PW_EBU 0x2
701 #define ARV7518PW_USB 14
702 #define ARV7518PW_SWITCH_RESET 13
703 #define ARV7518PW_ATH_ADDR 0x7f0400
704 #define ARV7518PW_MAC_ADDR 0x7f0016
705
706 arv_load_nor(0x800000);
707 ltq_register_gpio_ebu(ARV7518PW_EBU);
708 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv7518pw_gpio_leds), arv7518pw_gpio_leds);
709 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
710 ARRAY_SIZE(arv7518pw_gpio_keys), arv7518pw_gpio_keys);
711 ltq_register_pci(&ltq_pci_data);
712 ltq_register_tapi();
713 xway_register_dwc(ARV7518PW_USB);
714 arv_register_ethernet(ARV7518PW_MAC_ADDR);
715 arv_register_ath9k(ARV7518PW_ATH_ADDR, ARV7518PW_MAC_ADDR);
716 ltq_register_ath9k(arv_ath9k_eeprom_data, arv_athxk_eeprom_mac);
717 ltq_pci_ath_fixup(14, arv_ath9k_eeprom_data);
718
719 gpio_request(ARV7518PW_SWITCH_RESET, "switch");
720 gpio_direction_output(ARV7518PW_SWITCH_RESET, 1);
721 gpio_export(ARV7518PW_SWITCH_RESET, 0);
722 }
723
724 MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
725 "ARV7518PW",
726 "ARV7518PW - ASTORIA",
727 arv7518pw_init);
728
729 static void __init
730 arv752dpw22_init(void)
731 {
732 #define ARV752DPW22_EBU 0x2
733 #define ARV752DPW22_USB 100
734 #define ARV752DPW22_RELAY 101
735 #define ARV752DPW22_MAC_ADDR 0x7f0016
736
737 arv_load_nor(0x800000);
738 ltq_register_gpio_ebu(ARV752DPW22_EBU);
739 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv752dpw22_gpio_leds), arv752dpw22_gpio_leds);
740 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL,
741 ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
742 ltq_pci_data.irq[15] = (INT_NUM_IM3_IRL0 + 31);
743 ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
744 ltq_register_pci(&ltq_pci_data);
745 xway_register_dwc(ARV752DPW22_USB);
746 arv_register_ethernet(ARV752DPW22_MAC_ADDR);
747
748 gpio_request(ARV752DPW22_RELAY, "relay");
749 gpio_set_value(ARV752DPW22_RELAY, 1);
750 gpio_export(ARV752DPW22_RELAY, 0);
751 }
752
753 MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
754 "ARV752DPW22",
755 "ARV752DPW22 - Arcor A803",
756 arv752dpw22_init);
757
758 static void __init
759 arv752dpw_init(void)
760 {
761 #define ARV752DPW22_EBU 0x2
762 #define ARV752DPW22_USB 100
763 #define ARV752DPW22_RELAY 101
764 #define ARV752DPW22_MAC_ADDR 0x7f0016
765
766 arv_load_nor(0x800000);
767 ltq_register_gpio_ebu(ARV752DPW22_EBU);
768 ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv752dpw22_gpio_leds), arv752dpw22_gpio_leds);
769 ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(arv752dpw22_gpio_keys), arv752dpw22_gpio_keys);
770 ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
771 ltq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
772 ltq_register_pci(&ltq_pci_data);
773 xway_register_dwc(ARV752DPW22_USB);
774 ltq_register_rt2x00("RT2860.eeprom");
775 arv_register_ethernet(ARV752DPW22_MAC_ADDR);
776 gpio_request(ARV752DPW22_RELAY, "relay");
777 gpio_set_value(ARV752DPW22_RELAY, 1);
778 gpio_export(ARV752DPW22_RELAY, 0);
779
780 }
781
782 MIPS_MACHINE(LANTIQ_MACH_ARV752DPW,
783 "ARV752DPW",
784 "ARV752DPW - Arcor A802",
785 arv752dpw_init);