[ixp4xx]: refresh 2.6.36 patches
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx / patches-2.6.36 / 120-compex_support.patch
1 From 24025a2dcf1248079dd3019fac6ed955252d277f Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Mon, 14 Jul 2008 21:56:34 +0200
4 Subject: [PATCH] Add support for the Compex WP18 / NP18A boards
5
6 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
7 ---
8 arch/arm/mach-ixp4xx/Kconfig | 8 ++
9 arch/arm/mach-ixp4xx/Makefile | 2 +
10 arch/arm/mach-ixp4xx/compex-setup.c | 136 +++++++++++++++++++++++++++++++++++
11 arch/arm/mach-ixp4xx/ixdp425-pci.c | 3 +-
12 arch/arm/tools/mach-types | 2 +-
13 5 files changed, 149 insertions(+), 2 deletions(-)
14 create mode 100644 arch/arm/mach-ixp4xx/compex-setup.c
15
16 --- a/arch/arm/mach-ixp4xx/Kconfig
17 +++ b/arch/arm/mach-ixp4xx/Kconfig
18 @@ -89,6 +89,14 @@ config MACH_SIDEWINDER
19 Engineering Sidewinder board. For more information on this
20 platform, see http://www.adiengineering.com
21
22 +config MACH_COMPEX
23 + bool "Compex WP18 / NP18A"
24 + select PCI
25 + help
26 + Say 'Y' here if you want your kernel to support Compex'
27 + WP18 or NP18A boards. For more information on this
28 + platform, see http://www.compex.com.sg/home/OEM/product_ap.htm
29 +
30 config ARCH_IXDP425
31 bool "IXDP425"
32 help
33 --- a/arch/arm/mach-ixp4xx/Makefile
34 +++ b/arch/arm/mach-ixp4xx/Makefile
35 @@ -20,6 +20,7 @@ obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
36 obj-pci-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-pci.o
37 obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
38 obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
39 +obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
40
41 obj-y += common.o
42
43 @@ -39,6 +40,7 @@ obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_
44 obj-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-setup.o
45 obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
46 obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
47 +obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
48
49 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
50 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
51 --- /dev/null
52 +++ b/arch/arm/mach-ixp4xx/compex-setup.c
53 @@ -0,0 +1,136 @@
54 +/*
55 + * arch/arm/mach-ixp4xx/compex-setup.c
56 + *
57 + * Compex WP18 / NP18A board-setup
58 + *
59 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
60 + *
61 + * based on coyote-setup.c:
62 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
63 + *
64 + * Author: Imre Kaloz <Kaloz@openwrt.org>
65 + */
66 +
67 +#include <linux/kernel.h>
68 +#include <linux/serial.h>
69 +#include <linux/serial_8250.h>
70 +
71 +#include <asm/mach-types.h>
72 +#include <asm/mach/arch.h>
73 +#include <asm/mach/flash.h>
74 +
75 +static struct flash_platform_data compex_flash_data = {
76 + .map_name = "cfi_probe",
77 + .width = 2,
78 +};
79 +
80 +static struct resource compex_flash_resource = {
81 + .flags = IORESOURCE_MEM,
82 +};
83 +
84 +static struct platform_device compex_flash = {
85 + .name = "IXP4XX-Flash",
86 + .id = 0,
87 + .dev = {
88 + .platform_data = &compex_flash_data,
89 + },
90 + .num_resources = 1,
91 + .resource = &compex_flash_resource,
92 +};
93 +
94 +static struct resource compex_uart_resources[] = {
95 + {
96 + .start = IXP4XX_UART1_BASE_PHYS,
97 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
98 + .flags = IORESOURCE_MEM
99 + },
100 + {
101 + .start = IXP4XX_UART2_BASE_PHYS,
102 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
103 + .flags = IORESOURCE_MEM
104 + }
105 +};
106 +
107 +static struct plat_serial8250_port compex_uart_data[] = {
108 + {
109 + .mapbase = IXP4XX_UART1_BASE_PHYS,
110 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
111 + .irq = IRQ_IXP4XX_UART1,
112 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
113 + .iotype = UPIO_MEM,
114 + .regshift = 2,
115 + .uartclk = IXP4XX_UART_XTAL,
116 + },
117 + {
118 + .mapbase = IXP4XX_UART2_BASE_PHYS,
119 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
120 + .irq = IRQ_IXP4XX_UART2,
121 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
122 + .iotype = UPIO_MEM,
123 + .regshift = 2,
124 + .uartclk = IXP4XX_UART_XTAL,
125 + },
126 + { },
127 +};
128 +
129 +static struct platform_device compex_uart = {
130 + .name = "serial8250",
131 + .id = PLAT8250_DEV_PLATFORM,
132 + .dev.platform_data = compex_uart_data,
133 + .num_resources = 2,
134 + .resource = compex_uart_resources,
135 +};
136 +
137 +static struct eth_plat_info compex_plat_eth[] = {
138 + {
139 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
140 + .phy_mask = 0xf0000,
141 + .rxq = 3,
142 + .txreadyq = 20,
143 + }, {
144 + .phy = 3,
145 + .rxq = 4,
146 + .txreadyq = 21,
147 + }
148 +};
149 +
150 +static struct platform_device compex_eth[] = {
151 + {
152 + .name = "ixp4xx_eth",
153 + .id = IXP4XX_ETH_NPEB,
154 + .dev.platform_data = compex_plat_eth,
155 + }, {
156 + .name = "ixp4xx_eth",
157 + .id = IXP4XX_ETH_NPEC,
158 + .dev.platform_data = compex_plat_eth + 1,
159 + }
160 +};
161 +
162 +static struct platform_device *compex_devices[] __initdata = {
163 + &compex_flash,
164 + &compex_uart,
165 + &compex_eth[0],
166 + &compex_eth[1],
167 +};
168 +
169 +static void __init compex_init(void)
170 +{
171 + ixp4xx_sys_init();
172 +
173 + compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
174 + compex_flash_resource.end =
175 + IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
176 +
177 + platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices));
178 +}
179 +
180 +MACHINE_START(COMPEX, "Compex WP18 / NP18A")
181 + /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
182 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
183 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
184 + .map_io = ixp4xx_map_io,
185 + .init_irq = ixp4xx_init_irq,
186 + .timer = &ixp4xx_timer,
187 + .boot_params = 0x0100,
188 + .init_machine = compex_init,
189 +MACHINE_END
190 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
191 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
192 @@ -70,7 +70,8 @@ struct hw_pci ixdp425_pci __initdata = {
193 int __init ixdp425_pci_init(void)
194 {
195 if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
196 - machine_is_ixdp465() || machine_is_kixrp435())
197 + machine_is_ixdp465() || machine_is_kixrp435() ||
198 + machine_is_compex())
199 pci_common_init(&ixdp425_pci);
200 return 0;
201 }
202 --- a/arch/arm/tools/mach-types
203 +++ b/arch/arm/tools/mach-types
204 @@ -1273,7 +1273,7 @@ oiab MACH_OIAB OIAB 1269
205 smdk6400 MACH_SMDK6400 SMDK6400 1270
206 nokia_n800 MACH_NOKIA_N800 NOKIA_N800 1271
207 greenphone MACH_GREENPHONE GREENPHONE 1272
208 -compex42x MACH_COMPEXWP18 COMPEXWP18 1273
209 +compex MACH_COMPEX COMPEX 1273
210 xmate MACH_XMATE XMATE 1274
211 energizer MACH_ENERGIZER ENERGIZER 1275
212 ime1 MACH_IME1 IME1 1276