ixp4xx: Add support for 4.4 kernel, refresh patches
[openwrt/staging/yousong.git] / target / linux / ixp4xx / patches-4.1 / 150-lanready_ap1000_support.patch
1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -101,6 +101,14 @@ config MACH_WRT300NV2
4 WRT300N v2 router. For more information on this
5 platform, see http://openwrt.org
6
7 +config MACH_AP1000
8 + bool "Lanready AP-1000"
9 + select PCI
10 + help
11 + Say 'Y' here if you want your kernel to support Lanready's
12 + AP1000 board. For more information on this
13 + platform, see http://openwrt.org
14 +
15 config ARCH_IXDP425
16 bool "IXDP425"
17 help
18 --- a/arch/arm/mach-ixp4xx/Makefile
19 +++ b/arch/arm/mach-ixp4xx/Makefile
20 @@ -23,6 +23,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORN) += pron
21 obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
22 obj-pci-$(CONFIG_MACH_COMPEXWP18) += ixdp425-pci.o
23 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
24 +obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
25
26 obj-y += common.o
27
28 @@ -47,6 +48,7 @@ obj-$(CONFIG_MACH_PRONGHORN) += pronghor
29 obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
30 obj-$(CONFIG_MACH_COMPEXWP18) += compex42x-setup.o
31 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
32 +obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
33
34 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
35 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
36 --- /dev/null
37 +++ b/arch/arm/mach-ixp4xx/ap1000-setup.c
38 @@ -0,0 +1,154 @@
39 +/*
40 + * arch/arm/mach-ixp4xx/ap1000-setup.c
41 + *
42 + * Lanready AP-1000
43 + *
44 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
45 + *
46 + * based on ixdp425-setup.c:
47 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
48 + *
49 + * Author: Imre Kaloz <Kaloz@openwrt.org>
50 + */
51 +
52 +#include <linux/kernel.h>
53 +#include <linux/init.h>
54 +#include <linux/device.h>
55 +#include <linux/serial.h>
56 +#include <linux/tty.h>
57 +#include <linux/serial_8250.h>
58 +#include <linux/slab.h>
59 +#include <linux/dma-mapping.h>
60 +
61 +#include <asm/types.h>
62 +#include <asm/setup.h>
63 +#include <asm/memory.h>
64 +#include <mach/hardware.h>
65 +#include <asm/mach-types.h>
66 +#include <asm/irq.h>
67 +#include <asm/mach/arch.h>
68 +#include <asm/mach/flash.h>
69 +
70 +static struct flash_platform_data ap1000_flash_data = {
71 + .map_name = "cfi_probe",
72 + .width = 2,
73 +};
74 +
75 +static struct resource ap1000_flash_resource = {
76 + .flags = IORESOURCE_MEM,
77 +};
78 +
79 +static struct platform_device ap1000_flash = {
80 + .name = "IXP4XX-Flash",
81 + .id = 0,
82 + .dev = {
83 + .platform_data = &ap1000_flash_data,
84 + },
85 + .num_resources = 1,
86 + .resource = &ap1000_flash_resource,
87 +};
88 +
89 +static struct resource ap1000_uart_resources[] = {
90 + {
91 + .start = IXP4XX_UART1_BASE_PHYS,
92 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
93 + .flags = IORESOURCE_MEM
94 + },
95 + {
96 + .start = IXP4XX_UART2_BASE_PHYS,
97 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
98 + .flags = IORESOURCE_MEM
99 + }
100 +};
101 +
102 +static struct plat_serial8250_port ap1000_uart_data[] = {
103 + {
104 + .mapbase = IXP4XX_UART1_BASE_PHYS,
105 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
106 + .irq = IRQ_IXP4XX_UART1,
107 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
108 + .iotype = UPIO_MEM,
109 + .regshift = 2,
110 + .uartclk = IXP4XX_UART_XTAL,
111 + },
112 + {
113 + .mapbase = IXP4XX_UART2_BASE_PHYS,
114 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
115 + .irq = IRQ_IXP4XX_UART2,
116 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
117 + .iotype = UPIO_MEM,
118 + .regshift = 2,
119 + .uartclk = IXP4XX_UART_XTAL,
120 + },
121 + { },
122 +};
123 +
124 +static struct platform_device ap1000_uart = {
125 + .name = "serial8250",
126 + .id = PLAT8250_DEV_PLATFORM,
127 + .dev.platform_data = ap1000_uart_data,
128 + .num_resources = 2,
129 + .resource = ap1000_uart_resources
130 +};
131 +
132 +static struct platform_device *ap1000_devices[] __initdata = {
133 + &ap1000_flash,
134 + &ap1000_uart
135 +};
136 +
137 +static char ap1000_mem_fixup[] __initdata = "mem=64M ";
138 +
139 +static void __init ap1000_fixup(struct machine_desc *desc,
140 + struct tag *tags, char **cmdline, struct meminfo *mi)
141 +
142 +{
143 + struct tag *t = tags;
144 + char *p = *cmdline;
145 +
146 + /* Find the end of the tags table, taking note of any cmdline tag. */
147 + for (; t->hdr.size; t = tag_next(t)) {
148 + if (t->hdr.tag == ATAG_CMDLINE) {
149 + p = t->u.cmdline.cmdline;
150 + }
151 + }
152 +
153 + /* Overwrite the end of the table with a new cmdline tag. */
154 + t->hdr.tag = ATAG_CMDLINE;
155 + t->hdr.size = (sizeof (struct tag_header) +
156 + strlen(ap1000_mem_fixup) + strlen(p) + 1 + 4) >> 2;
157 + strlcpy(t->u.cmdline.cmdline, ap1000_mem_fixup, COMMAND_LINE_SIZE);
158 + strlcpy(t->u.cmdline.cmdline + strlen(ap1000_mem_fixup), p,
159 + COMMAND_LINE_SIZE - strlen(ap1000_mem_fixup));
160 +
161 + /* Terminate the table. */
162 + t = tag_next(t);
163 + t->hdr.tag = ATAG_NONE;
164 + t->hdr.size = 0;
165 +}
166 +
167 +static void __init ap1000_init(void)
168 +{
169 + ixp4xx_sys_init();
170 +
171 + ap1000_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
172 + ap1000_flash_resource.end =
173 + IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
174 +
175 + platform_add_devices(ap1000_devices, ARRAY_SIZE(ap1000_devices));
176 +}
177 +
178 +#ifdef CONFIG_MACH_AP1000
179 +MACHINE_START(AP1000, "Lanready AP-1000")
180 + /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
181 + .fixup = ap1000_fixup,
182 + .map_io = ixp4xx_map_io,
183 + .init_irq = ixp4xx_init_irq,
184 + .init_time = ixp4xx_timer_init,
185 + .atag_offset = 0x0100,
186 + .init_machine = ap1000_init,
187 +#if defined(CONFIG_PCI)
188 + .dma_zone_size = SZ_64M,
189 +#endif
190 + .restart = ixp4xx_restart,
191 +MACHINE_END
192 +#endif
193 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
194 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
195 @@ -70,7 +70,7 @@ int __init ixdp425_pci_init(void)
196 {
197 if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
198 machine_is_ixdp465() || machine_is_kixrp435() ||
199 - machine_is_compex42x())
200 + machine_is_compex42x() || machine_is_ap1000())
201 pci_common_init(&ixdp425_pci);
202 return 0;
203 }