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