refresh ixp4xx patches to match upstream style
[openwrt/openwrt.git] / target / linux / ixp4xx / patches-2.6.25 / 120-compex_support.patch
1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -65,6 +65,14 @@
4 Engineering Pronghorn Metro Platform. For more
5 information on this platform, see <file:Documentation/arm/IXP4xx>.
6
7 +config MACH_COMPEX
8 + bool "Compex WP18 / NP18A"
9 + select PCI
10 + help
11 + Say 'Y' here if you want your kernel to support Compex'
12 + WP18 or NP18A boards. For more information on this
13 + platform, see http://openwrt.org
14 +
15 config ARCH_IXDP425
16 bool "IXDP425"
17 help
18 --- a/arch/arm/mach-ixp4xx/Makefile
19 +++ b/arch/arm/mach-ixp4xx/Makefile
20 @@ -17,6 +17,7 @@
21 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
22 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
23 obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o
24 +obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
25
26 obj-y += common.o
27
28 @@ -32,6 +33,7 @@
29 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
30 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
31 obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o
32 +obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
33
34 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
35 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
36 --- /dev/null
37 +++ b/arch/arm/mach-ixp4xx/compex-setup.c
38 @@ -0,0 +1,120 @@
39 +/*
40 + * arch/arm/mach-ixp4xx/compex-setup.c
41 + *
42 + * Ccompex WP18 / NP18A board-setup
43 + *
44 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
45 + *
46 + * based on ixdp425-setup.c:
47 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
48 + *
49 + * Author: Imre Kaloz <Kaloz@openwrt.org>
50 + */
51 +
52 +#include <linux/kernel.h>
53 +#include <linux/init.h>
54 +#include <linux/device.h>
55 +#include <linux/serial.h>
56 +#include <linux/tty.h>
57 +#include <linux/serial_8250.h>
58 +#include <linux/slab.h>
59 +
60 +#include <asm/types.h>
61 +#include <asm/setup.h>
62 +#include <asm/memory.h>
63 +#include <asm/hardware.h>
64 +#include <asm/mach-types.h>
65 +#include <asm/irq.h>
66 +#include <asm/mach/arch.h>
67 +#include <asm/mach/flash.h>
68 +
69 +static struct flash_platform_data compex_flash_data = {
70 + .map_name = "cfi_probe",
71 + .width = 2,
72 +};
73 +
74 +static struct resource compex_flash_resource = {
75 + .flags = IORESOURCE_MEM,
76 +};
77 +
78 +static struct platform_device compex_flash = {
79 + .name = "IXP4XX-Flash",
80 + .id = 0,
81 + .dev = {
82 + .platform_data = &compex_flash_data,
83 + },
84 + .num_resources = 1,
85 + .resource = &compex_flash_resource,
86 +};
87 +
88 +static struct resource compex_uart_resources[] = {
89 + {
90 + .start = IXP4XX_UART1_BASE_PHYS,
91 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
92 + .flags = IORESOURCE_MEM
93 + },
94 + {
95 + .start = IXP4XX_UART2_BASE_PHYS,
96 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
97 + .flags = IORESOURCE_MEM
98 + }
99 +};
100 +
101 +static struct plat_serial8250_port compex_uart_data[] = {
102 + {
103 + .mapbase = IXP4XX_UART1_BASE_PHYS,
104 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
105 + .irq = IRQ_IXP4XX_UART1,
106 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
107 + .iotype = UPIO_MEM,
108 + .regshift = 2,
109 + .uartclk = IXP4XX_UART_XTAL,
110 + },
111 + {
112 + .mapbase = IXP4XX_UART2_BASE_PHYS,
113 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
114 + .irq = IRQ_IXP4XX_UART2,
115 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
116 + .iotype = UPIO_MEM,
117 + .regshift = 2,
118 + .uartclk = IXP4XX_UART_XTAL,
119 + },
120 + { },
121 +};
122 +
123 +static struct platform_device compex_uart = {
124 + .name = "serial8250",
125 + .id = PLAT8250_DEV_PLATFORM,
126 + .dev.platform_data = compex_uart_data,
127 + .num_resources = 2,
128 + .resource = compex_uart_resources,
129 +};
130 +
131 +static struct platform_device *compex_devices[] __initdata = {
132 + &compex_flash,
133 + &compex_uart
134 +};
135 +
136 +static void __init compex_init(void)
137 +{
138 + ixp4xx_sys_init();
139 +
140 + compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
141 + compex_flash_resource.end =
142 + IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
143 +
144 + platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices));
145 +}
146 +
147 +#ifdef CONFIG_MACH_COMPEX
148 +MACHINE_START(COMPEX, "Compex WP18 / NP18A")
149 + /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
150 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
151 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
152 + .map_io = ixp4xx_map_io,
153 + .init_irq = ixp4xx_init_irq,
154 + .timer = &ixp4xx_timer,
155 + .boot_params = 0x0100,
156 + .init_machine = compex_init,
157 +MACHINE_END
158 +#endif
159 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
160 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
161 @@ -66,7 +66,7 @@
162 int __init ixdp425_pci_init(void)
163 {
164 if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
165 - machine_is_ixdp465() || machine_is_kixrp435())
166 + machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex())
167 pci_common_init(&ixdp425_pci);
168 return 0;
169 }
170 --- a/arch/arm/tools/mach-types
171 +++ b/arch/arm/tools/mach-types
172 @@ -1276,7 +1276,7 @@
173 smdk6400 MACH_SMDK6400 SMDK6400 1270
174 nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271
175 greenphone MACH_GREENPHONE GREENPHONE 1272
176 -compex42x MACH_COMPEXWP18 COMPEXWP18 1273
177 +compex MACH_COMPEX COMPEX 1273
178 xmate MACH_XMATE XMATE 1274
179 energizer MACH_ENERGIZER ENERGIZER 1275
180 ime1 MACH_IME1 IME1 1276