[ixp4xx] refresh kernel patches
[openwrt.git] / target / linux / ixp4xx / patches / 500-compex.patch
1 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c
2 ===================================================================
3 --- /dev/null
4 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/compex-setup.c
5 @@ -0,0 +1,120 @@
6 +/*
7 + * arch/arm/mach-ixp4xx/compex-setup.c
8 + *
9 + * Ccompex WP18 / NP18A board-setup
10 + *
11 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
12 + *
13 + * based on ixdp425-setup.c:
14 + *     Copyright (C) 2003-2005 MontaVista Software, Inc.
15 + *
16 + * Author: Imre Kaloz <Kaloz@openwrt.org>
17 + */
18 +
19 +#include <linux/kernel.h>
20 +#include <linux/init.h>
21 +#include <linux/device.h>
22 +#include <linux/serial.h>
23 +#include <linux/tty.h>
24 +#include <linux/serial_8250.h>
25 +#include <linux/slab.h>
26 +
27 +#include <asm/types.h>
28 +#include <asm/setup.h>
29 +#include <asm/memory.h>
30 +#include <asm/hardware.h>
31 +#include <asm/mach-types.h>
32 +#include <asm/irq.h>
33 +#include <asm/mach/arch.h>
34 +#include <asm/mach/flash.h>
35 +
36 +static struct flash_platform_data compex_flash_data = {
37 +       .map_name       = "cfi_probe",
38 +       .width          = 2,
39 +};
40 +
41 +static struct resource compex_flash_resource = {
42 +       .flags          = IORESOURCE_MEM,
43 +};
44 +
45 +static struct platform_device compex_flash = {
46 +       .name           = "IXP4XX-Flash",
47 +       .id             = 0,
48 +       .dev            = {
49 +               .platform_data = &compex_flash_data,
50 +       },
51 +       .num_resources  = 1,
52 +       .resource       = &compex_flash_resource,
53 +};
54 +
55 +static struct resource compex_uart_resources[] = {
56 +       {
57 +               .start          = IXP4XX_UART1_BASE_PHYS,
58 +               .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
59 +               .flags          = IORESOURCE_MEM
60 +       },
61 +       {
62 +               .start          = IXP4XX_UART2_BASE_PHYS,
63 +               .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
64 +               .flags          = IORESOURCE_MEM
65 +       }
66 +};
67 +
68 +static struct plat_serial8250_port compex_uart_data[] = {
69 +       {
70 +               .mapbase        = IXP4XX_UART1_BASE_PHYS,
71 +               .membase        = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
72 +               .irq            = IRQ_IXP4XX_UART1,
73 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
74 +               .iotype         = UPIO_MEM,
75 +               .regshift       = 2,
76 +               .uartclk        = IXP4XX_UART_XTAL,
77 +       },
78 +       {
79 +               .mapbase        = IXP4XX_UART2_BASE_PHYS,
80 +               .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
81 +               .irq            = IRQ_IXP4XX_UART2,
82 +               .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
83 +               .iotype         = UPIO_MEM,
84 +               .regshift       = 2,
85 +               .uartclk        = IXP4XX_UART_XTAL,
86 +       },
87 +       { },
88 +};
89 +
90 +static struct platform_device compex_uart = {
91 +       .name                   = "serial8250",
92 +       .id                     = PLAT8250_DEV_PLATFORM,
93 +       .dev.platform_data      = compex_uart_data,
94 +       .num_resources          = 2,
95 +       .resource               = compex_uart_resources
96 +};
97 +
98 +static struct platform_device *compex_devices[] __initdata = {
99 +       &compex_flash,
100 +       &compex_uart
101 +};
102 +
103 +static void __init compex_init(void)
104 +{
105 +       ixp4xx_sys_init();
106 +
107 +       compex_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
108 +       compex_flash_resource.end =
109 +               IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
110 +
111 +       platform_add_devices(compex_devices, ARRAY_SIZE(compex_devices));
112 +}
113 +
114 +#ifdef CONFIG_MACH_COMPEX
115 +MACHINE_START(COMPEX, "Compex WP18 / NP18A")
116 +       /* Maintainer: Imre Kaloz <Kaloz@openwrt.org> */
117 +       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
118 +       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
119 +       .map_io         = ixp4xx_map_io,
120 +       .init_irq       = ixp4xx_init_irq,
121 +       .timer          = &ixp4xx_timer,
122 +       .boot_params    = 0x0100,
123 +       .init_machine   = compex_init,
124 +MACHINE_END
125 +#endif
126 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-pci.c
127 ===================================================================
128 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/ixdp425-pci.c
129 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/ixdp425-pci.c
130 @@ -66,7 +66,7 @@ struct hw_pci ixdp425_pci __initdata = {
131  int __init ixdp425_pci_init(void)
132  {
133         if (machine_is_ixdp425() || machine_is_ixcdp1100() ||
134 -                       machine_is_ixdp465())
135 +                       machine_is_ixdp465() || machine_is_compex())
136                 pci_common_init(&ixdp425_pci);
137         return 0;
138  }
139 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig
140 ===================================================================
141 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Kconfig
142 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Kconfig
143 @@ -65,6 +65,14 @@ config MACH_PRONGHORNMETRO
144           Engineering Pronghorn Metro Platform. For more
145           information on this platform, see <file:Documentation/arm/IXP4xx>.
146  
147 +config MACH_COMPEX
148 +       bool "Compex WP18 / NP18A"
149 +       select PCI
150 +       help
151 +         Say 'Y' here if you want your kernel to support Compex' 
152 +         WP18 or NP18A boards. For more information on this
153 +         platform, see http://openwrt.org
154 +
155  config ARCH_IXDP425
156         bool "IXDP425"
157         help
158 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile
159 ===================================================================
160 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/Makefile
161 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/Makefile
162 @@ -16,6 +16,7 @@ obj-pci-$(CONFIG_MACH_DSMG600)                += dsmg6
163  obj-pci-$(CONFIG_MACH_GATEWAY7001)     += gateway7001-pci.o
164  obj-pci-$(CONFIG_MACH_WG302V2)         += wg302v2-pci.o
165  obj-pci-$(CONFIG_MACH_PRONGHORNMETRO)  += pronghornmetro-pci.o
166 +obj-pci-$(CONFIG_MACH_COMPEX)          += ixdp425-pci.o
167  
168  obj-y  += common.o
169  
170 @@ -30,5 +31,6 @@ obj-$(CONFIG_MACH_DSMG600)      += dsmg6
171  obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o
172  obj-$(CONFIG_MACH_WG302V2)     += wg302v2-setup.o
173  obj-$(CONFIG_MACH_PRONGHORNMETRO)      += pronghornmetro-setup.o
174 +obj-$(CONFIG_MACH_COMPEX)      += compex-setup.o
175  
176  obj-$(CONFIG_PCI)              += $(obj-pci-$(CONFIG_PCI)) common-pci.o
177 Index: linux-2.6.21.7/arch/arm/tools/mach-types
178 ===================================================================
179 --- linux-2.6.21.7.orig/arch/arm/tools/mach-types
180 +++ linux-2.6.21.7/arch/arm/tools/mach-types
181 @@ -1278,7 +1278,7 @@ oiab                      MACH_OIAB               OIAB                    1269
182  smdk6400               MACH_SMDK6400           SMDK6400                1270
183  nokia_n800             MACH_NOKIA_N800         NOKIA_N800              1271
184  greenphone             MACH_GREENPHONE         GREENPHONE              1272
185 -compex42x              MACH_COMPEXWP18         COMPEXWP18              1273
186 +compex                 MACH_COMPEX             COMPEX                  1273
187  xmate                  MACH_XMATE              XMATE                   1274
188  energizer              MACH_ENERGIZER          ENERGIZER               1275
189  ime1                   MACH_IME1               IME1                    1276