Root/target/linux/ixp4xx/patches-3.3/150-lanready_ap1000_support.patch

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

Archive Download this file



interactive