1 --- a/arch/arm/mach-ixp4xx/Kconfig
2 +++ b/arch/arm/mach-ixp4xx/Kconfig
3 @@ -4,6 +4,14 @@ menu "Intel IXP4xx Implementation Option
5 comment "IXP4xx Platforms"
8 + bool "Tonze AP-422/425"
11 + Say 'Y' here if you want your kernel to support Tonze's
12 + AP-422/425 boards. For more information on this platform,
13 + see http://tonze.com.tw
17 prompt "Linksys NSLU2"
18 --- a/arch/arm/mach-ixp4xx/Makefile
19 +++ b/arch/arm/mach-ixp4xx/Makefile
24 +obj-pci-$(CONFIG_MACH_AP42X) += ap42x-pci.o
25 obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
26 obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
27 obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o
28 @@ -32,6 +33,7 @@ obj-pci-$(CONFIG_MACH_USR8200) += usr82
32 +obj-$(CONFIG_MACH_AP42X) += ap42x-setup.o
33 obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
34 obj-$(CONFIG_MACH_AVILA) += avila-setup.o
35 obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o
37 +++ b/arch/arm/mach-ixp4xx/ap42x-pci.c
40 + * arch/arch/mach-ixp4xx/ap42x-pci.c
42 + * PCI setup routines for Tonze AP-422/425
44 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
46 + * based on coyote-pci.c:
47 + * Copyright (C) 2002 Jungo Software Technologies.
48 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
50 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
52 + * This program is free software; you can redistribute it and/or modify
53 + * it under the terms of the GNU General Public License version 2 as
54 + * published by the Free Software Foundation.
58 +#include <linux/kernel.h>
59 +#include <linux/pci.h>
60 +#include <linux/init.h>
61 +#include <linux/irq.h>
63 +#include <asm/mach-types.h>
64 +#include <mach/hardware.h>
66 +#include <asm/mach/pci.h>
68 +void __init ap42x_pci_preinit(void)
70 + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
71 + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
73 + ixp4xx_pci_preinit();
76 +static int __init ap42x_map_irq(const struct pci_dev *dev, u8 slot,
80 + return IRQ_IXP4XX_GPIO11;
82 + return IRQ_IXP4XX_GPIO10;
86 +struct hw_pci ap42x_pci __initdata = {
87 + .nr_controllers = 1,
88 + .preinit = ap42x_pci_preinit,
90 + .setup = ixp4xx_setup,
91 + .map_irq = ap42x_map_irq,
94 +int __init ap42x_pci_init(void)
96 + if (machine_is_ap42x())
97 + pci_common_init(&ap42x_pci);
101 +subsys_initcall(ap42x_pci_init);
103 +++ b/arch/arm/mach-ixp4xx/ap42x-setup.c
106 + * arch/arm/mach-ixp4xx/ap42x-setup.c
108 + * Board setup for the Tonze AP-42x boards
110 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
112 + * based on coyote-setup.c:
113 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
115 + * Author: Imre Kaloz <Kaloz@openwrt.org>
118 +#include <linux/kernel.h>
119 +#include <linux/init.h>
120 +#include <linux/device.h>
121 +#include <linux/serial.h>
122 +#include <linux/tty.h>
123 +#include <linux/serial_8250.h>
124 +#include <linux/mtd/physmap.h>
125 +#include <linux/dma-mapping.h>
127 +#include <asm/types.h>
128 +#include <asm/setup.h>
129 +#include <asm/memory.h>
130 +#include <mach/hardware.h>
131 +#include <asm/irq.h>
132 +#include <asm/mach-types.h>
133 +#include <asm/mach/arch.h>
134 +#include <asm/mach/flash.h>
136 +static struct mtd_partition ap42x_flash_partitions[] = {
139 + .offset = 0x00000000,
140 + .size = 0x00080000,
143 + .offset = 0x00080000,
144 + .size = 0x00100000,
147 + .offset = 0x00180000,
148 + .size = 0x00660000,
150 + .name = "FIS directory",
151 + .offset = 0x007f8000,
152 + .size = 0x00007000,
154 + .name = "RedBoot config",
155 + .offset = 0x007ff000,
156 + .size = 0x00001000,
160 +static struct physmap_flash_data ap42x_flash_data = {
162 + .parts = ap42x_flash_partitions,
163 + .nr_parts = ARRAY_SIZE(ap42x_flash_partitions),
166 +static struct resource ap42x_flash_resource = {
167 + .flags = IORESOURCE_MEM,
168 + .start = IXP4XX_EXP_BUS_BASE_PHYS,
169 + .end = IXP4XX_EXP_BUS_BASE_PHYS + SZ_8M - 1,
172 +static struct platform_device ap42x_flash = {
173 + .name = "physmap-flash",
176 + .platform_data = &ap42x_flash_data,
178 + .num_resources = 1,
179 + .resource = &ap42x_flash_resource,
182 +static struct resource ap42x_uart_resource = {
183 + .start = IXP4XX_UART2_BASE_PHYS,
184 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
185 + .flags = IORESOURCE_MEM,
188 +static struct plat_serial8250_port ap42x_uart_data[] = {
190 + .mapbase = IXP4XX_UART2_BASE_PHYS,
191 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
192 + .irq = IRQ_IXP4XX_UART2,
193 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
194 + .iotype = UPIO_MEM,
196 + .uartclk = IXP4XX_UART_XTAL,
201 +static struct platform_device ap42x_uart = {
202 + .name = "serial8250",
203 + .id = PLAT8250_DEV_PLATFORM,
205 + .platform_data = ap42x_uart_data,
207 + .num_resources = 1,
208 + .resource = &ap42x_uart_resource,
211 +static struct eth_plat_info ap42x_plat_eth[] = {
223 +static struct platform_device ap42x_eth[] = {
225 + .name = "ixp4xx_eth",
226 + .id = IXP4XX_ETH_NPEB,
227 + .dev.platform_data = ap42x_plat_eth,
228 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
230 + .name = "ixp4xx_eth",
231 + .id = IXP4XX_ETH_NPEC,
232 + .dev.platform_data = ap42x_plat_eth + 1,
233 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
237 +static struct platform_device *ap42x_devices[] __initdata = {
244 +static void __init ap42x_init(void)
248 + ap42x_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
249 + ap42x_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
251 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
252 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
254 + platform_add_devices(ap42x_devices, ARRAY_SIZE(ap42x_devices));
257 +#ifdef CONFIG_MACH_AP42X
258 +MACHINE_START(AP42X, "Tonze AP-422/425")
259 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
260 + .map_io = ixp4xx_map_io,
261 + .init_irq = ixp4xx_init_irq,
262 + .init_time = ixp4xx_timer_init,
263 + .atag_offset = 0x100,
264 + .init_machine = ap42x_init,
265 +#if defined(CONFIG_PCI)
266 + .dma_zone_size = SZ_64M,
268 + .restart = ixp4xx_restart,
271 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
272 +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
273 @@ -45,7 +45,8 @@ static __inline__ void __arch_decomp_set
274 machine_is_devixp() || machine_is_miccpt() || machine_is_mic256() ||
275 machine_is_pronghorn() || machine_is_pronghorn_metro() ||
276 machine_is_wrt300nv2() || machine_is_tw5334() ||
277 - machine_is_usr8200() || machine_is_tw2662())
278 + machine_is_usr8200() || machine_is_tw2662() ||
279 + machine_is_ap42x())
280 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
282 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;