c964488322bbe6d58a75c106518e583fb2565ce4
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.3 / 206-machtypes.patch
1 --- a/arch/mips/lantiq/machtypes.h
2 +++ b/arch/mips/lantiq/machtypes.h
3 @@ -20,6 +20,36 @@ enum lantiq_mach_type {
4 LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
5 LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
6 LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
7 + LANTIQ_MACH_EASY98020, /* EASY98020 Eval Board */
8 + LANTIQ_MACH_EASY98020_1LAN, /* EASY98020 Eval Board (1 LAN port) */
9 + LANTIQ_MACH_EASY98020_2LAN, /* EASY98020 Eval Board (2 LAN port) */
10 + LANTIQ_MACH_95C3AM1, /* 95C3AM1 Eval Board */
11 +
12 + /* Arcadyan */
13 + LANTIQ_MACH_ARV3527P, /* Arcor easybox a401 */
14 + LANTIQ_MACH_ARV4510PW, /* Wippies Homebox */
15 + LANTIQ_MACH_ARV4518PW, /* Airties WAV-221, SMC-7908A-ISP */
16 + LANTIQ_MACH_ARV4519PW, /* Vodafone, Pirelli */
17 + LANTIQ_MACH_ARV4520PW, /* Airties WAV-281, Arcor EasyboxA800 */
18 + LANTIQ_MACH_ARV452CPW, /* Arcor EasyboxA801 */
19 + LANTIQ_MACH_ARV4525PW, /* Speedport W502V */
20 + LANTIQ_MACH_ARV7525PW, /* Speedport W303V */
21 + LANTIQ_MACH_ARV752DPW, /* Arcor easybox a802 */
22 + LANTIQ_MACH_ARV752DPW22, /* Arcor easybox a803 */
23 + LANTIQ_MACH_ARV7518PW, /* ASTORIA */
24 +
25 + /* Netgear */
26 + LANTIQ_MACH_DGN3500B, /* Netgear DGN3500 */
27 +
28 + /* FRITZ!BOX */
29 + LANTIQ_MACH_FRITZ3370, /* FRITZ!BOX 3370 vdsl cpe */
30 + LANTIQ_MACH_FRITZ7320, /* FRITZ!BOX 7320 1&1 homeserver */
31 +
32 + /* Gigaset */
33 + LANTIQ_MACH_GIGASX76X, /* Gigaset SX76x */
34 +
35 + /* Buffalo */
36 + LANTIQ_MACH_WBMR, /* WBMR-HP-G300H */
37 };
38
39 #endif
40 --- a/arch/mips/lantiq/xway/Kconfig
41 +++ b/arch/mips/lantiq/xway/Kconfig
42 @@ -6,6 +6,30 @@ config LANTIQ_MACH_EASY50712
43 bool "Easy50712 - Danube"
44 default y
45
46 +config LANTIQ_MACH_ARV
47 + bool "ARV"
48 + default y
49 +
50 +config LANTIQ_MACH_NETGEAR
51 + bool "Netgear"
52 + default y
53 +
54 +config LANTIQ_MACH_GIGASX76X
55 + bool "GIGASX76X"
56 + default y
57 +
58 +config LANTIQ_MACH_WBMR
59 + bool "WBMR-HP-G300H"
60 + default y
61 +
62 +config LANTIQ_MACH_FRITZ_VR9
63 + bool "FRITZ3370"
64 + default y
65 +
66 +config LANTIQ_MACH_FRITZ_AR9
67 + bool "FRITZ7320"
68 + default y
69 +
70 endmenu
71
72 choice
73 --- a/arch/mips/lantiq/xway/Makefile
74 +++ b/arch/mips/lantiq/xway/Makefile
75 @@ -2,3 +2,9 @@ obj-y := sysctrl.o reset.o gpio.o gpio_s
76
77 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
78 obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
79 +obj-$(CONFIG_LANTIQ_MACH_ARV) += mach-arv.o
80 +obj-$(CONFIG_LANTIQ_MACH_FRITZ_AR9) += mach-fritz_ar9.o
81 +obj-$(CONFIG_LANTIQ_MACH_FRITZ_VR9) += mach-fritz_vr9.o
82 +obj-$(CONFIG_LANTIQ_MACH_GIGASX76X) += mach-gigasx76x.o
83 +obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o
84 +obj-$(CONFIG_LANTIQ_MACH_WBMR) += mach-wbmr.o
85 --- a/arch/mips/lantiq/falcon/Kconfig
86 +++ b/arch/mips/lantiq/falcon/Kconfig
87 @@ -6,6 +6,14 @@ config LANTIQ_MACH_EASY98000
88 bool "Easy98000"
89 default y
90
91 +config LANTIQ_MACH_EASY98020
92 + bool "Easy98020"
93 + default y
94 +
95 +config LANTIQ_MACH_95C3AM1
96 + bool "95C3AM1"
97 + default y
98 +
99 endmenu
100
101 endif
102 --- a/arch/mips/lantiq/falcon/Makefile
103 +++ b/arch/mips/lantiq/falcon/Makefile
104 @@ -1,2 +1,6 @@
105 obj-y := prom.o reset.o sysctrl.o devices.o gpio.o
106 +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += addon-easy98000.o
107 +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
108 obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
109 +obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
110 +obj-$(CONFIG_LANTIQ_MACH_95C3AM1) += mach-95C3AM1.o
111 --- a/arch/mips/lantiq/falcon/mach-easy98000.c
112 +++ b/arch/mips/lantiq/falcon/mach-easy98000.c
113 @@ -1,23 +1,38 @@
114 -/*
115 - * This program is free software; you can redistribute it and/or modify it
116 - * under the terms of the GNU General Public License version 2 as published
117 - * by the Free Software Foundation.
118 - *
119 - * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
120 - * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
121 - */
122 -
123 +#include <linux/init.h>
124 #include <linux/platform_device.h>
125 +#include <linux/leds.h>
126 +#include <linux/gpio.h>
127 +#include <linux/gpio_buttons.h>
128 +#include <linux/etherdevice.h>
129 +#include <linux/mtd/mtd.h>
130 #include <linux/mtd/partitions.h>
131 +#include <linux/mtd/physmap.h>
132 +#include <linux/input.h>
133 +#include <linux/interrupt.h>
134 +#include <linux/dm9000.h>
135 +#include <linux/i2c.h>
136 +#include <linux/i2c-gpio.h>
137 #include <linux/spi/spi.h>
138 #include <linux/spi/spi_gpio.h>
139 #include <linux/spi/eeprom.h>
140 +#include <falcon/lantiq_soc.h>
141
142 #include "../machtypes.h"
143
144 #include "devices.h"
145 +#include "dev-leds-gpio.h"
146 +
147 +#define EASY98000_GPIO_LED_0 9
148 +#define EASY98000_GPIO_LED_1 10
149 +#define EASY98000_GPIO_LED_2 11
150 +#define EASY98000_GPIO_LED_3 12
151 +#define EASY98000_GPIO_LED_4 13
152 +#define EASY98000_GPIO_LED_5 14
153
154 -static struct mtd_partition easy98000_nor_partitions[] = {
155 +extern unsigned char ltq_ethaddr[6];
156 +
157 +static struct mtd_partition easy98000_nor_partitions[] =
158 +{
159 {
160 .name = "uboot",
161 .offset = 0x0,
162 @@ -35,7 +50,7 @@ static struct mtd_partition easy98000_no
163 },
164 };
165
166 -struct physmap_flash_data easy98000_nor_flash_data = {
167 +static struct physmap_flash_data easy98000_nor_flash_data = {
168 .nr_parts = ARRAY_SIZE(easy98000_nor_partitions),
169 .parts = easy98000_nor_partitions,
170 };
171 @@ -55,12 +70,105 @@ static struct spi_board_info easy98000_s
172 .platform_data = &easy98000_spi_flash_platform_data
173 };
174
175 +static struct gpio_led easy98000_leds_gpio[] __initdata = {
176 + {
177 + .name = "easy98000:green:0",
178 + .gpio = EASY98000_GPIO_LED_0,
179 + .active_low = 0,
180 + }, {
181 + .name = "easy98000:green:1",
182 + .gpio = EASY98000_GPIO_LED_1,
183 + .active_low = 0,
184 + }, {
185 + .name = "easy98000:green:2",
186 + .gpio = EASY98000_GPIO_LED_2,
187 + .active_low = 0,
188 + }, {
189 + .name = "easy98000:green:3",
190 + .gpio = EASY98000_GPIO_LED_3,
191 + .active_low = 0,
192 + }, {
193 + .name = "easy98000:green:4",
194 + .gpio = EASY98000_GPIO_LED_4,
195 + .active_low = 0,
196 + }, {
197 + .name = "easy98000:green:5",
198 + .gpio = EASY98000_GPIO_LED_5,
199 + .active_low = 0,
200 + }
201 +};
202 +
203 +#define CONFIG_DM9000_BASE 0x14000000
204 +#define DM9000_IO (CONFIG_DM9000_BASE + 3)
205 +#define DM9000_DATA (CONFIG_DM9000_BASE + 1)
206 +
207 +static struct dm9000_plat_data dm9000_plat_data = {
208 + .flags = DM9000_PLATF_8BITONLY,
209 + //.dev_addr = { }, /* possibility to provide an ethernet address for the chip */
210 +};
211 +
212 +static struct resource dm9000_resources[] = {
213 + MEM_RES("dm9000_io", DM9000_IO, DM9000_IO),
214 + MEM_RES("dm9000_data", DM9000_DATA, DM9000_DATA),
215 + [2] = {
216 + /* with irq (210 -> gpio 110) the driver is very unreliable */
217 + .start = -1, /* use polling */
218 + .end = -1,
219 + .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
220 + },
221 +};
222 +
223 +static struct platform_device dm9000_platform = {
224 + .name = "dm9000",
225 + .id = 0,
226 + .num_resources = ARRAY_SIZE(dm9000_resources),
227 + .resource = dm9000_resources,
228 + .dev = {
229 + .platform_data = (void *) &dm9000_plat_data,
230 + }
231 +};
232 +
233 +extern int easy98000_addon_has_dm9000(void);
234 +static void __init register_davicom(void)
235 +{
236 + if (!easy98000_addon_has_dm9000())
237 + return;
238 +
239 + if (!is_valid_ether_addr(ltq_ethaddr))
240 + random_ether_addr(dm9000_plat_data.dev_addr);
241 + else {
242 + memcpy(dm9000_plat_data.dev_addr, ltq_ethaddr, 6);
243 + /* change to "Locally Administered Address" */
244 + dm9000_plat_data.dev_addr[0] |= 0x2;
245 + }
246 + platform_device_register(&dm9000_platform);
247 +}
248 +
249 +static struct i2c_gpio_platform_data easy98000_i2c_gpio_data = {
250 + .sda_pin = 107,
251 + .scl_pin = 108,
252 +};
253 +
254 +static struct platform_device easy98000_i2c_gpio_device = {
255 + .name = "i2c-gpio",
256 + .id = 0,
257 + .dev = {
258 + .platform_data = &easy98000_i2c_gpio_data,
259 + }
260 +};
261 +
262 +void __init register_easy98000_cpld(void)
263 +{
264 + platform_device_register_simple("easy98000_cpld_led", 0, NULL, 0);
265 + platform_device_register_simple("easy98000_addon", 0, NULL, 0);
266 +}
267 +
268 /* setup gpio based spi bus/device for access to the eeprom on the board */
269 -#define SPI_GPIO_MRST 102
270 -#define SPI_GPIO_MTSR 103
271 -#define SPI_GPIO_CLK 104
272 -#define SPI_GPIO_CS0 105
273 -#define SPI_GPIO_CS1 106
274 +#define SPI_GPIO_MRST 102
275 +#define SPI_GPIO_MTSR 103
276 +#define SPI_GPIO_CLK 104
277 +#define SPI_GPIO_CS0 105
278 +#define SPI_GPIO_CS1 106
279 #define SPI_GPIO_BUS_NUM 1
280
281 static struct spi_gpio_platform_data easy98000_spi_gpio_data = {
282 @@ -94,11 +202,22 @@ static struct spi_board_info easy98000_s
283 };
284
285 static void __init
286 -easy98000_init_common(void)
287 +easy98000_spi_gpio_init(void)
288 {
289 spi_register_board_info(&easy98000_spi_gpio_devices, 1);
290 platform_device_register(&easy98000_spi_gpio_device);
291 +}
292 +
293 +static void __init
294 +easy98000_init_common(void)
295 +{
296 falcon_register_i2c();
297 + platform_device_register(&easy98000_i2c_gpio_device);
298 + register_davicom();
299 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(easy98000_leds_gpio),
300 + easy98000_leds_gpio);
301 + register_easy98000_cpld();
302 + easy98000_spi_gpio_init();
303 }
304
305 static void __init