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