[lantiq] adds machtype for ARV7518PW
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches / 400-mach-arv45xx.patch
1 --- a/arch/mips/include/asm/mach-lantiq/machine.h
2 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
3 @@ -11,4 +11,9 @@
4 LANTIQ_MACH_EASY4010, /* Twinpass evalkit */
5 LANTIQ_MACH_EASY50712, /* Danube evalkit */
6 LANTIQ_MACH_EASY50812, /* AR9 eval board */
7 + LANTIQ_MACH_ARV4518, /* Airties WAV-221, SMC-7908A-ISP */
8 + LANTIQ_MACH_ARV452, /* Airties WAV-281, Arcor EasyboxA800 */
9 + LANTIQ_MACH_ARV4525, /* Speedport W502V */
10 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
11 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
12 };
13 --- a/arch/mips/lantiq/xway/Kconfig
14 +++ b/arch/mips/lantiq/xway/Kconfig
15 @@ -14,6 +14,10 @@
16 bool "Easy4010"
17 default y
18
19 +config LANTIQ_MACH_ARV45XX
20 + bool "ARV45XX"
21 + default y
22 +
23 endmenu
24
25 endif
26 --- a/arch/mips/lantiq/xway/Makefile
27 +++ b/arch/mips/lantiq/xway/Makefile
28 @@ -3,3 +3,4 @@
29 obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
30 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
31 obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
32 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
33 --- /dev/null
34 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
35 @@ -0,0 +1,299 @@
36 +/*
37 + * This program is free software; you can redistribute it and/or modify it
38 + * under the terms of the GNU General Public License version 2 as published
39 + * by the Free Software Foundation.
40 + *
41 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
42 + */
43 +
44 +#include <linux/init.h>
45 +#include <linux/platform_device.h>
46 +#include <linux/leds.h>
47 +#include <linux/gpio.h>
48 +#include <linux/gpio_buttons.h>
49 +#include <linux/mtd/mtd.h>
50 +#include <linux/mtd/partitions.h>
51 +#include <linux/mtd/physmap.h>
52 +#include <linux/input.h>
53 +#include <linux/etherdevice.h>
54 +
55 +#include <machine.h>
56 +
57 +#include <xway.h>
58 +#include <lantiq_platform.h>
59 +
60 +#include "devices.h"
61 +
62 +#define ARV452_LATCH_SWITCH (1 << 10)
63 +#define ARV752DPW22_LATCH_DEFAULT (2)
64 +
65 +#ifdef CONFIG_MTD_PARTITIONS
66 +static struct mtd_partition arv45xx_partitions[] =
67 +{
68 + {
69 + .name = "uboot",
70 + .offset = 0x0,
71 + .size = 0x20000,
72 + },
73 + {
74 + .name = "uboot_env",
75 + .offset = 0x20000,
76 + .size = 0x10000,
77 + },
78 + {
79 + .name = "linux",
80 + .offset = 0x30000,
81 + .size = 0x3c0000,
82 + },
83 + {
84 + .name = "board_config",
85 + .offset = 0x3f0000,
86 + .size = 0x10000,
87 + },
88 +};
89 +#endif
90 +
91 +static struct physmap_flash_data arv45xx_flash_data = {
92 +#ifdef CONFIG_MTD_PARTITIONS
93 + .nr_parts = ARRAY_SIZE(arv45xx_partitions),
94 + .parts = arv45xx_partitions,
95 +#endif
96 +};
97 +
98 +static struct mtd_partition arv75xx_partitions[] =
99 +{
100 + {
101 + .name = "uboot",
102 + .offset = 0x0,
103 + .size = 0x40000,
104 + },
105 + {
106 + .name = "uboot_env",
107 + .offset = 0x40000,
108 + .size = 0x10000,
109 + },
110 + {
111 + .name = "linux",
112 + .offset = 0x50000,
113 + .size = 0x7a0000,
114 + },
115 + {
116 + .name = "board_config",
117 + .offset = 0x7f0000,
118 + .size = 0x10000,
119 + },
120 +};
121 +
122 +static struct physmap_flash_data arv75xx_flash_data = {
123 +#ifdef CONFIG_MTD_PARTITIONS
124 + .nr_parts = ARRAY_SIZE(arv75xx_partitions),
125 + .parts = arv75xx_partitions,
126 +#endif
127 +};
128 +
129 +static struct lq_pci_data lq_pci_data = {
130 + .clock = PCI_CLOCK_EXT,
131 + .gpio = PCI_GNT1 | PCI_REQ1,
132 + .irq = {
133 + [14] = INT_NUM_IM0_IRL0 + 22,
134 + },
135 +};
136 +
137 +static struct lq_eth_data lq_eth_data = {
138 + .mii_mode = REV_MII_MODE,
139 + .mac = "\xff\xff\xff\xff\xff\xff",
140 +};
141 +
142 +static struct gpio_led
143 +arv4518_leds_gpio[] __initdata = {
144 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
145 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
146 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
147 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
148 + { .name = "soc:yello:wps", .gpio = 7, .active_low = 1, },
149 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
150 + { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
151 + { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
152 + { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
153 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
154 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
155 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
156 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
157 +};
158 +
159 +static struct gpio_led
160 +arv452_leds_gpio[] __initdata = {
161 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
162 + { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
163 + { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
164 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
165 + { .name = "soc:yello:wps", .gpio = 7, .active_low = 1, },
166 + { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
167 + { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
168 + { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
169 + { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
170 + { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
171 + { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
172 + { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
173 + { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
174 +};
175 +
176 +static struct gpio_led arv4525_leds_gpio[] __initdata = {
177 + { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, },
178 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
179 + { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, },
180 + { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, },
181 + { .name = "soc:green:online", .gpio = 9, .active_low = 1, },
182 +};
183 +
184 +static struct gpio_led
185 +arv752dpw22_leds_gpio[] __initdata = {
186 + { .name = "soc:blue:power", .gpio = 3, .active_low = 1, .default_trigger = "default-on" },
187 + { .name = "soc:red:internet", .gpio = 5, .active_low = 1, .default_trigger = "default-on" },
188 + { .name = "soc:red:power", .gpio = 6, .active_low = 1, .default_trigger = "default-on" },
189 + { .name = "soc:red:wps", .gpio = 8, .active_low = 1, .default_trigger = "default-on" },
190 + { .name = "soc:red:fxo", .gpio = 35, .active_low = 1, .default_trigger = "default-on" },
191 + { .name = "soc:red:voice", .gpio = 36, .active_low = 1, .default_trigger = "default-on" },
192 + { .name = "soc:green:usb", .gpio = 37, .active_low = 1, .default_trigger = "default-on" },
193 + { .name = "soc:green:wlan", .gpio = 38, .active_low = 1, .default_trigger = "default-on" },
194 + { .name = "soc:green:wlan1", .gpio = 39, .active_low = 1, .default_trigger = "default-on" },
195 + { .name = "soc:blue:wlan", .gpio = 40, .active_low = 1, .default_trigger = "default-on" },
196 + { .name = "soc:blue:wlan1", .gpio = 41, .active_low = 1, .default_trigger = "default-on" },
197 + { .name = "soc:green:eth1", .gpio = 43, .active_low = 1, .default_trigger = "default-on" },
198 + { .name = "soc:green:eth2", .gpio = 44, .active_low = 1, .default_trigger = "default-on" },
199 + { .name = "soc:green:eth3", .gpio = 45, .active_low = 1, .default_trigger = "default-on" },
200 + { .name = "soc:green:eth4", .gpio = 46, .active_low = 1, .default_trigger = "default-on", },
201 +};
202 +
203 +static struct gpio_led
204 +arv7518pw_leds_gpio[] __initdata = {
205 + { .name = "soc:green:power", .gpio = 2, .active_low = 1, },
206 + { .name = "soc:green:adsl", .gpio = 4, .active_low = 1, },
207 + { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
208 + { .name = "soc:green:wlan", .gpio = 6, .active_low = 1, },
209 + { .name = "sco:red:internet", .gpio = 8, .active_low = 1, },
210 + { .name = "soc:green:usb", .gpio = 19, .active_low = 1, },
211 +};
212 +
213 +static void
214 +arv45xx_register_ethernet(void)
215 +{
216 +#define ARV45XX_BRN_MAC 0x3f0016
217 + memcpy_fromio(lq_eth_data.mac,
218 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
219 + lq_register_ethernet(&lq_eth_data);
220 +}
221 +
222 +static void
223 +arv75xx_register_ethernet(void)
224 +{
225 +#define ARV75XX_BRN_MAC 0x7f0016
226 + memcpy_fromio(lq_eth_data.mac,
227 + (void *)KSEG1ADDR(LQ_FLASH_START + ARV75XX_BRN_MAC), 6);
228 + lq_register_ethernet(&lq_eth_data);
229 +}
230 +
231 +static void __init
232 +arv4518_init(void)
233 +{
234 + lq_register_gpio();
235 + lq_register_gpio_ebu(0);
236 + lq_register_gpio_leds(arv4518_leds_gpio, ARRAY_SIZE(arv4518_leds_gpio));
237 + lq_register_asc(0);
238 + lq_register_asc(1);
239 + lq_register_nor(&arv45xx_flash_data);
240 + lq_register_pci(&lq_pci_data);
241 + lq_register_wdt();
242 + arv45xx_register_ethernet();
243 +}
244 +
245 +MIPS_MACHINE(LANTIQ_MACH_ARV4518,
246 + "ARV4518",
247 + "ARV4518 - SMC7908A-ISP",
248 + arv4518_init);
249 +
250 +static void __init
251 +arv452_init(void)
252 +{
253 + lq_register_gpio();
254 + lq_register_gpio_ebu(ARV452_LATCH_SWITCH);
255 + lq_register_gpio_leds(arv452_leds_gpio, ARRAY_SIZE(arv452_leds_gpio));
256 + lq_register_asc(0);
257 + lq_register_asc(1);
258 + lq_register_nor(&arv45xx_flash_data);
259 + lq_register_pci(&lq_pci_data);
260 + lq_register_wdt();
261 + arv45xx_register_ethernet();
262 +}
263 +
264 +MIPS_MACHINE(LANTIQ_MACH_ARV452,
265 + "ARV452",
266 + "ARV452 - Airties WAV-281, Arcor A800",
267 + arv452_init);
268 +
269 +static void __init
270 +arv4525_init(void)
271 +{
272 + lq_register_gpio();
273 + lq_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio));
274 + lq_register_asc(0);
275 + lq_register_asc(1);
276 + lq_register_nor(&arv45xx_flash_data);
277 + lq_register_pci(&lq_pci_data);
278 + lq_register_wdt();
279 + lq_eth_data.mii_mode = MII_MODE;
280 + arv45xx_register_ethernet();
281 +}
282 +
283 +MIPS_MACHINE(LANTIQ_MACH_ARV4525,
284 + "ARV4525",
285 + "ARV4525 - Speedport W502V",
286 + arv4525_init);
287 +
288 +
289 +static void __init
290 +arv7518pw_init(void)
291 +{
292 + lq_register_gpio();
293 + lq_register_gpio_ebu(ARV452_LATCH_SWITCH);
294 + lq_register_asc(0);
295 + lq_register_asc(1);
296 + lq_register_gpio_leds(arv7518pw_leds_gpio, ARRAY_SIZE(arv7518pw_leds_gpio));
297 + lq_register_nor(&arv75xx_flash_data);
298 + lq_register_pci(&lq_pci_data);
299 + lq_register_wdt();
300 + arv75xx_register_ethernet();
301 + //arv7518_register_ath9k(mac);
302 +}
303 +
304 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
305 + "ARV7518PW",
306 + "ARV7518PW - ASTORIA",
307 + arv7518pw_init);
308 +
309 +static void __init
310 +arv752dpw22_init(void)
311 +{
312 + lq_register_gpio();
313 + lq_register_gpio_ebu(ARV752DPW22_LATCH_DEFAULT);
314 + lq_register_asc(0);
315 + lq_register_asc(1);
316 + lq_register_gpio_leds(arv752dpw22_leds_gpio, ARRAY_SIZE(arv752dpw22_leds_gpio));
317 + lq_register_nor(&arv75xx_flash_data);
318 + lq_pci_data.irq[15] = (INT_NUM_IM2_IRL0 + 31);
319 + lq_pci_data.gpio |= PCI_EXIN1 | PCI_REQ2;
320 + lq_register_pci(&lq_pci_data);
321 + lq_register_wdt();
322 + arv75xx_register_ethernet();
323 + gpio_request(32, "usb-power");
324 + gpio_direction_output(32, 0);
325 + mdelay(1);
326 + __gpio_set_value(32, 1);
327 + gpio_request(33, "relay");
328 + gpio_direction_output(33, 1);
329 +}
330 +
331 +MIPS_MACHINE(LANTIQ_MACH_ARV752DPW22,
332 + "ARV752DPW22",
333 + "ARV752DPW22 - Arcor A803",
334 + arv752dpw22_init);