Create various profiles for consumer IXP4xx devices
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx-2.6 / patches / 200-gateway_7001.patch
1 diff -Nur linux-2.6.19.2/arch/arm/boot/compressed/head-xscale.S linux-2.6.19.2-owrt/arch/arm/boot/compressed/head-xscale.S
2 --- linux-2.6.19.2/arch/arm/boot/compressed/head-xscale.S 2007-01-10 20:10:37.000000000 +0100
3 +++ linux-2.6.19.2-owrt/arch/arm/boot/compressed/head-xscale.S 2007-04-02 15:39:28.000000000 +0200
4 @@ -46,6 +46,11 @@
5 orr r7, r7, #(MACH_TYPE_GTWX5715 & 0xff00)
6 #endif
7
8 +#ifdef CONFIG_MACH_GATEWAY7001
9 + mov r7, #(MACH_TYPE_GATEWAY7001 & 0xff)
10 + orr r7, r7, #(MACH_TYPE_GATEWAY7001 & 0xff00)
11 +#endif
12 +
13 #ifdef CONFIG_ARCH_IXP2000
14 mov r1, #-1
15 mov r0, #0xd6000000
16 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/gateway7001-pci.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/gateway7001-pci.c
17 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/gateway7001-pci.c 1970-01-01 01:00:00.000000000 +0100
18 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/gateway7001-pci.c 2007-04-02 15:39:28.000000000 +0200
19 @@ -0,0 +1,68 @@
20 +/*
21 + * arch/arch/mach-ixp4xx/gateway7001-pci.c
22 + *
23 + * PCI setup routines for Gateway 7001
24 + *
25 + * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
26 + *
27 + * based on coyote-pci.c:
28 + * Copyright (C) 2002 Jungo Software Technologies.
29 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
30 + *
31 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
32 + *
33 + * This program is free software; you can redistribute it and/or modify
34 + * it under the terms of the GNU General Public License version 2 as
35 + * published by the Free Software Foundation.
36 + *
37 + */
38 +
39 +#include <linux/kernel.h>
40 +#include <linux/pci.h>
41 +#include <linux/init.h>
42 +#include <linux/irq.h>
43 +
44 +#include <asm/mach-types.h>
45 +#include <asm/hardware.h>
46 +#include <asm/irq.h>
47 +
48 +#include <asm/mach/pci.h>
49 +
50 +extern void ixp4xx_pci_preinit(void);
51 +extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
52 +extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
53 +
54 +void __init gateway7001_pci_preinit(void)
55 +{
56 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW);
57 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
58 +
59 + ixp4xx_pci_preinit();
60 +}
61 +
62 +static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
63 +{
64 + if (slot == 1)
65 + return IRQ_IXP4XX_GPIO11;
66 + else if (slot == 2)
67 + return IRQ_IXP4XX_GPIO10;
68 + else return -1;
69 +}
70 +
71 +struct hw_pci gateway7001_pci __initdata = {
72 + .nr_controllers = 1,
73 + .preinit = gateway7001_pci_preinit,
74 + .swizzle = pci_std_swizzle,
75 + .setup = ixp4xx_setup,
76 + .scan = ixp4xx_scan_bus,
77 + .map_irq = gateway7001_map_irq,
78 +};
79 +
80 +int __init gateway7001_pci_init(void)
81 +{
82 + if (machine_is_gateway7001())
83 + pci_common_init(&gateway7001_pci);
84 + return 0;
85 +}
86 +
87 +subsys_initcall(gateway7001_pci_init);
88 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/gateway7001-setup.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/gateway7001-setup.c
89 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/gateway7001-setup.c 1970-01-01 01:00:00.000000000 +0100
90 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/gateway7001-setup.c 2007-04-02 15:49:28.000000000 +0200
91 @@ -0,0 +1,108 @@
92 +/*
93 + * arch/arm/mach-ixp4xx/gateway7001-setup.c
94 + *
95 + * Board setup for the Gateway 7001 board
96 + *
97 + * Copyright (C) 2006 Imre Kaloz <Kaloz@openwrt.org>
98 + *
99 + * based on coyote-setup.c:
100 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
101 + *
102 + * Author: Imre Kaloz <Kaloz@openwrt.org>
103 + */
104 +
105 +#include <linux/kernel.h>
106 +#include <linux/init.h>
107 +#include <linux/device.h>
108 +#include <linux/serial.h>
109 +#include <linux/tty.h>
110 +#include <linux/serial_8250.h>
111 +#include <linux/slab.h>
112 +
113 +#include <asm/types.h>
114 +#include <asm/setup.h>
115 +#include <asm/memory.h>
116 +#include <asm/hardware.h>
117 +#include <asm/irq.h>
118 +#include <asm/mach-types.h>
119 +#include <asm/mach/arch.h>
120 +#include <asm/mach/flash.h>
121 +
122 +static struct flash_platform_data gateway7001_flash_data = {
123 + .map_name = "cfi_probe",
124 + .width = 2,
125 +};
126 +
127 +static struct resource gateway7001_flash_resource = {
128 + .flags = IORESOURCE_MEM,
129 +};
130 +
131 +static struct platform_device gateway7001_flash = {
132 + .name = "IXP4XX-Flash",
133 + .id = 0,
134 + .dev = {
135 + .platform_data = &gateway7001_flash_data,
136 + },
137 + .num_resources = 1,
138 + .resource = &gateway7001_flash_resource,
139 +};
140 +
141 +static struct resource gateway7001_uart_resource = {
142 + .start = IXP4XX_UART2_BASE_PHYS,
143 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
144 + .flags = IORESOURCE_MEM,
145 +};
146 +
147 +static struct plat_serial8250_port gateway7001_uart_data[] = {
148 + {
149 + .mapbase = IXP4XX_UART2_BASE_PHYS,
150 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
151 + .irq = IRQ_IXP4XX_UART2,
152 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
153 + .iotype = UPIO_MEM,
154 + .regshift = 2,
155 + .uartclk = IXP4XX_UART_XTAL,
156 + },
157 + { },
158 +};
159 +
160 +static struct platform_device gateway7001_uart = {
161 + .name = "serial8250",
162 + .id = PLAT8250_DEV_PLATFORM,
163 + .dev = {
164 + .platform_data = gateway7001_uart_data,
165 + },
166 + .num_resources = 1,
167 + .resource = &gateway7001_uart_resource,
168 +};
169 +
170 +static struct platform_device *gateway7001_devices[] __initdata = {
171 + &gateway7001_flash,
172 + &gateway7001_uart
173 +};
174 +
175 +static void __init gateway7001_init(void)
176 +{
177 + ixp4xx_sys_init();
178 +
179 + gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
180 + gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
181 +
182 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
183 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
184 +
185 + platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices));
186 +}
187 +
188 +#ifdef CONFIG_MACH_GATEWAY7001
189 +MACHINE_START(GATEWAY7001, "Gateway 7001 AP")
190 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
191 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
192 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
193 + .map_io = ixp4xx_map_io,
194 + .init_irq = ixp4xx_init_irq,
195 + .timer = &ixp4xx_timer,
196 + .boot_params = 0x0100,
197 + .init_machine = gateway7001_init,
198 +MACHINE_END
199 +#endif
200 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig
201 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig 2007-01-10 20:10:37.000000000 +0100
202 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig 2007-04-02 15:39:28.000000000 +0200
203 @@ -33,6 +33,14 @@
204 Engineering Coyote Gateway Reference Platform. For more
205 information on this platform, see <file:Documentation/arm/IXP4xx>.
206
207 +config MACH_GATEWAY7001
208 + bool "Gateway 7001"
209 + select PCI
210 + help
211 + Say 'Y' here if you want your kernel to support Gateway's
212 + 7001 Access Point. For more information on this platform,
213 + see http://openwrt.org
214 +
215 config ARCH_IXDP425
216 bool "IXDP425"
217 help
218 diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile
219 --- linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile 2007-01-10 20:10:37.000000000 +0100
220 +++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile 2007-04-02 15:49:49.000000000 +0200
221 @@ -11,6 +11,7 @@
222 obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o
223 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o
224 obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o
225 +obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o
226
227 obj-y += common.o
228
229 @@ -20,5 +21,6 @@
230 obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o
231 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o
232 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o
233 +obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
234
235 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
236 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
237 --- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h 2007-01-10 20:10:37.000000000 +0100
238 +++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h 2007-04-02 15:42:04.000000000 +0200
239 @@ -38,9 +38,9 @@
240 static __inline__ void __arch_decomp_setup(unsigned long arch_id)
241 {
242 /*
243 - * Coyote and gtwx5715 only have UART2 connected
244 + * Some boards are using UART2 as console
245 */
246 - if (machine_is_adi_coyote() || machine_is_gtwx5715())
247 + if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001())
248 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
249 else
250 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;