2 +++ b/arch/arm/mach-ixp4xx/ap42x-pci.c
5 + * arch/arch/mach-ixp4xx/ap42x-pci.c
7 + * PCI setup routines for Tonze AP-422/425
9 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
11 + * based on coyote-pci.c:
12 + * Copyright (C) 2002 Jungo Software Technologies.
13 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
15 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
17 + * This program is free software; you can redistribute it and/or modify
18 + * it under the terms of the GNU General Public License version 2 as
19 + * published by the Free Software Foundation.
23 +#include <linux/kernel.h>
24 +#include <linux/pci.h>
25 +#include <linux/init.h>
26 +#include <linux/irq.h>
28 +#include <asm/mach-types.h>
29 +#include <mach/hardware.h>
31 +#include <asm/mach/pci.h>
33 +void __init ap42x_pci_preinit(void)
35 + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
36 + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
38 + ixp4xx_pci_preinit();
41 +static int __init ap42x_map_irq(const struct pci_dev *dev, u8 slot,
45 + return IRQ_IXP4XX_GPIO11;
47 + return IRQ_IXP4XX_GPIO10;
51 +struct hw_pci ap42x_pci __initdata = {
52 + .nr_controllers = 1,
53 + .preinit = ap42x_pci_preinit,
54 + .swizzle = pci_std_swizzle,
55 + .setup = ixp4xx_setup,
56 + .scan = ixp4xx_scan_bus,
57 + .map_irq = ap42x_map_irq,
60 +int __init ap42x_pci_init(void)
62 + if (machine_is_ap42x())
63 + pci_common_init(&ap42x_pci);
67 +subsys_initcall(ap42x_pci_init);
69 +++ b/arch/arm/mach-ixp4xx/ap42x-setup.c
72 + * arch/arm/mach-ixp4xx/ap42x-setup.c
74 + * Board setup for the Tonze AP-42x boards
76 + * Copyright (C) 2012 Imre Kaloz <kaloz@openwrt.org>
78 + * based on coyote-setup.c:
79 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
81 + * Author: Imre Kaloz <Kaloz@openwrt.org>
84 +#include <linux/kernel.h>
85 +#include <linux/init.h>
86 +#include <linux/device.h>
87 +#include <linux/serial.h>
88 +#include <linux/tty.h>
89 +#include <linux/serial_8250.h>
90 +#include <linux/mtd/physmap.h>
92 +#include <asm/types.h>
93 +#include <asm/setup.h>
94 +#include <asm/memory.h>
95 +#include <mach/hardware.h>
97 +#include <asm/mach-types.h>
98 +#include <asm/mach/arch.h>
99 +#include <asm/mach/flash.h>
101 +static struct mtd_partition ap42x_flash_partitions[] = {
104 + .offset = 0x00000000,
105 + .size = 0x00080000,
108 + .offset = 0x00080000,
109 + .size = 0x00100000,
112 + .offset = 0x00180000,
113 + .size = 0x00660000,
115 + .name = "FIS directory",
116 + .offset = 0x007f8000,
117 + .size = 0x00007000,
119 + .name = "RedBoot config",
120 + .offset = 0x007ff000,
121 + .size = 0x00001000,
125 +static struct physmap_flash_data ap42x_flash_data = {
127 + .parts = ap42x_flash_partitions,
128 + .nr_parts = ARRAY_SIZE(ap42x_flash_partitions),
131 +static struct resource ap42x_flash_resource = {
132 + .flags = IORESOURCE_MEM,
133 + .start = IXP4XX_EXP_BUS_BASE_PHYS,
134 + .end = IXP4XX_EXP_BUS_BASE_PHYS + SZ_8M - 1,
137 +static struct platform_device ap42x_flash = {
138 + .name = "physmap-flash",
141 + .platform_data = &ap42x_flash_data,
143 + .num_resources = 1,
144 + .resource = &ap42x_flash_resource,
147 +static struct resource ap42x_uart_resource = {
148 + .start = IXP4XX_UART2_BASE_PHYS,
149 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
150 + .flags = IORESOURCE_MEM,
153 +static struct plat_serial8250_port ap42x_uart_data[] = {
155 + .mapbase = IXP4XX_UART2_BASE_PHYS,
156 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
157 + .irq = IRQ_IXP4XX_UART2,
158 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
159 + .iotype = UPIO_MEM,
161 + .uartclk = IXP4XX_UART_XTAL,
166 +static struct platform_device ap42x_uart = {
167 + .name = "serial8250",
168 + .id = PLAT8250_DEV_PLATFORM,
170 + .platform_data = ap42x_uart_data,
172 + .num_resources = 1,
173 + .resource = &ap42x_uart_resource,
176 +static struct eth_plat_info ap42x_plat_eth[] = {
188 +static struct platform_device ap42x_eth[] = {
190 + .name = "ixp4xx_eth",
191 + .id = IXP4XX_ETH_NPEB,
192 + .dev.platform_data = ap42x_plat_eth,
194 + .name = "ixp4xx_eth",
195 + .id = IXP4XX_ETH_NPEC,
196 + .dev.platform_data = ap42x_plat_eth + 1,
200 +static struct platform_device *ap42x_devices[] __initdata = {
207 +static void __init ap42x_init(void)
211 + ap42x_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
212 + ap42x_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
214 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
215 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
217 + platform_add_devices(ap42x_devices, ARRAY_SIZE(ap42x_devices));
220 +#ifdef CONFIG_MACH_AP42X
221 +MACHINE_START(AP42X, "Tonze AP-422/425")
222 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
223 + .map_io = ixp4xx_map_io,
224 + .init_irq = ixp4xx_init_irq,
225 + .timer = &ixp4xx_timer,
226 + .atag_offset = 0x100,
227 + .init_machine = ap42x_init,
228 +#if defined(CONFIG_PCI)
229 + .dma_zone_size = SZ_64M,
231 + .restart = ixp4xx_restart,
234 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
235 +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
236 @@ -45,7 +45,8 @@ static __inline__ void __arch_decomp_set
237 machine_is_devixp() || machine_is_miccpt() || machine_is_mic256() ||
238 machine_is_pronghorn() || machine_is_pronghorn_metro() ||
239 machine_is_wrt300nv2() || machine_is_tw5334() ||
240 - machine_is_usr8200() || machine_is_tw2662())
241 + machine_is_usr8200() || machine_is_tw2662() ||
242 + machine_is_ap42x())
243 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
245 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
246 --- a/arch/arm/mach-ixp4xx/Kconfig
247 +++ b/arch/arm/mach-ixp4xx/Kconfig
248 @@ -8,6 +8,14 @@ menu "Intel IXP4xx Implementation Option
250 comment "IXP4xx Platforms"
253 + bool "Tonze AP-422/425"
256 + Say 'Y' here if you want your kernel to support Tonze's
257 + AP-422/425 boards. For more information on this platform,
258 + see http://tonze.com.tw
262 prompt "Linksys NSLU2"
263 --- a/arch/arm/mach-ixp4xx/Makefile
264 +++ b/arch/arm/mach-ixp4xx/Makefile
269 +obj-pci-$(CONFIG_MACH_AP42X) += ap42x-pci.o
270 obj-pci-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o
271 obj-pci-$(CONFIG_MACH_AVILA) += avila-pci.o
272 obj-pci-$(CONFIG_MACH_CAMBRIA) += cambria-pci.o
273 @@ -32,6 +33,7 @@ obj-pci-$(CONFIG_MACH_USR8200) += usr82
277 +obj-$(CONFIG_MACH_AP42X) += ap42x-setup.o
278 obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-setup.o
279 obj-$(CONFIG_MACH_AVILA) += avila-setup.o
280 obj-$(CONFIG_MACH_CAMBRIA) += cambria-setup.o