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