lantiq: remove linux 3.10 support
[openwrt/openwrt.git] / target / linux / ixp4xx / patches-3.10 / 530-ap42x_support.patch
1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -8,6 +8,14 @@ menu "Intel IXP4xx Implementation Option
4
5 comment "IXP4xx Platforms"
6
7 +config MACH_AP42X
8 + bool "Tonze AP-422/425"
9 + select PCI
10 + help
11 + Say 'Y' here if you want your kernel to support Tonze's
12 + AP-422/425 boards. For more information on this platform,
13 + see http://tonze.com.tw
14 +
15 config MACH_NSLU2
16 bool
17 prompt "Linksys NSLU2"
18 --- a/arch/arm/mach-ixp4xx/Makefile
19 +++ b/arch/arm/mach-ixp4xx/Makefile
20 @@ -5,6 +5,7 @@
21 obj-pci-y :=
22 obj-pci-n :=
23
24 +obj-pci-$(CONFIG_MACH_AP42X) += ap42x-pci.o
25 obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
26 obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
27 obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o
28 @@ -32,6 +33,7 @@ obj-pci-$(CONFIG_MACH_USR8200) += usr82
29
30 obj-y += common.o
31
32 +obj-$(CONFIG_MACH_AP42X) += ap42x-setup.o
33 obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
34 obj-$(CONFIG_MACH_AVILA) += avila-setup.o
35 obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o
36 --- /dev/null
37 +++ b/arch/arm/mach-ixp4xx/ap42x-pci.c
38 @@ -0,0 +1,63 @@
39 +/*
40 + * arch/arch/mach-ixp4xx/ap42x-pci.c
41 + *
42 + * PCI setup routines for Tonze AP-422/425
43 + *
44 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
45 + *
46 + * based on coyote-pci.c:
47 + * Copyright (C) 2002 Jungo Software Technologies.
48 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
49 + *
50 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
51 + *
52 + * This program is free software; you can redistribute it and/or modify
53 + * it under the terms of the GNU General Public License version 2 as
54 + * published by the Free Software Foundation.
55 + *
56 + */
57 +
58 +#include <linux/kernel.h>
59 +#include <linux/pci.h>
60 +#include <linux/init.h>
61 +#include <linux/irq.h>
62 +
63 +#include <asm/mach-types.h>
64 +#include <mach/hardware.h>
65 +
66 +#include <asm/mach/pci.h>
67 +
68 +void __init ap42x_pci_preinit(void)
69 +{
70 + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
71 + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
72 +
73 + ixp4xx_pci_preinit();
74 +}
75 +
76 +static int __init ap42x_map_irq(const struct pci_dev *dev, u8 slot,
77 + u8 pin)
78 +{
79 + if (slot == 1)
80 + return IRQ_IXP4XX_GPIO11;
81 + else if (slot == 2)
82 + return IRQ_IXP4XX_GPIO10;
83 + else return -1;
84 +}
85 +
86 +struct hw_pci ap42x_pci __initdata = {
87 + .nr_controllers = 1,
88 + .preinit = ap42x_pci_preinit,
89 + .ops = &ixp4xx_ops,
90 + .setup = ixp4xx_setup,
91 + .map_irq = ap42x_map_irq,
92 +};
93 +
94 +int __init ap42x_pci_init(void)
95 +{
96 + if (machine_is_ap42x())
97 + pci_common_init(&ap42x_pci);
98 + return 0;
99 +}
100 +
101 +subsys_initcall(ap42x_pci_init);
102 --- /dev/null
103 +++ b/arch/arm/mach-ixp4xx/ap42x-setup.c
104 @@ -0,0 +1,166 @@
105 +/*
106 + * arch/arm/mach-ixp4xx/ap42x-setup.c
107 + *
108 + * Board setup for the Tonze AP-42x boards
109 + *
110 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
111 + *
112 + * based on coyote-setup.c:
113 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
114 + *
115 + * Author: Imre Kaloz <Kaloz@openwrt.org>
116 + */
117 +
118 +#include <linux/kernel.h>
119 +#include <linux/init.h>
120 +#include <linux/device.h>
121 +#include <linux/serial.h>
122 +#include <linux/tty.h>
123 +#include <linux/serial_8250.h>
124 +#include <linux/mtd/physmap.h>
125 +#include <linux/dma-mapping.h>
126 +
127 +#include <asm/types.h>
128 +#include <asm/setup.h>
129 +#include <asm/memory.h>
130 +#include <mach/hardware.h>
131 +#include <asm/irq.h>
132 +#include <asm/mach-types.h>
133 +#include <asm/mach/arch.h>
134 +#include <asm/mach/flash.h>
135 +
136 +static struct mtd_partition ap42x_flash_partitions[] = {
137 + {
138 + .name = "RedBoot",
139 + .offset = 0x00000000,
140 + .size = 0x00080000,
141 + }, {
142 + .name = "linux",
143 + .offset = 0x00080000,
144 + .size = 0x00100000,
145 + }, {
146 + .name = "rootfs",
147 + .offset = 0x00180000,
148 + .size = 0x00660000,
149 + }, {
150 + .name = "FIS directory",
151 + .offset = 0x007f8000,
152 + .size = 0x00007000,
153 + }, {
154 + .name = "RedBoot config",
155 + .offset = 0x007ff000,
156 + .size = 0x00001000,
157 + },
158 +};
159 +
160 +static struct physmap_flash_data ap42x_flash_data = {
161 + .width = 2,
162 + .parts = ap42x_flash_partitions,
163 + .nr_parts = ARRAY_SIZE(ap42x_flash_partitions),
164 +};
165 +
166 +static struct resource ap42x_flash_resource = {
167 + .flags = IORESOURCE_MEM,
168 + .start = IXP4XX_EXP_BUS_BASE_PHYS,
169 + .end = IXP4XX_EXP_BUS_BASE_PHYS + SZ_8M - 1,
170 +};
171 +
172 +static struct platform_device ap42x_flash = {
173 + .name = "physmap-flash",
174 + .id = 0,
175 + .dev = {
176 + .platform_data = &ap42x_flash_data,
177 + },
178 + .num_resources = 1,
179 + .resource = &ap42x_flash_resource,
180 +};
181 +
182 +static struct resource ap42x_uart_resource = {
183 + .start = IXP4XX_UART2_BASE_PHYS,
184 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
185 + .flags = IORESOURCE_MEM,
186 +};
187 +
188 +static struct plat_serial8250_port ap42x_uart_data[] = {
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 ap42x_uart = {
202 + .name = "serial8250",
203 + .id = PLAT8250_DEV_PLATFORM,
204 + .dev = {
205 + .platform_data = ap42x_uart_data,
206 + },
207 + .num_resources = 1,
208 + .resource = &ap42x_uart_resource,
209 +};
210 +
211 +static struct eth_plat_info ap42x_plat_eth[] = {
212 + {
213 + .phy = 2,
214 + .rxq = 3,
215 + .txreadyq = 20,
216 + }, {
217 + .phy = 1,
218 + .rxq = 4,
219 + .txreadyq = 21,
220 + }
221 +};
222 +
223 +static struct platform_device ap42x_eth[] = {
224 + {
225 + .name = "ixp4xx_eth",
226 + .id = IXP4XX_ETH_NPEB,
227 + .dev.platform_data = ap42x_plat_eth,
228 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
229 + }, {
230 + .name = "ixp4xx_eth",
231 + .id = IXP4XX_ETH_NPEC,
232 + .dev.platform_data = ap42x_plat_eth + 1,
233 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
234 + }
235 +};
236 +
237 +static struct platform_device *ap42x_devices[] __initdata = {
238 + &ap42x_flash,
239 + &ap42x_uart,
240 + &ap42x_eth[0],
241 + &ap42x_eth[1],
242 +};
243 +
244 +static void __init ap42x_init(void)
245 +{
246 + ixp4xx_sys_init();
247 +
248 + ap42x_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
249 + ap42x_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
250 +
251 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
252 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
253 +
254 + platform_add_devices(ap42x_devices, ARRAY_SIZE(ap42x_devices));
255 +}
256 +
257 +#ifdef CONFIG_MACH_AP42X
258 +MACHINE_START(AP42X, "Tonze AP-422/425")
259 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
260 + .map_io = ixp4xx_map_io,
261 + .init_irq = ixp4xx_init_irq,
262 + .init_time = ixp4xx_timer_init,
263 + .atag_offset = 0x100,
264 + .init_machine = ap42x_init,
265 +#if defined(CONFIG_PCI)
266 + .dma_zone_size = SZ_64M,
267 +#endif
268 + .restart = ixp4xx_restart,
269 +MACHINE_END
270 +#endif
271 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
272 +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
273 @@ -45,7 +45,8 @@ static __inline__ void __arch_decomp_set
274 machine_is_devixp() || machine_is_miccpt() || machine_is_mic256() ||
275 machine_is_pronghorn() || machine_is_pronghorn_metro() ||
276 machine_is_wrt300nv2() || machine_is_tw5334() ||
277 - machine_is_usr8200() || machine_is_tw2662())
278 + machine_is_usr8200() || machine_is_tw2662() ||
279 + machine_is_ap42x())
280 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
281 else
282 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;