cleanup of register access
[openwrt.git] / target / linux / ixp4xx / patches / 300-wg302v2.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-04-02 16:09:06.000000000 +0200
3 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig 2007-04-02 16:01:25.000000000 +0200
4 @@ -41,6 +41,14 @@
5 7001 Access Point. For more information on this platform,
6 see http://openwrt.org
7
8 +config MACH_WG302V2
9 + bool "Netgear WG302 v2 / WAG302 v2"
10 + select PCI
11 + help
12 + Say 'Y' here if you want your kernel to support Netgear's
13 + WG302 v2 or WAG302 v2 Access Points. For more information
14 + on this 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-04-02 16:09:06.000000000 +0200
21 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile 2007-04-02 16:09:25.000000000 +0200
22 @@ -12,6 +12,7 @@
23 obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o
24 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
25 obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
26 +obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
27
28 obj-y += common.o
29
30 @@ -22,5 +23,6 @@
31 obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o
32 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
33 obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
34 +obj-$(CONFIG_MACH_WG302V2) += wg302v2-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/wg302v2-pci.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/wg302v2-pci.c
38 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/wg302v2-pci.c 1970-01-01 01:00:00.000000000 +0100
39 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/wg302v2-pci.c 2007-04-02 16:00:12.000000000 +0200
40 @@ -0,0 +1,68 @@
41 +/*
42 + * arch/arch/mach-ixp4xx/wg302v2-pci.c
43 + *
44 + * PCI setup routines for the Netgear WG302 v2 and WAG302 v2
45 + *
46 + * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
47 + *
48 + * based on coyote-pci.c:
49 + * Copyright (C) 2002 Jungo Software Technologies.
50 + * Copyright (C) 2003 MontaVista Software, 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 wg302v2_pci_preinit(void)
76 +{
77 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW);
78 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW);
79 +
80 + ixp4xx_pci_preinit();
81 +}
82 +
83 +static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
84 +{
85 + if (slot == 1)
86 + return IRQ_IXP4XX_GPIO8;
87 + else if (slot == 2)
88 + return IRQ_IXP4XX_GPIO9;
89 + else return -1;
90 +}
91 +
92 +struct hw_pci wg302v2_pci __initdata = {
93 + .nr_controllers = 1,
94 + .preinit = wg302v2_pci_preinit,
95 + .swizzle = pci_std_swizzle,
96 + .setup = ixp4xx_setup,
97 + .scan = ixp4xx_scan_bus,
98 + .map_irq = wg302v2_map_irq,
99 +};
100 +
101 +int __init wg302v2_pci_init(void)
102 +{
103 + if (machine_is_wg302v2())
104 + pci_common_init(&wg302v2_pci);
105 + return 0;
106 +}
107 +
108 +subsys_initcall(wg302v2_pci_init);
109 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/wg302v2-setup.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/wg302v2-setup.c
110 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/wg302v2-setup.c 1970-01-01 01:00:00.000000000 +0100
111 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/wg302v2-setup.c 2007-04-02 16:08:57.000000000 +0200
112 @@ -0,0 +1,107 @@
113 +/*
114 + * arch/arm/mach-ixp4xx/wg302-setup.c
115 + *
116 + * Board setup for the Netgear WG302 v2 and WAG302 v2
117 + *
118 + * based on coyote-setup.c:
119 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
120 + *
121 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
122 + *
123 + */
124 +
125 +#include <linux/kernel.h>
126 +#include <linux/init.h>
127 +#include <linux/device.h>
128 +#include <linux/serial.h>
129 +#include <linux/tty.h>
130 +#include <linux/serial_8250.h>
131 +#include <linux/slab.h>
132 +
133 +#include <asm/types.h>
134 +#include <asm/setup.h>
135 +#include <asm/memory.h>
136 +#include <asm/hardware.h>
137 +#include <asm/irq.h>
138 +#include <asm/mach-types.h>
139 +#include <asm/mach/arch.h>
140 +#include <asm/mach/flash.h>
141 +
142 +static struct flash_platform_data wg302v2_flash_data = {
143 + .map_name = "cfi_probe",
144 + .width = 2,
145 +};
146 +
147 +static struct resource wg302v2_flash_resource = {
148 + .flags = IORESOURCE_MEM,
149 +};
150 +
151 +static struct platform_device wg302v2_flash = {
152 + .name = "IXP4XX-Flash",
153 + .id = 0,
154 + .dev = {
155 + .platform_data = &wg302v2_flash_data,
156 + },
157 + .num_resources = 1,
158 + .resource = &wg302v2_flash_resource,
159 +};
160 +
161 +static struct resource wg302v2_uart_resource = {
162 + .start = IXP4XX_UART2_BASE_PHYS,
163 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
164 + .flags = IORESOURCE_MEM,
165 +};
166 +
167 +static struct plat_serial8250_port wg302v2_uart_data[] = {
168 + {
169 + .mapbase = IXP4XX_UART2_BASE_PHYS,
170 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
171 + .irq = IRQ_IXP4XX_UART2,
172 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
173 + .iotype = UPIO_MEM,
174 + .regshift = 2,
175 + .uartclk = IXP4XX_UART_XTAL,
176 + },
177 + { },
178 +};
179 +
180 +static struct platform_device wg302v2_uart = {
181 + .name = "serial8250",
182 + .id = PLAT8250_DEV_PLATFORM,
183 + .dev = {
184 + .platform_data = wg302v2_uart_data,
185 + },
186 + .num_resources = 1,
187 + .resource = &wg302v2_uart_resource,
188 +};
189 +
190 +static struct platform_device *wg302v2_devices[] __initdata = {
191 + &wg302v2_flash,
192 + &wg302v2_uart,
193 +};
194 +
195 +static void __init wg302v2_init(void)
196 +{
197 + ixp4xx_sys_init();
198 +
199 + wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
200 + wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
201 +
202 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
203 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
204 +
205 + platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices));
206 +}
207 +
208 +#ifdef CONFIG_MACH_WG302V2
209 +MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
210 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
211 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
212 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
213 + .map_io = ixp4xx_map_io,
214 + .init_irq = ixp4xx_init_irq,
215 + .timer = &ixp4xx_timer,
216 + .boot_params = 0x0100,
217 + .init_machine = wg302v2_init,
218 +MACHINE_END
219 +#endif
220 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
221 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h 2007-04-02 16:09:06.000000000 +0200
222 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h 2007-04-02 16:02:04.000000000 +0200
223 @@ -40,7 +40,7 @@
224 /*
225 * Some boards are using UART2 as console
226 */
227 - if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001())
228 + if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2())
229 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
230 else
231 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
This page took 0.061277 seconds and 5 git commands to generate.