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