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