ixp4xx: update Gateworks Avila board support
[librecmc/librecmc.git] / 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,280 @@ 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 +static struct platform_device avila_gpio_dev = {
244 +       .name     = "GPIODEV",
245 +       .id     = -1,
246 +};
247 +
248 +/*
249 + * Audio Devices
250 + */
251 +
252 +static struct platform_device avila_hss_device[] = {
253 +       {
254 +               .name = "gw_avila_hss",
255 +               .id = 0,
256 +       },{
257 +               .name = "gw_avila_hss",
258 +               .id = 1,
259 +       },{
260 +               .name = "gw_avila_hss",
261 +               .id = 2,
262 +       },{
263 +               .name = "gw_avila_hss",
264 +               .id = 3,
265 +       },
266 +};
267 +
268 +static struct platform_device avila_pcm_device[] = {
269 +       {
270 +               .name = "gw_avila-audio",
271 +               .id = 0,
272 +       },{
273 +               .name = "gw_avila-audio",
274 +               .id = 1,
275 +       },{
276 +               .name = "gw_avila-audio",
277 +               .id = 2,
278 +       },{
279 +               .name = "gw_avila-audio",
280 +               .id = 3,
281 +       }
282 +};
283 +
284 +static void setup_audio_devices(void) {
285 +       platform_device_register(&avila_hss_device[0]);
286 +       platform_device_register(&avila_hss_device[1]);
287 +       platform_device_register(&avila_hss_device[2]);
288 +       platform_device_register(&avila_hss_device[3]);
289 +
290 +       platform_device_register(&avila_pcm_device[0]);
291 +       platform_device_register(&avila_pcm_device[1]);
292 +       platform_device_register(&avila_pcm_device[2]);
293 +       platform_device_register(&avila_pcm_device[3]);
294 +}
295 +
296 +static void __init avila_gw23xx_setup(void)
297  {
298 -       ixp4xx_sys_init();
299 +       platform_device_register(&avila_npeb_device);
300 +       platform_device_register(&avila_npec_device);
301  
302 -       avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
303 -       avila_flash_resource.end =
304 -               IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
305 +       platform_device_register(&avila_gpio_leds_device);
306 +}
307  
308 -       platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
309 +static void __init avila_gw2342_setup(void)
310 +{
311 +       platform_device_register(&avila_npeb_device);
312 +       platform_device_register(&avila_npec_device);
313 +
314 +       platform_device_register(&avila_gpio_leds_device);
315 +
316 +       avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
317 +       avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
318 +
319 +       avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
320 +       avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
321 +
322 +       avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
323 +       avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
324 +
325 +       platform_device_register(&avila_pata);
326 +}
327 +
328 +static void __init avila_gw2345_setup(void)
329 +{
330 +       avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
331 +       avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
332 +       platform_device_register(&avila_npeb_device);
333 +
334 +       avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
335 +       platform_device_register(&avila_npec_device);
336 +
337 +       platform_device_register(&avila_gpio_leds_device);
338 +
339 +       avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
340 +       avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
341 +
342 +       avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
343 +       avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
344 +
345 +       avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
346 +       avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
347 +
348 +       platform_device_register(&avila_pata);
349 +}
350 +
351 +static void __init avila_gw2347_setup(void)
352 +{
353 +       platform_device_register(&avila_npeb_device);
354 +
355 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
356 +       platform_device_register(&avila_gpio_leds_device);
357 +}
358 +
359 +static void __init avila_gw2348_setup(void)
360 +{
361 +       platform_device_register(&avila_npeb_device);
362 +       platform_device_register(&avila_npec_device);
363 +
364 +       platform_device_register(&avila_gpio_leds_device);
365 +
366 +       avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
367 +       avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
368 +
369 +       avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
370 +       avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
371 +
372 +       avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
373 +       avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
374 +
375 +       platform_device_register(&avila_pata);
376 +}
377 +
378 +static void __init avila_gw2353_setup(void)
379 +{
380 +       platform_device_register(&avila_npeb_device);
381 +       platform_device_register(&avila_gpio_leds_device);
382 +}
383 +
384 +static void __init avila_gw2355_setup(void)
385 +{
386 +       avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
387 +       avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
388 +       platform_device_register(&avila_npeb_device);
389 +
390 +       avila_npec_data.phy = 16;
391 +       platform_device_register(&avila_npec_device);
392 +
393 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
394 +       platform_device_register(&avila_gpio_leds_device);
395 +
396 +       *IXP4XX_EXP_CS4 |= 0xbfff3c03;
397 +       avila_latch_leds[0].name = "RXD";
398 +       avila_latch_leds[1].name = "TXD";
399 +       avila_latch_leds[2].name = "POL";
400 +       avila_latch_leds[3].name = "LNK";
401 +       avila_latch_leds[4].name = "ERR";
402 +       avila_latch_leds_data.num_leds = 5;
403 +       avila_latch_leds_data.mem = 0x54000000;
404 +       platform_device_register(&avila_latch_leds_device);
405  
406         avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
407         avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
408 @@ -159,8 +495,274 @@ static void __init avila_init(void)
409         avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
410  
411         platform_device_register(&avila_pata);
412 +}
413 +
414 +static void __init avila_gw2357_setup(void)
415 +{
416 +       platform_device_register(&avila_npeb_device);
417 +
418 +       avila_gpio_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
419 +       platform_device_register(&avila_gpio_leds_device);
420 +
421 +       *IXP4XX_EXP_CS1 |= 0xbfff3c03;
422 +       platform_device_register(&avila_latch_leds_device);
423 +}
424 +
425 +static void __init avila_gw2365_setup(void)
426 +{
427 +       avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
428 +
429 +       *IXP4XX_EXP_CS4 = 0xBFFF3C43;
430 +       irq_set_irq_type(IRQ_IXP4XX_GPIO0, IRQ_TYPE_EDGE_RISING);
431 +       avila_optional_uart_data[0].mapbase = 0x54000000;
432 +       avila_optional_uart_data[0].membase = (void __iomem *)ioremap(0x54000000, 0x0fff);
433 +       avila_optional_uart_data[0].irq   = IRQ_IXP4XX_GPIO0;
434 +
435 +       *IXP4XX_EXP_CS5 = 0xBFFF3C43;
436 +       irq_set_irq_type(IRQ_IXP4XX_GPIO1, IRQ_TYPE_EDGE_RISING);
437 +       avila_optional_uart_data[1].mapbase = 0x55000000;
438 +       avila_optional_uart_data[1].membase = (void __iomem *)ioremap(0x55000000, 0x0fff);
439 +       avila_optional_uart_data[1].irq   = IRQ_IXP4XX_GPIO1;
440 +
441 +       *IXP4XX_EXP_CS6 = 0xBFFF3C43;
442 +       irq_set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_EDGE_RISING);
443 +       avila_optional_uart_data[2].mapbase = 0x56000000;
444 +       avila_optional_uart_data[2].membase = (void __iomem *)ioremap(0x56000000, 0x0fff);
445 +       avila_optional_uart_data[2].irq   = IRQ_IXP4XX_GPIO2;
446 +
447 +       *IXP4XX_EXP_CS7 = 0xBFFF3C43;
448 +       irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
449 +       avila_optional_uart_data[3].mapbase = 0x57000000;
450 +       avila_optional_uart_data[3].membase = (void __iomem *)ioremap(0x57000000, 0x0fff);
451 +       avila_optional_uart_data[3].irq   = IRQ_IXP4XX_GPIO3;
452 +
453 +       platform_device_register(&avila_optional_uart);
454 +
455 +       avila_npeb_data.phy = 1;
456 +       platform_device_register(&avila_npeb_device);
457 +
458 +       avila_npec_data.phy = 2;
459 +       platform_device_register(&avila_npec_device);
460 +
461 +       avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(2);
462 +       avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(2);
463 +
464 +       avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(3);
465 +       avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(3);
466 +
467 +       avila_pata_data.cs0_cfg = IXP4XX_EXP_CS2;
468 +       avila_pata_data.cs1_cfg = IXP4XX_EXP_CS3;
469 +
470 +       platform_device_register(&avila_pata);
471 +
472 +       avila_gpio_leds[0].gpio = 109;
473 +       avila_gpio_leds_data.num_leds = 5;
474 +       platform_device_register(&avila_gpio_leds_device);
475 +
476 +       setup_audio_devices();
477 +}
478 +
479 +static void __init avila_gw2369_setup(void)
480 +{
481 +       avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
482 +
483 +       avila_npeb_data.phy = 1;
484 +       platform_device_register(&avila_npeb_device);
485 +
486 +       avila_npec_data.phy = 2;
487 +       platform_device_register(&avila_npec_device);
488 +
489 +       setup_audio_devices();
490 +}
491 +
492 +static void __init avila_gw2370_setup(void)
493 +{
494 +       avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
495 +
496 +       avila_npeb_data.phy = 5;
497 +       platform_device_register(&avila_npeb_device);
498 +
499 +       avila_npec_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
500 +       avila_npec_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
501 +       platform_device_register(&avila_npec_device);
502 +
503 +       *IXP4XX_EXP_CS2 = 0xBFFF3C43;
504 +       irq_set_irq_type(IRQ_IXP4XX_GPIO2, IRQ_TYPE_EDGE_RISING);
505 +       avila_optional_uart_data[0].mapbase = 0x52000000;
506 +       avila_optional_uart_data[0].membase = (void __iomem *)ioremap(0x52000000, 0x0fff);
507 +       avila_optional_uart_data[0].irq   = IRQ_IXP4XX_GPIO2;
508 +
509 +       *IXP4XX_EXP_CS3 = 0xBFFF3C43;
510 +       irq_set_irq_type(IRQ_IXP4XX_GPIO3, IRQ_TYPE_EDGE_RISING);
511 +       avila_optional_uart_data[1].mapbase = 0x53000000;
512 +       avila_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53000000, 0x0fff);
513 +       avila_optional_uart_data[1].irq   = IRQ_IXP4XX_GPIO3;
514 +
515 +       avila_optional_uart.num_resources = 2;
516 +
517 +       platform_device_register(&avila_optional_uart);
518 +
519 +       avila_gpio_leds[0].gpio = 101;
520 +       platform_device_register(&avila_gpio_leds_device);
521 +
522 +       setup_audio_devices();
523 +}
524 +
525 +
526 +
527 +static struct avila_board_info avila_boards[] __initdata = {
528 +       {
529 +               .model          = "GW2342",
530 +               .setup          = avila_gw2342_setup,
531 +       }, {
532 +               .model          = "GW2345",
533 +               .setup          = avila_gw2345_setup,
534 +       }, {
535 +               .model          = "GW2347",
536 +               .setup          = avila_gw2347_setup,
537 +       }, {
538 +               .model          = "GW2348",
539 +               .setup          = avila_gw2348_setup,
540 +       }, {
541 +               .model          = "GW2353",
542 +               .setup          = avila_gw2353_setup,
543 +       }, {
544 +               .model          = "GW2355",
545 +               .setup          = avila_gw2355_setup,
546 +       }, {
547 +               .model          = "GW2357",
548 +               .setup          = avila_gw2357_setup,
549 +       }, {
550 +               .model          = "GW2365",
551 +               .setup          = avila_gw2365_setup,
552 +       }, {
553 +               .model          = "GW2369",
554 +               .setup          = avila_gw2369_setup,
555 +       }, {
556 +               .model          = "GW2370",
557 +               .setup          = avila_gw2370_setup,
558 +       }, {
559 +               .model          = "GW2373",
560 +               .setup          = avila_gw2369_setup,
561 +       }
562 +};
563 +
564 +static struct avila_board_info * __init avila_find_board_info(char *model)
565 +{
566 +       int i;
567 +       model[6] = '\0';
568 +
569 +       for (i = 0; i < ARRAY_SIZE(avila_boards); i++) {
570 +               struct avila_board_info *info = &avila_boards[i];
571 +               if (strcmp(info->model, model) == 0)
572 +                       return info;
573 +       }
574 +
575 +       return NULL;
576 +}
577 +
578 +static struct memory_accessor *at24_mem_acc;
579 +
580 +static void at24_setup(struct memory_accessor *mem_acc, void *context)
581 +{
582 +       char mac_addr[ETH_ALEN];
583 +       char model[7];
584 +
585 +       at24_mem_acc = mem_acc;
586 +
587 +       /* Read MAC addresses */
588 +       if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x0, 6) == 6) {
589 +               memcpy(&avila_npeb_data.hwaddr, mac_addr, ETH_ALEN);
590 +       }
591 +       if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x6, 6) == 6) {
592 +               memcpy(&avila_npec_data.hwaddr, mac_addr, ETH_ALEN);
593 +       }
594 +
595 +       /* Read the first 6 bytes of the model number */
596 +       if (at24_mem_acc->read(at24_mem_acc, model, 0x20, 6) == 6) {
597 +               avila_info = avila_find_board_info(model);
598 +       }
599 +
600 +}
601 +
602 +static struct at24_platform_data avila_eeprom_info = {
603 +       .byte_len       = 1024,
604 +       .page_size      = 16,
605 +//     .flags          = AT24_FLAG_READONLY,
606 +       .setup          = at24_setup,
607 +};
608 +
609 +static struct pca953x_platform_data avila_pca_data = {
610 +       .gpio_base  = 100,
611 +};
612 +
613 +static struct i2c_board_info __initdata avila_i2c_board_info[] = {
614 +       {
615 +               I2C_BOARD_INFO("ds1672", 0x68),
616 +       },
617 +       {
618 +               I2C_BOARD_INFO("gsp", 0x29),
619 +       },
620 +       {
621 +               I2C_BOARD_INFO("pca9555", 0x23),
622 +               .platform_data = &avila_pca_data,
623 +       },
624 +       {
625 +               I2C_BOARD_INFO("ad7418", 0x28),
626 +       },
627 +       {
628 +               I2C_BOARD_INFO("24c08", 0x51),
629 +               .platform_data  = &avila_eeprom_info
630 +       },
631 +       {
632 +               I2C_BOARD_INFO("tlv320aic33", 0x1b),
633 +       },
634 +       {
635 +               I2C_BOARD_INFO("tlv320aic33", 0x1a),
636 +       },
637 +       {
638 +               I2C_BOARD_INFO("tlv320aic33", 0x19),
639 +       },
640 +       {
641 +               I2C_BOARD_INFO("tlv320aic33", 0x18),
642 +       },
643 +};
644 +
645 +static void __init avila_init(void)
646 +{
647 +       ixp4xx_sys_init();
648 +
649 +       platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
650 +
651 +       i2c_register_board_info(0, avila_i2c_board_info,
652 +                       ARRAY_SIZE(avila_i2c_board_info));
653 +
654 +       platform_device_register(&avila_gpio_dev);
655 +}
656 +
657 +static int __init avila_model_setup(void)
658 +{
659 +       if (!machine_is_avila())
660 +               return 0;
661 +
662 +       /* default 16MB flash */
663 +       avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
664 +       avila_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_16M - 1;
665 +
666 +       if (avila_info) {
667 +               printk(KERN_DEBUG "Running on Gateworks Avila %s\n",
668 +                                                       avila_info->model);
669 +               avila_info->setup();
670 +       } else {
671 +               printk(KERN_INFO "Unknown/missing Avila model number"
672 +                                               " -- defaults will be used\n");
673 +               avila_gw23xx_setup();
674 +       }
675 +       platform_device_register(&avila_flash);
676  
677 +       return 0;
678  }
679 +late_initcall(avila_model_setup);
680  
681  MACHINE_START(AVILA, "Gateworks Avila Network Platform")
682         /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
683 --- a/arch/arm/mach-ixp4xx/avila-pci.c
684 +++ b/arch/arm/mach-ixp4xx/avila-pci.c
685 @@ -27,8 +27,8 @@
686  #include <mach/hardware.h>
687  #include <asm/mach-types.h>
688  
689 -#define AVILA_MAX_DEV  4
690 -#define LOFT_MAX_DEV   6
691 +#define AVILA_MAX_DEV  6
692 +
693  #define IRQ_LINES      4
694  
695  /* PCI controller GPIO to IRQ pin mappings */
696 @@ -55,9 +55,7 @@ static int __init avila_map_irq(const st
697                 IXP4XX_GPIO_IRQ(INTD)
698         };
699  
700 -       if (slot >= 1 &&
701 -           slot <= (machine_is_loft() ? LOFT_MAX_DEV : AVILA_MAX_DEV) &&
702 -           pin >= 1 && pin <= IRQ_LINES)
703 +       if (slot >= 1 && slot <= AVILA_MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
704                 return pci_irq_table[(slot + pin - 2) % 4];
705  
706         return -1;