ar71xx: override mtd partitions for the TEW-632BRP family
[openwrt.git] / target / linux / ixp4xx / patches-2.6.31 / 150-lanready_ap1000_support.patch
1 --- /dev/null
2 +++ b/arch/arm/mach-ixp4xx/ap1000-setup.c
3 @@ -0,0 +1,151 @@
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 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
146 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
147 + .fixup = ap1000_fixup,
148 + .map_io = ixp4xx_map_io,
149 + .init_irq = ixp4xx_init_irq,
150 + .timer = &ixp4xx_timer,
151 + .boot_params = 0x0100,
152 + .init_machine = ap1000_init,
153 +MACHINE_END
154 +#endif
155 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
156 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
157 @@ -67,7 +67,7 @@ int __init ixdp425_pci_init(void)
158 {
159 if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
160 machine_is_ixdp465() || machine_is_kixrp435() ||
161 - machine_is_compex())
162 + machine_is_compex() || machine_is_ap1000())
163 pci_common_init(&ixdp425_pci);
164 return 0;
165 }
166 --- a/arch/arm/mach-ixp4xx/Kconfig
167 +++ b/arch/arm/mach-ixp4xx/Kconfig
168 @@ -105,6 +105,14 @@ config MACH_WRT300NV2
169 WRT300N v2 router. For more information on this
170 platform, see http://openwrt.org
171
172 +config MACH_AP1000
173 + bool "Lanready AP-1000"
174 + select PCI
175 + help
176 + Say 'Y' here if you want your kernel to support Lanready's
177 + AP1000 board. For more information on this
178 + platform, see http://openwrt.org
179 +
180 config ARCH_IXDP425
181 bool "IXDP425"
182 help
183 --- a/arch/arm/mach-ixp4xx/Makefile
184 +++ b/arch/arm/mach-ixp4xx/Makefile
185 @@ -21,6 +21,7 @@ obj-pci-$(CONFIG_MACH_PRONGHORN) += pron
186 obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
187 obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
188 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
189 +obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
190
191 obj-y += common.o
192
193 @@ -41,6 +42,7 @@ obj-$(CONFIG_MACH_PRONGHORN) += pronghor
194 obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
195 obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
196 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
197 +obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
198
199 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
200 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
This page took 0.070281 seconds and 5 git commands to generate.