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