Root/target/linux/ixp4xx/patches-3.3/300-avila_support.patch

1--- a/arch/arm/mach-ixp4xx/avila-setup.c
2+++ b/arch/arm/mach-ixp4xx/avila-setup.c
3@@ -14,9 +14,16 @@
4 #include <linux/kernel.h>
5 #include <linux/init.h>
6 #include <linux/device.h>
7+#include <linux/if_ether.h>
8+#include <linux/socket.h>
9+#include <linux/netdevice.h>
10 #include <linux/serial.h>
11 #include <linux/tty.h>
12 #include <linux/serial_8250.h>
13+#include <linux/i2c.h>
14+#include <linux/i2c/at24.h>
15+#include <linux/leds.h>
16+#include <linux/i2c/pca953x.h>
17 #include <linux/i2c-gpio.h>
18 #include <asm/types.h>
19 #include <asm/setup.h>
20@@ -26,10 +33,25 @@
21 #include <asm/irq.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
24+#include <linux/irq.h>
25 
26 #define AVILA_SDA_PIN 7
27 #define AVILA_SCL_PIN 6
28 
29+/* User LEDs */
30+#define AVILA_GW23XX_LED_USER_GPIO 3
31+#define AVILA_GW23X7_LED_USER_GPIO 4
32+
33+/* gpio mask used by platform device */
34+#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)
35+
36+struct avila_board_info {
37+ unsigned char *model;
38+ void (*setup)(void);
39+};
40+
41+static struct avila_board_info *avila_info __initdata;
42+
43 static struct flash_platform_data avila_flash_data = {
44     .map_name = "cfi_probe",
45     .width = 2,
46@@ -105,14 +127,69 @@ static struct platform_device avila_uart
47     .resource = avila_uart_resources
48 };
49 
50-static struct resource avila_pata_resources[] = {
51+static struct resource avila_optional_uart_resources[] = {
52     {
53- .flags = IORESOURCE_MEM
54- },
55+ .start = 0x54000000,
56+ .end = 0x54000fff,
57+ .flags = IORESOURCE_MEM
58+ },{
59+ .start = 0x55000000,
60+ .end = 0x55000fff,
61+ .flags = IORESOURCE_MEM
62+ },{
63+ .start = 0x56000000,
64+ .end = 0x56000fff,
65+ .flags = IORESOURCE_MEM
66+ },{
67+ .start = 0x57000000,
68+ .end = 0x57000fff,
69+ .flags = IORESOURCE_MEM
70+ }
71+};
72+
73+static struct plat_serial8250_port avila_optional_uart_data[] = {
74     {
75- .flags = IORESOURCE_MEM,
76+ .flags = UPF_BOOT_AUTOCONF,
77+ .iotype = UPIO_MEM,
78+ .regshift = 0,
79+ .uartclk = 18432000,
80+ .rw_delay = 2,
81+ },{
82+ .flags = UPF_BOOT_AUTOCONF,
83+ .iotype = UPIO_MEM,
84+ .regshift = 0,
85+ .uartclk = 18432000,
86+ .rw_delay = 2,
87+ },{
88+ .flags = UPF_BOOT_AUTOCONF,
89+ .iotype = UPIO_MEM,
90+ .regshift = 0,
91+ .uartclk = 18432000,
92+ .rw_delay = 2,
93+ },{
94+ .flags = UPF_BOOT_AUTOCONF,
95+ .iotype = UPIO_MEM,
96+ .regshift = 0,
97+ .uartclk = 18432000,
98+ .rw_delay = 2,
99     },
100+ { }
101+};
102+
103+static struct platform_device avila_optional_uart = {
104+ .name = "serial8250",
105+ .id = PLAT8250_DEV_PLATFORM1,
106+ .dev.platform_data = avila_optional_uart_data,
107+ .num_resources = 4,
108+ .resource = avila_optional_uart_resources,
109+};
110+
111+static struct resource avila_pata_resources[] = {
112     {
113+ .flags = IORESOURCE_MEM
114+ },{
115+ .flags = IORESOURCE_MEM,
116+ },{
117         .name = "intrq",
118         .start = IRQ_IXP4XX_GPIO12,
119         .end = IRQ_IXP4XX_GPIO12,
120@@ -133,21 +210,208 @@ static struct platform_device avila_pata
121     .resource = avila_pata_resources,
122 };
123 
124+/* Built-in 10/100 Ethernet MAC interfaces */
125+static struct eth_plat_info avila_npeb_data = {
126+ .phy = 0,
127+ .rxq = 3,
128+ .txreadyq = 20,
129+};
130+
131+static struct eth_plat_info avila_npec_data = {
132+ .phy = 1,
133+ .rxq = 4,
134+ .txreadyq = 21,
135+};
136+
137+static struct platform_device avila_npeb_device = {
138+ .name = "ixp4xx_eth",
139+ .id = IXP4XX_ETH_NPEB,
140+ .dev.platform_data = &avila_npeb_data,
141+};
142+
143+static struct platform_device avila_npec_device = {
144+ .name = "ixp4xx_eth",
145+ .id = IXP4XX_ETH_NPEC,
146+ .dev.platform_data = &avila_npec_data,
147+};
148+
149+static struct gpio_led avila_gpio_leds[] = {
150+ {
151+ .name = "user", /* green led */
152+ .gpio = AVILA_GW23XX_LED_USER_GPIO,
153+ .active_low = 1,
154+ },
155+ {
156+ .name = "radio1", /* green led */
157+ .gpio = 104,
158+ .active_low = 1,
159+ },
160+ {
161+ .name = "radio2", /* green led */
162+ .gpio = 105,
163+ .active_low = 1,
164+ },
165+ {
166+ .name = "radio3", /* green led */
167+ .gpio = 106,
168+ .active_low = 1,
169+ },
170+ {
171+ .name = "radio4", /* green led */
172+ .gpio = 107,
173+ .active_low = 1,
174+ },
175+
176+};
177+
178+static struct gpio_led_platform_data avila_gpio_leds_data = {
179+ .num_leds = 1,
180+ .leds = avila_gpio_leds,
181+};
182+
183+static struct platform_device avila_gpio_leds_device = {
184+ .name = "leds-gpio",
185+ .id = -1,
186+ .dev.platform_data = &avila_gpio_leds_data,
187+};
188+
189+static struct latch_led avila_latch_leds[] = {
190+ {
191+ .name = "led0", /* green led */
192+ .bit = 0,
193+ },
194+ {
195+ .name = "led1", /* green led */
196+ .bit = 1,
197+ },
198+ {
199+ .name = "led2", /* green led */
200+ .bit = 2,
201+ },
202+ {
203+ .name = "led3", /* green led */
204+ .bit = 3,
205+ },
206+ {
207+ .name = "led4", /* green led */
208+ .bit = 4,
209+ },
210+ {
211+ .name = "led5", /* green led */
212+ .bit = 5,
213+ },
214+ {
215+ .name = "led6", /* green led */
216+ .bit = 6,
217+ },
218+ {
219+ .name = "led7", /* green led */
220+ .bit = 7,
221+ }
222+};
223+
224+static struct latch_led_platform_data avila_latch_leds_data = {
225+ .num_leds = 8,
226+ .leds = avila_latch_leds,
227+ .mem = 0x51000000,
228+};
229+
230+static struct platform_device avila_latch_leds_device = {
231+ .name = "leds-latch",
232+ .id = -1,
233+ .dev.platform_data = &avila_latch_leds_data,
234+};
235+
236 static struct platform_device *avila_devices[] __initdata = {
237     &avila_i2c_gpio,
238- &avila_flash,
239     &avila_uart
240 };
241 
242-static void __init avila_init(void)
243+/*
244+ * Audio Devices
245+ */
246+
247+static struct platform_device avila_hss_device[] = {
248+ {
249+ .name = "gw_avila_hss",
250+ .id = 0,
251+ },{
252+ .name = "gw_avila_hss",
253+ .id = 1,
254+ },{
255+ .name = "gw_avila_hss",
256+ .id = 2,
257+ },{
258+ .name = "gw_avila_hss",
259+ .id = 3,
260+ },
261+};
262+
263+static struct platform_device avila_pcm_device[] = {
264+ {
265+ .name = "gw_avila-audio",
266+ .id = 0,
267+ },{
268+ .name = "gw_avila-audio",
269+ .id = 1,
270+ },{
271+ .name = "gw_avila-audio",
272+ .id = 2,
273+ },{
274+ .name = "gw_avila-audio",
275+ .id = 3,
276+ }
277+};
278+
279+static void setup_audio_devices(void) {
280+ platform_device_register(&avila_hss_device[0]);
281+ platform_device_register(&avila_hss_device[1]);
282+ platform_device_register(&avila_hss_device[2]);
283+ platform_device_register(&avila_hss_device[3]);
284+
285+ platform_device_register(&avila_pcm_device[0]);
286+ platform_device_register(&avila_pcm_device[1]);
287+ platform_device_register(&avila_pcm_device[2]);
288+ platform_device_register(&avila_pcm_device[3]);
289+}
290+
291+static void __init avila_gw23xx_setup(void)
292 {
293- ixp4xx_sys_init();
294+ platform_device_register(&avila_npeb_device);
295+ platform_device_register(&avila_npec_device);
296 
297- avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
298- avila_flash_resource.end =
299- IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
300+ platform_device_register(&avila_gpio_leds_device);
301+}
302 
303- platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
304+static void __init avila_gw2342_setup(void)
305+{
306+ platform_device_register(&avila_npeb_device);
307+ platform_device_register(&avila_npec_device);
308+
309+ platform_device_register(&avila_gpio_leds_device);
310+
311+ avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
312+ avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
313+
314+ avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
315+ avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
316+
317+ avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
318+ avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
319+
320+ platform_device_register(&avila_pata);
321+}
322+
323+static void __init avila_gw2345_setup(void)
324+{
325+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
326+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
327+ platform_device_register(&avila_npeb_device);
328+
329+ avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
330+ platform_device_register(&avila_npec_device);
331+
332+ platform_device_register(&avila_gpio_leds_device);
333 
334     avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
335     avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
336@@ -159,8 +423,339 @@ static void __init avila_init(void)
337     avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
338 
339     platform_device_register(&avila_pata);
340+}
341+
342+static void __init avila_gw2347_setup(void)
343+{
344+ platform_device_register(&avila_npeb_device);
345+
346+ avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
347+ platform_device_register(&avila_gpio_leds_device);
348+}
349+
350+static void __init avila_gw2348_setup(void)
351+{
352+ platform_device_register(&avila_npeb_device);
353+ platform_device_register(&avila_npec_device);
354+
355+ platform_device_register(&avila_gpio_leds_device);
356+
357+ avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
358+ avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
359+
360+ avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
361+ avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
362+
363+ avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
364+ avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
365+
366+ platform_device_register(&avila_pata);
367+}
368+
369+static void __init avila_gw2353_setup(void)
370+{
371+ platform_device_register(&avila_npeb_device);
372+ platform_device_register(&avila_gpio_leds_device);
373+}
374+
375+static void __init avila_gw2355_setup(void)
376+{
377+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
378+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
379+ platform_device_register(&avila_npeb_device);
380+
381+ avila_npec_data.phy = 16;
382+ platform_device_register(&avila_npec_device);
383+
384+ avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
385+ platform_device_register(&avila_gpio_leds_device);
386+
387+ *IXP4XX_EXP_CS4 |= 0xbfff3c03;
388+ avila_latch_leds[0].name = "RXD";
389+ avila_latch_leds[1].name = "TXD";
390+ avila_latch_leds[2].name = "POL";
391+ avila_latch_leds[3].name = "LNK";
392+ avila_latch_leds[4].name = "ERR";
393+ avila_latch_leds_data.num_leds = 5;
394+ avila_latch_leds_data.mem = 0x54000000;
395+ platform_device_register(&avila_latch_leds_device);
396+
397+ avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
398+ avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
399+
400+ avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
401+ avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
402+
403+ avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
404+ avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
405+
406+ platform_device_register(&avila_pata);
407+}
408+
409+static void __init avila_gw2357_setup(void)
410+{
411+ platform_device_register(&avila_npeb_device);
412+
413+ avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
414+ platform_device_register(&avila_gpio_leds_device);
415+
416+ *IXP4XX_EXP_CS1 |= 0xbfff3c03;
417+ platform_device_register(&avila_latch_leds_device);
418+}
419+
420+static void __init avila_gw2365_setup(void)
421+{
422+ avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
423+
424+ *IXP4XX_EXP_CS4 = 0xBFFF3C43;
425+ irq_set_irq_type(IRQ_IXP4XX_GPIO0, IRQ_TYPE_EDGE_RISING);
426+ avila_optional_uart_data[0].mapbase = 0x54000000;
427+ avila_optional_uart_data[0].membase = (void __iomem *)ioremap(0x54000000, 0x0fff);
428+ avila_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO0;
429+
430+ *IXP4XX_EXP_CS5 = 0xBFFF3C43;
431+ irq_set_irq_type(IRQ_IXP4XX_GPIO1, IRQ_TYPE_EDGE_RISING);
432+ avila_optional_uart_data[1].mapbase = 0x55000000;
433+ avila_optional_uart_data[1].membase = (void __iomem *)ioremap(0x55000000, 0x0fff);
434+ avila_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO1;
435+
436+ *IXP4XX_EXP_CS6 = 0xBFFF3C43;
437+ irq_set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_EDGE_RISING);
438+ avila_optional_uart_data[2].mapbase = 0x56000000;
439+ avila_optional_uart_data[2].membase = (void __iomem *)ioremap(0x56000000, 0x0fff);
440+ avila_optional_uart_data[2].irq = IRQ_IXP4XX_GPIO2;
441+
442+ *IXP4XX_EXP_CS7 = 0xBFFF3C43;
443+ irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
444+ avila_optional_uart_data[3].mapbase = 0x57000000;
445+ avila_optional_uart_data[3].membase = (void __iomem *)ioremap(0x57000000, 0x0fff);
446+ avila_optional_uart_data[3].irq = IRQ_IXP4XX_GPIO3;
447+
448+ platform_device_register(&avila_optional_uart);
449+
450+ avila_npeb_data.phy = 1;
451+ platform_device_register(&avila_npeb_device);
452+
453+ avila_npec_data.phy = 2;
454+ platform_device_register(&avila_npec_device);
455+
456+ avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(2);
457+ avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(2);
458+
459+ avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(3);
460+ avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(3);
461+
462+ avila_pata_data.cs0_cfg = IXP4XX_EXP_CS2;
463+ avila_pata_data.cs1_cfg = IXP4XX_EXP_CS3;
464+
465+ platform_device_register(&avila_pata);
466+
467+ avila_gpio_leds[0].gpio = 109;
468+ avila_gpio_leds_data.num_leds = 5;
469+ platform_device_register(&avila_gpio_leds_device);
470+
471+ setup_audio_devices();
472+}
473+
474+static void __init avila_gw2369_setup(void)
475+{
476+ avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
477+
478+ avila_npeb_data.phy = 1;
479+ platform_device_register(&avila_npeb_device);
480+
481+ avila_npec_data.phy = 2;
482+ platform_device_register(&avila_npec_device);
483+
484+ setup_audio_devices();
485+}
486+
487+static void __init avila_gw2370_setup(void)
488+{
489+ avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
490+
491+ avila_npeb_data.phy = 5;
492+ platform_device_register(&avila_npeb_device);
493+
494+ avila_npec_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
495+ avila_npec_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
496+ platform_device_register(&avila_npec_device);
497+
498+ *IXP4XX_EXP_CS2 = 0xBFFF3C43;
499+ irq_set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_EDGE_RISING);
500+ avila_optional_uart_data[0].mapbase = 0x52000000;
501+ avila_optional_uart_data[0].membase = (void __iomem *)ioremap(0x52000000, 0x0fff);
502+ avila_optional_uart_data[0].irq = IRQ_IXP4XX_GPIO2;
503+
504+ *IXP4XX_EXP_CS3 = 0xBFFF3C43;
505+ irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
506+ avila_optional_uart_data[1].mapbase = 0x53000000;
507+ avila_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53000000, 0x0fff);
508+ avila_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO3;
509+
510+ avila_optional_uart.num_resources = 2;
511+
512+ platform_device_register(&avila_optional_uart);
513+
514+ avila_gpio_leds[0].gpio = 101;
515+ platform_device_register(&avila_gpio_leds_device);
516+
517+ setup_audio_devices();
518+}
519+
520+
521+
522+static struct avila_board_info avila_boards[] __initdata = {
523+ {
524+ .model = "GW2342",
525+ .setup = avila_gw2342_setup,
526+ }, {
527+ .model = "GW2345",
528+ .setup = avila_gw2345_setup,
529+ }, {
530+ .model = "GW2347",
531+ .setup = avila_gw2347_setup,
532+ }, {
533+ .model = "GW2348",
534+ .setup = avila_gw2348_setup,
535+ }, {
536+ .model = "GW2353",
537+ .setup = avila_gw2353_setup,
538+ }, {
539+ .model = "GW2355",
540+ .setup = avila_gw2355_setup,
541+ }, {
542+ .model = "GW2357",
543+ .setup = avila_gw2357_setup,
544+ }, {
545+ .model = "GW2365",
546+ .setup = avila_gw2365_setup,
547+ }, {
548+ .model = "GW2369",
549+ .setup = avila_gw2369_setup,
550+ }, {
551+ .model = "GW2370",
552+ .setup = avila_gw2370_setup,
553+ }, {
554+ .model = "GW2373",
555+ .setup = avila_gw2369_setup,
556+ }
557+};
558+
559+static struct avila_board_info * __init avila_find_board_info(char *model)
560+{
561+ int i;
562+ model[6] = '\0';
563+
564+ for (i = 0; i < ARRAY_SIZE(avila_boards); i++) {
565+ struct avila_board_info *info = &avila_boards[i];
566+ if (strcmp(info->model, model) == 0)
567+ return info;
568+ }
569+
570+ return NULL;
571+}
572+
573+static struct memory_accessor *at24_mem_acc;
574+
575+static void at24_setup(struct memory_accessor *mem_acc, void *context)
576+{
577+ char mac_addr[ETH_ALEN];
578+ char model[7];
579+
580+ at24_mem_acc = mem_acc;
581+
582+ /* Read MAC addresses */
583+ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x0, 6) == 6) {
584+ memcpy(&avila_npeb_data.hwaddr, mac_addr, ETH_ALEN);
585+ }
586+ if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x6, 6) == 6) {
587+ memcpy(&avila_npec_data.hwaddr, mac_addr, ETH_ALEN);
588+ }
589+
590+ /* Read the first 6 bytes of the model number */
591+ if (at24_mem_acc->read(at24_mem_acc, model, 0x20, 6) == 6) {
592+ avila_info = avila_find_board_info(model);
593+ }
594+
595+}
596+
597+static struct at24_platform_data avila_eeprom_info = {
598+ .byte_len = 1024,
599+ .page_size = 16,
600+// .flags = AT24_FLAG_READONLY,
601+ .setup = at24_setup,
602+};
603+
604+static struct pca953x_platform_data avila_pca_data = {
605+ .gpio_base = 100,
606+};
607+
608+static struct i2c_board_info __initdata avila_i2c_board_info[] = {
609+ {
610+ I2C_BOARD_INFO("ds1672", 0x68),
611+ },
612+ {
613+ I2C_BOARD_INFO("gsp", 0x29),
614+ },
615+ {
616+ I2C_BOARD_INFO("pca9555", 0x23),
617+ .platform_data = &avila_pca_data,
618+ },
619+ {
620+ I2C_BOARD_INFO("ad7418", 0x28),
621+ },
622+ {
623+ I2C_BOARD_INFO("24c08", 0x51),
624+ .platform_data = &avila_eeprom_info
625+ },
626+ {
627+ I2C_BOARD_INFO("tlv320aic33", 0x1b),
628+ },
629+ {
630+ I2C_BOARD_INFO("tlv320aic33", 0x1a),
631+ },
632+ {
633+ I2C_BOARD_INFO("tlv320aic33", 0x19),
634+ },
635+ {
636+ I2C_BOARD_INFO("tlv320aic33", 0x18),
637+ },
638+};
639+
640+static void __init avila_init(void)
641+{
642+ ixp4xx_sys_init();
643+
644+ platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
645+
646+ i2c_register_board_info(0, avila_i2c_board_info,
647+ ARRAY_SIZE(avila_i2c_board_info));
648+}
649+
650+static int __init avila_model_setup(void)
651+{
652+ if (!machine_is_avila())
653+ return 0;
654+
655+ /* default 16MB flash */
656+ avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
657+ avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
658+
659+ if (avila_info) {
660+ printk(KERN_DEBUG "Running on Gateworks Avila %s\n",
661+ avila_info->model);
662+ avila_info->setup();
663+ } else {
664+ printk(KERN_INFO "Unknown/missing Avila model number"
665+ " -- defaults will be used\n");
666+ avila_gw23xx_setup();
667+ }
668+ platform_device_register(&avila_flash);
669 
670+ return 0;
671 }
672+late_initcall(avila_model_setup);
673 
674 MACHINE_START(AVILA, "Gateworks Avila Network Platform")
675     /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
676--- a/arch/arm/mach-ixp4xx/avila-pci.c
677+++ b/arch/arm/mach-ixp4xx/avila-pci.c
678@@ -27,8 +27,8 @@
679 #include <mach/hardware.h>
680 #include <asm/mach-types.h>
681 
682-#define AVILA_MAX_DEV 4
683-#define LOFT_MAX_DEV 6
684+#define AVILA_MAX_DEV 6
685+
686 #define IRQ_LINES 4
687 
688 /* PCI controller GPIO to IRQ pin mappings */
689@@ -55,9 +55,7 @@ static int __init avila_map_irq(const st
690         IXP4XX_GPIO_IRQ(INTD)
691     };
692 
693- if (slot >= 1 &&
694- slot <= (machine_is_loft() ? LOFT_MAX_DEV : AVILA_MAX_DEV) &&
695- pin >= 1 && pin <= IRQ_LINES)
696+ if (slot >= 1 && slot <= AVILA_MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
697         return pci_irq_table[(slot + pin - 2) % 4];
698 
699     return -1;
700

Archive Download this file



interactive