Root/target/linux/ixp4xx/patches-3.3/130-wrt300nv2_support.patch

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

Archive Download this file



interactive