ixp4xx 2.6.26 support
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx / patches-2.6.26 / 140-sidewinder_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_SIDEWINDER
8 + bool "Sidewinder"
9 + select PCI
10 + help
11 + Say 'Y' here if you want your kernel to support the ADI
12 + Engineering Sidewinder Platform. For more
13 + information on this platform, see <file:Documentation/arm/IXP4xx>.
14 +
15 config MACH_COMPEX
16 bool "Compex WP18 / NP18A"
17 select PCI
18 @@ -163,7 +171,7 @@
19 #
20 config CPU_IXP46X
21 bool
22 - depends on MACH_IXDP465
23 + depends on MACH_IXDP465 || MACH_SIDEWINDER
24 default y
25
26 config CPU_IXP43X
27 --- a/arch/arm/mach-ixp4xx/Makefile
28 +++ b/arch/arm/mach-ixp4xx/Makefile
29 @@ -19,6 +19,7 @@
30 obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o
31 obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
32 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
33 +obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
34
35 obj-y += common.o
36
37 @@ -36,6 +37,7 @@
38 obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o
39 obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
40 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
41 +obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
42
43 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
44 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
45 --- /dev/null
46 +++ b/arch/arm/mach-ixp4xx/sidewinder-pci.c
47 @@ -0,0 +1,71 @@
48 +/*
49 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
50 + *
51 + * PCI setup routines for ADI Engineering Sidewinder
52 + *
53 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
54 + *
55 + * based on coyote-pci.c:
56 + * Copyright (C) 2002 Jungo Software Technologies.
57 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
58 + *
59 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
60 + *
61 + * This program is free software; you can redistribute it and/or modify
62 + * it under the terms of the GNU General Public License version 2 as
63 + * published by the Free Software Foundation.
64 + *
65 + */
66 +
67 +#include <linux/kernel.h>
68 +#include <linux/pci.h>
69 +#include <linux/init.h>
70 +#include <linux/irq.h>
71 +
72 +#include <asm/mach-types.h>
73 +#include <asm/hardware.h>
74 +#include <asm/irq.h>
75 +
76 +#include <asm/mach/pci.h>
77 +
78 +extern void ixp4xx_pci_preinit(void);
79 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
80 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
81 +
82 +void __init sidewinder_pci_preinit(void)
83 +{
84 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
85 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW);
86 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW);
87 +
88 + ixp4xx_pci_preinit();
89 +}
90 +
91 +static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
92 +{
93 + if (slot == 1)
94 + return IRQ_IXP4XX_GPIO11;
95 + else if (slot == 2)
96 + return IRQ_IXP4XX_GPIO10;
97 + else if (slot == 3)
98 + return IRQ_IXP4XX_GPIO9;
99 + else return -1;
100 +}
101 +
102 +struct hw_pci sidewinder_pci __initdata = {
103 + .nr_controllers = 1,
104 + .preinit = sidewinder_pci_preinit,
105 + .swizzle = pci_std_swizzle,
106 + .setup = ixp4xx_setup,
107 + .scan = ixp4xx_scan_bus,
108 + .map_irq = sidewinder_map_irq,
109 +};
110 +
111 +int __init sidewinder_pci_init(void)
112 +{
113 + if (machine_is_sidewinder())
114 + pci_common_init(&sidewinder_pci);
115 + return 0;
116 +}
117 +
118 +subsys_initcall(sidewinder_pci_init);
119 --- /dev/null
120 +++ b/arch/arm/mach-ixp4xx/sidewinder-setup.c
121 @@ -0,0 +1,115 @@
122 +/*
123 + * arch/arm/mach-ixp4xx/sidewinder-setup.c
124 + *
125 + * Board setup for the ADI Engineering Sidewinder
126 + *
127 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
128 + *
129 + * based on coyote-setup.c:
130 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
131 + *
132 + * Author: Imre Kaloz <Kaloz@openwrt.org>
133 + */
134 +
135 +#include <linux/kernel.h>
136 +#include <linux/serial.h>
137 +#include <linux/serial_8250.h>
138 +
139 +#include <asm/mach-types.h>
140 +#include <asm/mach/arch.h>
141 +#include <asm/mach/flash.h>
142 +
143 +static struct flash_platform_data sidewinder_flash_data = {
144 + .map_name = "cfi_probe",
145 + .width = 2,
146 +};
147 +
148 +static struct resource sidewinder_flash_resource = {
149 + .flags = IORESOURCE_MEM,
150 +};
151 +
152 +static struct platform_device sidewinder_flash = {
153 + .name = "IXP4XX-Flash",
154 + .id = 0,
155 + .dev = {
156 + .platform_data = &sidewinder_flash_data,
157 + },
158 + .num_resources = 1,
159 + .resource = &sidewinder_flash_resource,
160 +};
161 +
162 +static struct resource sidewinder_uart_resources[] = {
163 + {
164 + .start = IXP4XX_UART1_BASE_PHYS,
165 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
166 + .flags = IORESOURCE_MEM,
167 + },
168 + {
169 + .start = IXP4XX_UART2_BASE_PHYS,
170 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
171 + .flags = IORESOURCE_MEM,
172 + }
173 +};
174 +
175 +static struct plat_serial8250_port sidewinder_uart_data[] = {
176 + {
177 + .mapbase = IXP4XX_UART1_BASE_PHYS,
178 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
179 + .irq = IRQ_IXP4XX_UART1,
180 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
181 + .iotype = UPIO_MEM,
182 + .regshift = 2,
183 + .uartclk = IXP4XX_UART_XTAL,
184 + },
185 + {
186 + .mapbase = IXP4XX_UART2_BASE_PHYS,
187 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
188 + .irq = IRQ_IXP4XX_UART2,
189 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
190 + .iotype = UPIO_MEM,
191 + .regshift = 2,
192 + .uartclk = IXP4XX_UART_XTAL,
193 + },
194 + { },
195 +};
196 +
197 +static struct platform_device sidewinder_uart = {
198 + .name = "serial8250",
199 + .id = PLAT8250_DEV_PLATFORM,
200 + .dev = {
201 + .platform_data = sidewinder_uart_data,
202 + },
203 + .num_resources = ARRAY_SIZE(sidewinder_uart_resources),
204 + .resource = sidewinder_uart_resources,
205 +};
206 +
207 +static struct platform_device *sidewinder_devices[] __initdata = {
208 + &sidewinder_flash,
209 + &sidewinder_uart,
210 +};
211 +
212 +static void __init sidewinder_init(void)
213 +{
214 + ixp4xx_sys_init();
215 +
216 + sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
217 + sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1;
218 +
219 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
220 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
221 +
222 + platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices));
223 +}
224 +
225 +#ifdef CONFIG_MACH_SIDEWINDER
226 +MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder")
227 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
228 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
229 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
230 + .map_io = ixp4xx_map_io,
231 + .init_irq = ixp4xx_init_irq,
232 + .timer = &ixp4xx_timer,
233 + .boot_params = 0x0100,
234 + .init_machine = sidewinder_init,
235 +MACHINE_END
236 +#endif