30a7c55ae0cad829eac869b2be52c8db68c40ad3
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 130-wrt300nv2_support.patch
1 Index: linux-2.6.24/arch/arm/mach-ixp4xx/Kconfig
2 ===================================================================
3 --- linux-2.6.24.orig/arch/arm/mach-ixp4xx/Kconfig 2008-03-12 21:21:26.000000000 +1030
4 +++ linux-2.6.24/arch/arm/mach-ixp4xx/Kconfig 2008-03-12 21:21:27.000000000 +1030
5 @@ -73,6 +73,14 @@
6 WP18 or NP18A boards. For more information on this
7 platform, see http://openwrt.org
8
9 +config MACH_WRT300NV2
10 + bool "Linksys WRT300N v2"
11 + select PCI
12 + help
13 + Say 'Y' here if you want your kernel to support Linksys'
14 + WRT300N v2 router. For more information on this
15 + platform, see http://openwrt.org
16 +
17 config ARCH_IXDP425
18 bool "IXDP425"
19 help
20 Index: linux-2.6.24/arch/arm/mach-ixp4xx/Makefile
21 ===================================================================
22 --- linux-2.6.24.orig/arch/arm/mach-ixp4xx/Makefile 2008-03-12 21:21:26.000000000 +1030
23 +++ linux-2.6.24/arch/arm/mach-ixp4xx/Makefile 2008-03-12 21:21:27.000000000 +1030
24 @@ -18,6 +18,7 @@
25 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
26 obj-pci-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-pci.o
27 obj-pci-$(CONFIG_MACH_COMPEX) += ixdp425-pci.o
28 +obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
29
30 obj-y += common.o
31
32 @@ -34,5 +35,6 @@
33 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
34 obj-$(CONFIG_MACH_PRONGHORNMETRO) += pronghornmetro-setup.o
35 obj-$(CONFIG_MACH_COMPEX) += compex-setup.o
36 +obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
37
38 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
39 Index: linux-2.6.24/arch/arm/mach-ixp4xx/wrt300nv2-pci.c
40 ===================================================================
41 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
42 +++ linux-2.6.24/arch/arm/mach-ixp4xx/wrt300nv2-pci.c 2008-03-12 21:21:27.000000000 +1030
43 @@ -0,0 +1,65 @@
44 +/*
45 + * arch/arch/mach-ixp4xx/wrt300nv2-pci.c
46 + *
47 + * PCI setup routines for Linksys WRT300N v2
48 + *
49 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org>
50 + *
51 + * based on coyote-pci.c:
52 + * Copyright (C) 2002 Jungo Software Technologies.
53 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
54 + *
55 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
56 + *
57 + * This program is free software; you can redistribute it and/or modify
58 + * it under the terms of the GNU General Public License version 2 as
59 + * published by the Free Software Foundation.
60 + *
61 + */
62 +
63 +#include <linux/kernel.h>
64 +#include <linux/pci.h>
65 +#include <linux/init.h>
66 +#include <linux/irq.h>
67 +
68 +#include <asm/mach-types.h>
69 +#include <asm/hardware.h>
70 +#include <asm/irq.h>
71 +
72 +#include <asm/mach/pci.h>
73 +
74 +extern void ixp4xx_pci_preinit(void);
75 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
76 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
77 +
78 +void __init wrt300nv2_pci_preinit(void)
79 +{
80 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW);
81 +
82 + ixp4xx_pci_preinit();
83 +}
84 +
85 +static int __init wrt300nv2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
86 +{
87 + if (slot == 1)
88 + return IRQ_IXP4XX_GPIO8;
89 + else return -1;
90 +}
91 +
92 +struct hw_pci wrt300nv2_pci __initdata = {
93 + .nr_controllers = 1,
94 + .preinit = wrt300nv2_pci_preinit,
95 + .swizzle = pci_std_swizzle,
96 + .setup = ixp4xx_setup,
97 + .scan = ixp4xx_scan_bus,
98 + .map_irq = wrt300nv2_map_irq,
99 +};
100 +
101 +int __init wrt300nv2_pci_init(void)
102 +{
103 + if (machine_is_wrt300nv2())
104 + pci_common_init(&wrt300nv2_pci);
105 + return 0;
106 +}
107 +
108 +subsys_initcall(wrt300nv2_pci_init);
109 Index: linux-2.6.24/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
110 ===================================================================
111 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
112 +++ linux-2.6.24/arch/arm/mach-ixp4xx/wrt300nv2-setup.c 2008-03-12 21:21:27.000000000 +1030
113 @@ -0,0 +1,108 @@
114 +/*
115 + * arch/arm/mach-ixp4xx/wrt300nv2-setup.c
116 + *
117 + * Board setup for the Linksys WRT300N v2
118 + *
119 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
120 + *
121 + * based on coyote-setup.c:
122 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
123 + *
124 + * Author: Imre Kaloz <Kaloz@openwrt.org>
125 + */
126 +
127 +#include <linux/kernel.h>
128 +#include <linux/init.h>
129 +#include <linux/device.h>
130 +#include <linux/serial.h>
131 +#include <linux/tty.h>
132 +#include <linux/serial_8250.h>
133 +#include <linux/slab.h>
134 +
135 +#include <asm/types.h>
136 +#include <asm/setup.h>
137 +#include <asm/memory.h>
138 +#include <asm/hardware.h>
139 +#include <asm/irq.h>
140 +#include <asm/mach-types.h>
141 +#include <asm/mach/arch.h>
142 +#include <asm/mach/flash.h>
143 +
144 +static struct flash_platform_data wrt300nv2_flash_data = {
145 + .map_name = "cfi_probe",
146 + .width = 2,
147 +};
148 +
149 +static struct resource wrt300nv2_flash_resource = {
150 + .flags = IORESOURCE_MEM,
151 +};
152 +
153 +static struct platform_device wrt300nv2_flash = {
154 + .name = "IXP4XX-Flash",
155 + .id = 0,
156 + .dev = {
157 + .platform_data = &wrt300nv2_flash_data,
158 + },
159 + .num_resources = 1,
160 + .resource = &wrt300nv2_flash_resource,
161 +};
162 +
163 +static struct resource wrt300nv2_uart_resource = {
164 + .start = IXP4XX_UART2_BASE_PHYS,
165 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
166 + .flags = IORESOURCE_MEM,
167 +};
168 +
169 +static struct plat_serial8250_port wrt300nv2_uart_data[] = {
170 + {
171 + .mapbase = IXP4XX_UART2_BASE_PHYS,
172 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
173 + .irq = IRQ_IXP4XX_UART2,
174 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
175 + .iotype = UPIO_MEM,
176 + .regshift = 2,
177 + .uartclk = IXP4XX_UART_XTAL,
178 + },
179 + { },
180 +};
181 +
182 +static struct platform_device wrt300nv2_uart = {
183 + .name = "serial8250",
184 + .id = PLAT8250_DEV_PLATFORM,
185 + .dev = {
186 + .platform_data = wrt300nv2_uart_data,
187 + },
188 + .num_resources = 1,
189 + .resource = &wrt300nv2_uart_resource,
190 +};
191 +
192 +static struct platform_device *wrt300nv2_devices[] __initdata = {
193 + &wrt300nv2_flash,
194 + &wrt300nv2_uart
195 +};
196 +
197 +static void __init wrt300nv2_init(void)
198 +{
199 + ixp4xx_sys_init();
200 +
201 + wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
202 + wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
203 +
204 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
205 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
206 +
207 + platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices));
208 +}
209 +
210 +#ifdef CONFIG_MACH_WRT300NV2
211 +MACHINE_START(WRT300NV2, "Linksys WRT300N v2")
212 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
213 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
214 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
215 + .map_io = ixp4xx_map_io,
216 + .init_irq = ixp4xx_init_irq,
217 + .timer = &ixp4xx_timer,
218 + .boot_params = 0x0100,
219 + .init_machine = wrt300nv2_init,
220 +MACHINE_END
221 +#endif
222 Index: linux-2.6.24/include/asm-arm/arch-ixp4xx/uncompress.h
223 ===================================================================
224 --- linux-2.6.24.orig/include/asm-arm/arch-ixp4xx/uncompress.h 2008-03-12 21:21:26.000000000 +1030
225 +++ linux-2.6.24/include/asm-arm/arch-ixp4xx/uncompress.h 2008-03-12 21:21:27.000000000 +1030
226 @@ -42,7 +42,7 @@
227 */
228 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
229 machine_is_gateway7001() || machine_is_wg302v2() ||
230 - machine_is_pronghorn_metro())
231 + machine_is_pronghorn_metro() || machine_is_wrt300nv2())
232 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
233 else
234 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
This page took 0.057961 seconds and 3 git commands to generate.