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