bcm963xx: board support
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 180-tw5334_support.patch
1 diff -Nur linux-2.6.24.2/arch/arm/mach-ixp4xx/Kconfig linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/Kconfig
2 --- linux-2.6.24.2/arch/arm/mach-ixp4xx/Kconfig 2008-04-09 01:34:46.000000000 +0200
3 +++ linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/Kconfig 2008-04-09 00:06:48.000000000 +0200
4 @@ -150,6 +150,14 @@
5 PrPCM1100 Processor Mezanine Module. For more information on
6 this platform, see <file:Documentation/arm/IXP4xx>.
7
8 +config MACH_TW5334
9 + bool "Titan Wireless TW-533-4"
10 + select PCI
11 + help
12 + Say 'Y' here if you want your kernel to support the Titan
13 + Wireless TW533-4. For more information on this platform,
14 + see http://openwrt.org
15 +
16 config MACH_NAS100D
17 bool
18 prompt "NAS100D"
19 diff -Nur linux-2.6.24.2/arch/arm/mach-ixp4xx/Makefile linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/Makefile
20 --- linux-2.6.24.2/arch/arm/mach-ixp4xx/Makefile 2008-04-09 01:34:46.000000000 +0200
21 +++ linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/Makefile 2008-04-09 00:07:45.000000000 +0200
22 @@ -22,6 +22,7 @@
23 obj-pci-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-pci.o
24 obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
25 obj-pci-$(CONFIG_MACH_AP1000) += ixdp425-pci.o
26 +obj-pci-$(CONFIG_MACH_TW5334) += tw5334-pci.o
27
28 obj-y += common.o
29
30 @@ -42,6 +43,7 @@
31 obj-$(CONFIG_MACH_WRT300NV2) += wrt300nv2-setup.o
32 obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
33 obj-$(CONFIG_MACH_AP1000) += ap1000-setup.o
34 +obj-$(CONFIG_MACH_TW5334) += tw5334-setup.o
35
36 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
37 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
38 diff -Nur linux-2.6.24.2/arch/arm/mach-ixp4xx/tw5334-setup.c linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/tw5334-setup.c
39 --- linux-2.6.24.2/arch/arm/mach-ixp4xx/tw5334-setup.c 1970-01-01 01:00:00.000000000 +0100
40 +++ linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/tw5334-setup.c 2008-04-09 01:58:52.000000000 +0200
41 @@ -0,0 +1,162 @@
42 +/*
43 + * arch/arm/mach-ixp4xx/tw5334-setup.c
44 + *
45 + * Board setup for the Titan Wireless TW-533-4
46 + *
47 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
48 + *
49 + * based on coyote-setup.c:
50 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
51 + *
52 + * Author: Imre Kaloz <Kaloz@openwrt.org>
53 + */
54 +
55 +#include <linux/if_ether.h>
56 +#include <linux/kernel.h>
57 +#include <linux/init.h>
58 +#include <linux/device.h>
59 +#include <linux/serial.h>
60 +#include <linux/tty.h>
61 +#include <linux/serial_8250.h>
62 +#include <linux/slab.h>
63 +
64 +#include <asm/types.h>
65 +#include <asm/setup.h>
66 +#include <asm/memory.h>
67 +#include <asm/hardware.h>
68 +#include <asm/irq.h>
69 +#include <asm/mach-types.h>
70 +#include <asm/mach/arch.h>
71 +#include <asm/mach/flash.h>
72 +
73 +static struct flash_platform_data tw5334_flash_data = {
74 + .map_name = "cfi_probe",
75 + .width = 2,
76 +};
77 +
78 +static struct resource tw5334_flash_resource = {
79 + .flags = IORESOURCE_MEM,
80 +};
81 +
82 +static struct platform_device tw5334_flash = {
83 + .name = "IXP4XX-Flash",
84 + .id = 0,
85 + .dev = {
86 + .platform_data = &tw5334_flash_data,
87 + },
88 + .num_resources = 1,
89 + .resource = &tw5334_flash_resource,
90 +};
91 +
92 +static struct resource tw5334_uart_resource = {
93 + .start = IXP4XX_UART2_BASE_PHYS,
94 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
95 + .flags = IORESOURCE_MEM,
96 +};
97 +
98 +static struct plat_serial8250_port tw5334_uart_data[] = {
99 + {
100 + .mapbase = IXP4XX_UART2_BASE_PHYS,
101 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
102 + .irq = IRQ_IXP4XX_UART2,
103 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
104 + .iotype = UPIO_MEM,
105 + .regshift = 2,
106 + .uartclk = IXP4XX_UART_XTAL,
107 + },
108 + { },
109 +};
110 +
111 +static struct platform_device tw5334_uart = {
112 + .name = "serial8250",
113 + .id = PLAT8250_DEV_PLATFORM,
114 + .dev = {
115 + .platform_data = tw5334_uart_data,
116 + },
117 + .num_resources = 1,
118 + .resource = &tw5334_uart_resource,
119 +};
120 +
121 +/* Built-in 10/100 Ethernet MAC interfaces */
122 +static struct eth_plat_info tw5334_plat_eth[] = {
123 + {
124 + .phy = 0,
125 + .rxq = 3,
126 + .txreadyq = 20,
127 + }, {
128 + .phy = 1,
129 + .rxq = 4,
130 + .txreadyq = 21,
131 + }
132 +};
133 +
134 +static struct platform_device tw5334_eth[] = {
135 + {
136 + .name = "ixp4xx_eth",
137 + .id = IXP4XX_ETH_NPEB,
138 + .dev.platform_data = tw5334_plat_eth,
139 + }, {
140 + .name = "ixp4xx_eth",
141 + .id = IXP4XX_ETH_NPEC,
142 + .dev.platform_data = tw5334_plat_eth + 1,
143 + }
144 +};
145 +
146 +static struct platform_device *tw5334_devices[] __initdata = {
147 + &tw5334_flash,
148 + &tw5334_uart,
149 + &tw5334_eth[0],
150 + &tw5334_eth[1],
151 +};
152 +
153 +static void __init tw5334_init(void)
154 +{
155 + DECLARE_MAC_BUF(mac_buf);
156 + uint8_t __iomem *f;
157 + int i;
158 +
159 + ixp4xx_sys_init();
160 +
161 + tw5334_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
162 + tw5334_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
163 +
164 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
165 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
166 +
167 + platform_add_devices(tw5334_devices, ARRAY_SIZE(tw5334_devices));
168 +
169 + /*
170 + * Map in a portion of the flash and read the MAC addresses.
171 + * Since it is stored in BE in the flash itself, we need to
172 + * byteswap it if we're in LE mode.
173 + */
174 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000);
175 + if (f) {
176 + for (i = 0; i < 6; i++)
177 +#ifdef __ARMEB__
178 + tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + i);
179 + tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + i);
180 +#else
181 + tw5334_plat_eth[0].hwaddr[i] = readb(f + 0xFC0422 + (i^3));
182 + tw5334_plat_eth[1].hwaddr[i] = readb(f + 0xFC043B + (i^3));
183 +#endif
184 + iounmap(f);
185 + }
186 + printk(KERN_INFO "TW-533-4: Using MAC address %s for port 0\n",
187 + print_mac(mac_buf, tw5334_plat_eth[0].hwaddr));
188 + printk(KERN_INFO "TW-533-4: Using MAC address %s for port 1\n",
189 + print_mac(mac_buf, tw5334_plat_eth[1].hwaddr));
190 +}
191 +
192 +#ifdef CONFIG_MACH_TW5334
193 +MACHINE_START(TW5334, "Titan Wireless TW-533-4")
194 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
195 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
196 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
197 + .map_io = ixp4xx_map_io,
198 + .init_irq = ixp4xx_init_irq,
199 + .timer = &ixp4xx_timer,
200 + .boot_params = 0x0100,
201 + .init_machine = tw5334_init,
202 +MACHINE_END
203 +#endif
204 diff -Nur linux-2.6.24.2/arch/arm/mach-ixp4xx/tw5334-pci.c linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/tw5334-pci.c
205 --- linux-2.6.24.2/arch/arm/mach-ixp4xx/tw5334-pci.c 1970-01-01 01:00:00.000000000 +0100
206 +++ linux-2.6.24.2-owrt/arch/arm/mach-ixp4xx/tw5334-pci.c 2008-04-09 00:35:32.000000000 +0200
207 @@ -0,0 +1,69 @@
208 +/*
209 + * arch/arch/mach-ixp4xx/tw5334-pci.c
210 + *
211 + * PCI setup routines for the Titan Wireless TW-533-4
212 + *
213 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
214 + *
215 + * based on coyote-pci.c:
216 + * Copyright (C) 2002 Jungo Software Technologies.
217 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
218 + *
219 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
220 + *
221 + * This program is free software; you can redistribute it and/or modify
222 + * it under the terms of the GNU General Public License version 2 as
223 + * published by the Free Software Foundation.
224 + *
225 + */
226 +
227 +#include <linux/kernel.h>
228 +#include <linux/pci.h>
229 +#include <linux/init.h>
230 +#include <linux/irq.h>
231 +
232 +#include <asm/mach-types.h>
233 +#include <asm/hardware.h>
234 +
235 +#include <asm/mach/pci.h>
236 +
237 +void __init tw5334_pci_preinit(void)
238 +{
239 + set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
240 + set_irq_type(IRQ_IXP4XX_GPIO2, IRQT_LOW);
241 + set_irq_type(IRQ_IXP4XX_GPIO1, IRQT_LOW);
242 + set_irq_type(IRQ_IXP4XX_GPIO0, IRQT_LOW);
243 +
244 + ixp4xx_pci_preinit();
245 +}
246 +
247 +static int __init tw5334_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
248 +{
249 + if (slot == 12)
250 + return IRQ_IXP4XX_GPIO6;
251 + else if (slot == 13)
252 + return IRQ_IXP4XX_GPIO2;
253 + else if (slot == 14)
254 + return IRQ_IXP4XX_GPIO1;
255 + else if (slot == 15)
256 + return IRQ_IXP4XX_GPIO0;
257 + else return -1;
258 +}
259 +
260 +struct hw_pci tw5334_pci __initdata = {
261 + .nr_controllers = 1,
262 + .preinit = tw5334_pci_preinit,
263 + .swizzle = pci_std_swizzle,
264 + .setup = ixp4xx_setup,
265 + .scan = ixp4xx_scan_bus,
266 + .map_irq = tw5334_map_irq,
267 +};
268 +
269 +int __init tw5334_pci_init(void)
270 +{
271 + if (machine_is_tw5334())
272 + pci_common_init(&tw5334_pci);
273 + return 0;
274 +}
275 +
276 +subsys_initcall(tw5334_pci_init);
277 --- linux-2.6.24.2/include/asm-arm/arch-ixp4xx/uncompress.h 2008-04-07 08:59:19.000000000 +0200
278 +++ linux-2.6.24.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h 2008-04-09 13:22:42.000000000 +0200
279 @@ -42,7 +42,8 @@
280 */
281 if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
282 machine_is_gateway7001() || machine_is_wg302v2() ||
283 - machine_is_pronghorn_metro() || machine_is_wrt300nv2())
284 + machine_is_pronghorn_metro() || machine_is_wrt300nv2() ||
285 + machine_is_tw5334())
286 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
287 else
288 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
This page took 0.080634 seconds and 5 git commands to generate.