[brcm47xx] add nvram to default packages
[openwrt.git] / target / linux / ixp4xx / patches-2.6.27 / 115-sidewinder_support.patch
1 From 60bdaaaf3446b4237566c6e04855186fc7bd766b Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Sun, 13 Jul 2008 22:46:45 +0200
4 Subject: [PATCH] Add support for the ADI Sidewinder
5
6 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
7 ---
8 arch/arm/mach-ixp4xx/Kconfig | 10 ++-
9 arch/arm/mach-ixp4xx/Makefile | 2 +
10 arch/arm/mach-ixp4xx/sidewinder-pci.c | 68 ++++++++++++++
11 arch/arm/mach-ixp4xx/sidewinder-setup.c | 151 +++++++++++++++++++++++++++++++
12 4 files changed, 230 insertions(+), 1 deletions(-)
13 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-pci.c
14 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-setup.c
15
16 --- a/arch/arm/mach-ixp4xx/Kconfig
17 +++ b/arch/arm/mach-ixp4xx/Kconfig
18 @@ -81,6 +81,14 @@ config MACH_PRONGHORN
19 config MACH_PRONGHORNMETRO
20 def_bool MACH_PRONGHORN
21
22 +config MACH_SIDEWINDER
23 + bool "ADI Sidewinder"
24 + select PCI
25 + help
26 + Say 'Y' here if you want your kernel to support the ADI
27 + Engineering Sidewinder board. For more information on this
28 + platform, see http://www.adiengineering.com
29 +
30 config ARCH_IXDP425
31 bool "IXDP425"
32 help
33 @@ -163,7 +171,7 @@ config MACH_FSG
34 #
35 config CPU_IXP46X
36 bool
37 - depends on MACH_IXDP465
38 + depends on MACH_IXDP465 || MACH_SIDEWINDER
39 default y
40
41 config CPU_IXP43X
42 --- a/arch/arm/mach-ixp4xx/Makefile
43 +++ b/arch/arm/mach-ixp4xx/Makefile
44 @@ -18,6 +18,7 @@ obj-pci-$(CONFIG_MACH_WG302V1) += wg302
45 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
46 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
47 obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
48 +obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
49
50 obj-y += common.o
51
52 @@ -34,6 +35,7 @@ obj-$(CONFIG_MACH_WG302V1) += wg302v1-se
53 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
54 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
55 obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
56 +obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
57
58 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
59 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
60 --- /dev/null
61 +++ b/arch/arm/mach-ixp4xx/sidewinder-pci.c
62 @@ -0,0 +1,68 @@
63 +/*
64 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
65 + *
66 + * PCI setup routines for ADI Engineering Sidewinder
67 + *
68 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
69 + *
70 + * based on coyote-pci.c:
71 + * Copyright (C) 2002 Jungo Software Technologies.
72 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
73 + *
74 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
75 + *
76 + * This program is free software; you can redistribute it and/or modify
77 + * it under the terms of the GNU General Public License version 2 as
78 + * published by the Free Software Foundation.
79 + *
80 + */
81 +
82 +#include <linux/kernel.h>
83 +#include <linux/pci.h>
84 +#include <linux/init.h>
85 +#include <linux/irq.h>
86 +
87 +#include <asm/mach-types.h>
88 +#include <mach/hardware.h>
89 +#include <asm/irq.h>
90 +
91 +#include <asm/mach/pci.h>
92 +
93 +void __init sidewinder_pci_preinit(void)
94 +{
95 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
96 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
97 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
98 +
99 + ixp4xx_pci_preinit();
100 +}
101 +
102 +static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
103 +{
104 + if (slot == 1)
105 + return IRQ_IXP4XX_GPIO11;
106 + else if (slot == 2)
107 + return IRQ_IXP4XX_GPIO10;
108 + else if (slot == 3)
109 + return IRQ_IXP4XX_GPIO9;
110 + else
111 + return -1;
112 +}
113 +
114 +struct hw_pci sidewinder_pci __initdata = {
115 + .nr_controllers = 1,
116 + .preinit = sidewinder_pci_preinit,
117 + .swizzle = pci_std_swizzle,
118 + .setup = ixp4xx_setup,
119 + .scan = ixp4xx_scan_bus,
120 + .map_irq = sidewinder_map_irq,
121 +};
122 +
123 +int __init sidewinder_pci_init(void)
124 +{
125 + if (machine_is_sidewinder())
126 + pci_common_init(&sidewinder_pci);
127 + return 0;
128 +}
129 +
130 +subsys_initcall(sidewinder_pci_init);
131 --- /dev/null
132 +++ b/arch/arm/mach-ixp4xx/sidewinder-setup.c
133 @@ -0,0 +1,149 @@
134 +/*
135 + * arch/arm/mach-ixp4xx/sidewinder-setup.c
136 + *
137 + * Board setup for the ADI Engineering Sidewinder
138 + *
139 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
140 + *
141 + * based on coyote-setup.c:
142 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
143 + *
144 + * Author: Imre Kaloz <Kaloz@openwrt.org>
145 + */
146 +
147 +#include <linux/kernel.h>
148 +#include <linux/serial.h>
149 +#include <linux/serial_8250.h>
150 +
151 +#include <asm/mach-types.h>
152 +#include <asm/mach/arch.h>
153 +#include <asm/mach/flash.h>
154 +
155 +static struct flash_platform_data sidewinder_flash_data = {
156 + .map_name = "cfi_probe",
157 + .width = 2,
158 +};
159 +
160 +static struct resource sidewinder_flash_resource = {
161 + .flags = IORESOURCE_MEM,
162 +};
163 +
164 +static struct platform_device sidewinder_flash = {
165 + .name = "IXP4XX-Flash",
166 + .id = 0,
167 + .dev = {
168 + .platform_data = &sidewinder_flash_data,
169 + },
170 + .num_resources = 1,
171 + .resource = &sidewinder_flash_resource,
172 +};
173 +
174 +static struct resource sidewinder_uart_resources[] = {
175 + {
176 + .start = IXP4XX_UART1_BASE_PHYS,
177 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
178 + .flags = IORESOURCE_MEM,
179 + },
180 + {
181 + .start = IXP4XX_UART2_BASE_PHYS,
182 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
183 + .flags = IORESOURCE_MEM,
184 + }
185 +};
186 +
187 +static struct plat_serial8250_port sidewinder_uart_data[] = {
188 + {
189 + .mapbase = IXP4XX_UART1_BASE_PHYS,
190 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
191 + .irq = IRQ_IXP4XX_UART1,
192 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
193 + .iotype = UPIO_MEM,
194 + .regshift = 2,
195 + .uartclk = IXP4XX_UART_XTAL,
196 + },
197 + {
198 + .mapbase = IXP4XX_UART2_BASE_PHYS,
199 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
200 + .irq = IRQ_IXP4XX_UART2,
201 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
202 + .iotype = UPIO_MEM,
203 + .regshift = 2,
204 + .uartclk = IXP4XX_UART_XTAL,
205 + },
206 + { },
207 +};
208 +
209 +static struct platform_device sidewinder_uart = {
210 + .name = "serial8250",
211 + .id = PLAT8250_DEV_PLATFORM,
212 + .dev = {
213 + .platform_data = sidewinder_uart_data,
214 + },
215 + .num_resources = ARRAY_SIZE(sidewinder_uart_resources),
216 + .resource = sidewinder_uart_resources,
217 +};
218 +
219 +static struct eth_plat_info sidewinder_plat_eth[] = {
220 + {
221 + .phy = 5,
222 + .rxq = 3,
223 + .txreadyq = 20,
224 + }, {
225 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
226 + .phy_mask = 0x1e,
227 + .rxq = 4,
228 + .txreadyq = 21,
229 + }, {
230 + .phy = 31,
231 + .rxq = 2,
232 + .txreadyq = 19,
233 + }
234 +};
235 +
236 +static struct platform_device sidewinder_eth[] = {
237 + {
238 + .name = "ixp4xx_eth",
239 + .id = IXP4XX_ETH_NPEB,
240 + .dev.platform_data = sidewinder_plat_eth,
241 + }, {
242 + .name = "ixp4xx_eth",
243 + .id = IXP4XX_ETH_NPEC,
244 + .dev.platform_data = sidewinder_plat_eth + 1,
245 + }, {
246 + .name = "ixp4xx_eth",
247 + .id = IXP4XX_ETH_NPEA,
248 + .dev.platform_data = sidewinder_plat_eth + 2,
249 + }
250 +};
251 +
252 +static struct platform_device *sidewinder_devices[] __initdata = {
253 + &sidewinder_flash,
254 + &sidewinder_uart,
255 + &sidewinder_eth[0],
256 + &sidewinder_eth[1],
257 + &sidewinder_eth[2],
258 +};
259 +
260 +static void __init sidewinder_init(void)
261 +{
262 + ixp4xx_sys_init();
263 +
264 + sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
265 + sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1;
266 +
267 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
268 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
269 +
270 + platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices));
271 +}
272 +
273 +MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder")
274 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
275 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
276 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
277 + .map_io = ixp4xx_map_io,
278 + .init_irq = ixp4xx_init_irq,
279 + .timer = &ixp4xx_timer,
280 + .boot_params = 0x0100,
281 + .init_machine = sidewinder_init,
282 +MACHINE_END
This page took 0.085669 seconds and 5 git commands to generate.