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