1 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/Kconfig
2 ===================================================================
3 --- linux-2.6.25.4.orig/arch/arm/mach-ixp4xx/Kconfig
4 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/Kconfig
5 @@ -25,6 +25,14 @@ config MACH_AVILA
6 Avila Network Platform. For more information on this platform,
7 see <file:Documentation/arm/IXP4xx>.
13 + Say 'Y' here if you want your kernel to support the Gateworks
14 + Cambria series. For more information on this platform,
15 + see <file:Documentation/arm/IXP4xx>.
20 @@ -200,7 +208,7 @@ config CPU_IXP46X
24 - depends on MACH_KIXRP435
25 + depends on MACH_KIXRP435 || MACH_CAMBRIA
29 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/Makefile
30 ===================================================================
31 --- linux-2.6.25.4.orig/arch/arm/mach-ixp4xx/Makefile
32 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/Makefile
33 @@ -7,6 +7,7 @@ obj-pci-n :=
35 obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
36 obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
37 +obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o
38 obj-pci-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o
39 obj-pci-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o
40 obj-pci-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o
41 @@ -28,6 +29,7 @@ obj-y += common.o
43 obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
44 obj-$(CONFIG_MACH_AVILA) += avila-setup.o
45 +obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o
46 obj-$(CONFIG_MACH_IXDPG425) += coyote-setup.o
47 obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-setup.o
48 obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-setup.o
49 Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-pci.c
50 ===================================================================
52 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-pci.c
55 + * arch/arch/mach-ixp4xx/cambria-pci.c
57 + * PCI setup routines for Gateworks Cambria series
59 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
61 + * based on coyote-pci.c:
62 + * Copyright (C) 2002 Jungo Software Technologies.
63 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
65 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
67 + * This program is free software; you can redistribute it and/or modify
68 + * it under the terms of the GNU General Public License version 2 as
69 + * published by the Free Software Foundation.
73 +#include <linux/kernel.h>
74 +#include <linux/pci.h>
75 +#include <linux/init.h>
76 +#include <linux/irq.h>
78 +#include <asm/mach-types.h>
79 +#include <asm/hardware.h>
82 +#include <asm/mach/pci.h>
84 +extern void ixp4xx_pci_preinit(void);
85 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
86 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
88 +void __init cambria_pci_preinit(void)
90 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
91 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW);
92 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW);
93 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW);
95 + ixp4xx_pci_preinit();
98 +static int __init cambria_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
101 + return IRQ_IXP4XX_GPIO11;
102 + else if (slot == 2)
103 + return IRQ_IXP4XX_GPIO10;
104 + else if (slot == 3)
105 + return IRQ_IXP4XX_GPIO9;
106 + else if (slot == 4)
107 + return IRQ_IXP4XX_GPIO8;
111 +struct hw_pci cambria_pci __initdata = {
112 + .nr_controllers = 1,
113 + .preinit = cambria_pci_preinit,
114 + .swizzle = pci_std_swizzle,
115 + .setup = ixp4xx_setup,
116 + .scan = ixp4xx_scan_bus,
117 + .map_irq = cambria_map_irq,
120 +int __init cambria_pci_init(void)
122 + if (machine_is_cambria())
123 + pci_common_init(&cambria_pci);
127 +subsys_initcall(cambria_pci_init);
128 diff -ruN /usr/src/openwrt/clean/linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-setup.c linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-setup.c
129 --- /usr/src/openwrt/clean/linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-setup.c 1969-12-31 16:00:00.000000000 -0800
130 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/cambria-setup.c 2008-05-20 16:02:43.000000000 -0700
133 + * arch/arm/mach-ixp4xx/cambria-setup.c
135 + * Board setup for the Gateworks Cambria series
137 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
139 + * based on coyote-setup.c:
140 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
142 + * Author: Imre Kaloz <Kaloz@openwrt.org>
145 +#include <linux/kernel.h>
146 +#include <linux/init.h>
147 +#include <linux/device.h>
148 +#include <linux/if_ether.h>
149 +#include <linux/socket.h>
150 +#include <linux/netdevice.h>
151 +#include <linux/serial.h>
152 +#include <linux/tty.h>
153 +#include <linux/serial_8250.h>
154 +#include <linux/slab.h>
155 +#ifdef CONFIG_SENSORS_EEPROM
156 +# include <linux/i2c.h>
157 +# include <linux/eeprom.h>
160 +#include <linux/leds.h>
161 +#include <linux/i2c-gpio.h>
162 +#include <asm/types.h>
163 +#include <asm/setup.h>
164 +#include <asm/memory.h>
165 +#include <asm/hardware.h>
166 +#include <asm/irq.h>
167 +#include <asm/mach-types.h>
168 +#include <asm/mach/arch.h>
169 +#include <asm/mach/flash.h>
171 +struct cambria_board_info {
172 + unsigned char *model;
173 + void (* setup)(void);
176 +static struct cambria_board_info *cambria_info __initdata;
178 +static struct flash_platform_data cambria_flash_data = {
179 + .map_name = "cfi_probe",
183 +static struct resource cambria_flash_resource = {
184 + .flags = IORESOURCE_MEM,
187 +static struct platform_device cambria_flash = {
188 + .name = "IXP4XX-Flash",
191 + .platform_data = &cambria_flash_data,
193 + .num_resources = 1,
194 + .resource = &cambria_flash_resource,
197 +static struct i2c_gpio_platform_data cambria_i2c_gpio_data = {
202 +static struct platform_device cambria_i2c_gpio = {
203 + .name = "i2c-gpio",
206 + .platform_data = &cambria_i2c_gpio_data,
210 +static struct resource cambria_uart_resource = {
211 + .start = IXP4XX_UART1_BASE_PHYS,
212 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
213 + .flags = IORESOURCE_MEM,
216 +static struct plat_serial8250_port cambria_uart_data[] = {
218 + .mapbase = IXP4XX_UART1_BASE_PHYS,
219 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
220 + .irq = IRQ_IXP4XX_UART1,
221 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
222 + .iotype = UPIO_MEM,
224 + .uartclk = IXP4XX_UART_XTAL,
229 +static struct platform_device cambria_uart = {
230 + .name = "serial8250",
231 + .id = PLAT8250_DEV_PLATFORM,
233 + .platform_data = cambria_uart_data,
235 + .num_resources = 1,
236 + .resource = &cambria_uart_resource,
239 +static struct resource cambria_pata_resources[] = {
241 + .flags = IORESOURCE_MEM
244 + .flags = IORESOURCE_MEM,
248 + .start = IRQ_IXP4XX_GPIO12,
249 + .end = IRQ_IXP4XX_GPIO12,
250 + .flags = IORESOURCE_IRQ,
254 +static struct ixp4xx_pata_data cambria_pata_data = {
255 + .cs0_bits = 0xbfff3c03,
256 + .cs1_bits = 0xbfff3c03,
259 +static struct platform_device cambria_pata = {
260 + .name = "pata_ixp4xx_cf",
262 + .dev.platform_data = &cambria_pata_data,
263 + .num_resources = ARRAY_SIZE(cambria_pata_resources),
264 + .resource = cambria_pata_resources,
267 +static struct eth_plat_info cambria_npec_data = {
273 +static struct eth_plat_info cambria_npea_data = {
279 +static struct platform_device cambria_npec_device = {
280 + .name = "ixp4xx_eth",
281 + .id = IXP4XX_ETH_NPEC,
282 + .dev.platform_data = &cambria_npec_data,
285 +static struct platform_device cambria_npea_device = {
286 + .name = "ixp4xx_eth",
287 + .id = IXP4XX_ETH_NPEA,
288 + .dev.platform_data = &cambria_npea_data,
291 +static struct gpio_led cambria_gpio_leds[] = {
293 + .name = "user", /* green led */
299 +static struct gpio_led_platform_data cambria_gpio_leds_data = {
301 + .leds = cambria_gpio_leds,
304 +static struct platform_device cambria_gpio_leds_device = {
305 + .name = "leds-gpio",
307 + .dev.platform_data = &cambria_gpio_leds_data,
311 +static struct latch_led cambria_latch_leds[] = {
313 + .name = "ledA", /* green led */
317 + .name = "ledB", /* green led */
321 + .name = "ledC", /* green led */
325 + .name = "ledD", /* green led */
329 + .name = "ledE", /* green led */
333 + .name = "ledF", /* green led */
337 + .name = "ledG", /* green led */
341 + .name = "ledH", /* green led */
346 +static struct latch_led_platform_data cambria_latch_leds_data = {
348 + .leds = cambria_latch_leds,
352 +static struct platform_device cambria_latch_leds_device = {
353 + .name = "leds-latch",
355 + .dev.platform_data = &cambria_latch_leds_data,
358 +static struct resource cambria_usb0_resources[] = {
360 + .start = 0xCD000000,
362 + .flags = IORESOURCE_MEM,
366 + .flags = IORESOURCE_IRQ,
370 +static struct resource cambria_usb1_resources[] = {
372 + .start = 0xCE000000,
374 + .flags = IORESOURCE_MEM,
378 + .flags = IORESOURCE_IRQ,
382 +static u64 ehci_dma_mask = ~(u32)0;
384 +static struct platform_device cambria_usb0_device = {
385 + .name = "ixp4xx-ehci",
388 + .dma_mask = &ehci_dma_mask,
389 + .coherent_dma_mask = 0xffffffff,
391 + .resource = cambria_usb0_resources,
392 + .num_resources = 2,
395 +static struct platform_device cambria_usb1_device = {
396 + .name = "ixp4xx-ehci",
399 + .dma_mask = &ehci_dma_mask,
400 + .coherent_dma_mask = 0xffffffff,
402 + .resource = cambria_usb1_resources,
403 + .num_resources = 2,
407 +static struct platform_device *cambria_devices[] __initdata = {
413 +static void __init cambria_gw23xx_setup(void)
415 + platform_device_register(&cambria_npec_device);
416 + platform_device_register(&cambria_npea_device);
419 +#ifdef CONFIG_SENSORS_EEPROM
420 +static void __init cambria_gw2350_setup(void)
422 + platform_device_register(&cambria_npec_device);
423 + platform_device_register(&cambria_npea_device);
425 + platform_device_register(&cambria_usb0_device);
426 + platform_device_register(&cambria_usb1_device);
428 + platform_device_register(&cambria_gpio_leds_device);
431 +static void __init cambria_gw2358_setup(void)
433 + platform_device_register(&cambria_npec_device);
434 + platform_device_register(&cambria_npea_device);
436 + platform_device_register(&cambria_usb0_device);
437 + platform_device_register(&cambria_usb1_device);
439 + platform_device_register(&cambria_pata);
441 + platform_device_register(&cambria_latch_leds_device);
444 +static struct cambria_board_info cambria_boards[] __initdata = {
447 + .setup = cambria_gw2350_setup,
450 + .setup = cambria_gw2358_setup,
454 +static struct cambria_board_info * __init cambria_find_board_info(char *model)
458 + for (i = 0; i < ARRAY_SIZE(cambria_boards); i++) {
459 + struct cambria_board_info *info = &cambria_boards[i];
460 + if (strncmp(info->model, model, strlen(info->model)) == 0)
467 +struct cambria_eeprom_header {
468 + unsigned char mac0[ETH_ALEN];
469 + unsigned char mac1[ETH_ALEN];
470 + unsigned char res0[4];
471 + unsigned char magic[2];
472 + unsigned char config[14];
473 + unsigned char model[16];
476 +static int __init cambria_eeprom_notify(struct notifier_block *self,
477 + unsigned long event, void *t)
479 + struct eeprom_data *ee = t;
480 + struct cambria_eeprom_header hdr;
483 + return NOTIFY_DONE;
485 + /* The eeprom is at address 0x51 */
486 + if (event != EEPROM_REGISTER || ee->client.addr != 0x51)
487 + return NOTIFY_DONE;
489 + ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr,
492 + if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W')
493 + return NOTIFY_DONE;
495 + memcpy(&cambria_npec_data.hwaddr, hdr.mac0, ETH_ALEN);
496 + memcpy(&cambria_npea_data.hwaddr, hdr.mac1, ETH_ALEN);
498 + cambria_info = cambria_find_board_info(hdr.model);
503 +static struct notifier_block cambria_eeprom_notifier __initdata = {
504 + .notifier_call = cambria_eeprom_notify
507 +static void __init cambria_register_eeprom_notifier(void)
509 + register_eeprom_notifier(&cambria_eeprom_notifier);
512 +static void __init cambria_unregister_eeprom_notifier(void)
514 + unregister_eeprom_notifier(&cambria_eeprom_notifier);
516 +#else /* CONFIG_SENSORS_EEPROM */
517 +static inline void cambria_register_eeprom_notifier(void) {};
518 +static inline void cambria_unregister_eeprom_notifier(void) {};
519 +#endif /* CONFIG_SENSORS_EEPROM */
521 +static void __init cambria_init(void)
525 + cambria_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
526 + cambria_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
528 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
529 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
531 + platform_add_devices(cambria_devices, ARRAY_SIZE(cambria_devices));
533 + cambria_pata_resources[0].start = 0x53e00000;
534 + cambria_pata_resources[0].end = 0x53e3ffff;
536 + cambria_pata_resources[1].start = 0x53e40000;
537 + cambria_pata_resources[1].end = 0x53e7ffff;
539 + cambria_pata_data.cs0_cfg = IXP4XX_EXP_CS3;
540 + cambria_pata_data.cs1_cfg = IXP4XX_EXP_CS3;
542 + cambria_register_eeprom_notifier();
545 +static int __init cambria_model_setup(void)
547 + if (!machine_is_cambria())
550 + if (cambria_info) {
551 + printk(KERN_DEBUG "Running on Gateworks Cambria %s\n",
552 + cambria_info->model);
553 + cambria_info->setup();
555 + printk(KERN_INFO "Unknown/missing Cambria model number"
556 + " -- defaults will be used\n");
557 + cambria_gw23xx_setup();
560 + cambria_unregister_eeprom_notifier();
563 +late_initcall(cambria_model_setup);
565 +#ifdef CONFIG_MACH_CAMBRIA
566 +MACHINE_START(CAMBRIA, "Gateworks Cambria series")
567 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
568 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
569 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
570 + .map_io = ixp4xx_map_io,
571 + .init_irq = ixp4xx_init_irq,
572 + .timer = &ixp4xx_timer,
573 + .boot_params = 0x0100,
574 + .init_machine = cambria_init,
577 Index: linux-2.6.25.4/include/asm-arm/arch-ixp4xx/hardware.h
578 ===================================================================
579 --- linux-2.6.25.4.orig/include/asm-arm/arch-ixp4xx/hardware.h
580 +++ linux-2.6.25.4/include/asm-arm/arch-ixp4xx/hardware.h
582 #define __ASM_ARCH_HARDWARE_H__
584 #define PCIBIOS_MIN_IO 0x00001000
585 -#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x40000000 : 0x48000000)
586 +#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x48000000 : 0x48000000)
589 * We override the standard dma-mask routines for bouncing.