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