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