ixp4xx 2.6.26 support
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx / patches-2.6.26 / 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 <asm/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 @@ -66,7 +66,8 @@
158 int __init ixdp425_pci_init(void)
159 {
160 if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
161 - machine_is_ixdp465() || machine_is_kixrp435() || machine_is_compex())
162 + machine_is_ixdp465() || machine_is_kixrp435() ||
163 + machine_is_compex() || machine_is_ap1000())
164 pci_common_init(&ixdp425_pci);
165 return 0;
166 }
167 --- a/arch/arm/mach-ixp4xx/Kconfig
168 +++ b/arch/arm/mach-ixp4xx/Kconfig
169 @@ -89,6 +89,14 @@
170 WRT300N v2 router. For more information on this
171 platform, see http://openwrt.org
172
173 +config MACH_AP1000
174 + bool "Lanready AP-1000"
175 + select PCI
176 + help
177 + Say 'Y' here if you want your kernel to support Lanready's
178 + AP1000 board. For more information on this
179 + platform, see http://openwrt.org
180 +
181 config ARCH_IXDP425
182 bool "IXDP425"
183 help
184 --- a/arch/arm/mach-ixp4xx/Makefile
185 +++ b/arch/arm/mach-ixp4xx/Makefile
186 @@ -20,6 +20,7 @@
187 obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
188 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
189 obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
190 +obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
191
192 obj-y += common.o
193
194 @@ -38,6 +39,7 @@
195 obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
196 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
197 obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
198 +obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
199
200 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
201 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o