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