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