1 From 60bdaaaf3446b4237566c6e04855186fc7bd766b Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Sun, 13 Jul 2008 22:46:45 +0200
4 Subject: [PATCH] Add support for the ADI Sidewinder
6 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
8 arch/arm/mach-ixp4xx/Kconfig | 10 ++-
9 arch/arm/mach-ixp4xx/Makefile | 2 +
10 arch/arm/mach-ixp4xx/sidewinder-pci.c | 68 ++++++++++++++
11 arch/arm/mach-ixp4xx/sidewinder-setup.c | 151 +++++++++++++++++++++++++++++++
12 4 files changed, 230 insertions(+), 1 deletions(-)
13 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-pci.c
14 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-setup.c
16 --- a/arch/arm/mach-ixp4xx/Kconfig
17 +++ b/arch/arm/mach-ixp4xx/Kconfig
19 config MACH_PRONGHORNMETRO
20 def_bool MACH_PRONGHORN
22 +config MACH_SIDEWINDER
23 + bool "ADI Sidewinder"
26 + Say 'Y' here if you want your kernel to support the ADI
27 + Engineering Sidewinder board. For more information on this
28 + platform, see http://www.adiengineering.com
37 - depends on MACH_IXDP465
38 + depends on MACH_IXDP465 || MACH_SIDEWINDER
42 --- a/arch/arm/mach-ixp4xx/Makefile
43 +++ b/arch/arm/mach-ixp4xx/Makefile
45 obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o
46 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
47 obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
48 +obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
53 obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o
54 obj-$(CONFIG_MACH_FSG) += fsg-setup.o
55 obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
56 +obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
58 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
59 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
61 +++ b/arch/arm/mach-ixp4xx/sidewinder-pci.c
64 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
66 + * PCI setup routines for ADI Engineering Sidewinder
68 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
70 + * based on coyote-pci.c:
71 + * Copyright (C) 2002 Jungo Software Technologies.
72 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
74 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
76 + * This program is free software; you can redistribute it and/or modify
77 + * it under the terms of the GNU General Public License version 2 as
78 + * published by the Free Software Foundation.
82 +#include <linux/kernel.h>
83 +#include <linux/pci.h>
84 +#include <linux/init.h>
85 +#include <linux/irq.h>
87 +#include <asm/mach-types.h>
88 +#include <asm/hardware.h>
91 +#include <asm/mach/pci.h>
93 +void __init sidewinder_pci_preinit(void)
95 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW);
96 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW);
97 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW);
99 + ixp4xx_pci_preinit();
102 +static int __init sidewinder_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
105 + return IRQ_IXP4XX_GPIO11;
106 + else if (slot == 2)
107 + return IRQ_IXP4XX_GPIO10;
108 + else if (slot == 3)
109 + return IRQ_IXP4XX_GPIO9;
114 +struct hw_pci sidewinder_pci __initdata = {
115 + .nr_controllers = 1,
116 + .preinit = sidewinder_pci_preinit,
117 + .swizzle = pci_std_swizzle,
118 + .setup = ixp4xx_setup,
119 + .scan = ixp4xx_scan_bus,
120 + .map_irq = sidewinder_map_irq,
123 +int __init sidewinder_pci_init(void)
125 + if (machine_is_sidewinder())
126 + pci_common_init(&sidewinder_pci);
130 +subsys_initcall(sidewinder_pci_init);
132 +++ b/arch/arm/mach-ixp4xx/sidewinder-setup.c
135 + * arch/arm/mach-ixp4xx/sidewinder-setup.c
137 + * Board setup for the ADI Engineering Sidewinder
139 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
141 + * based on coyote-setup.c:
142 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
144 + * Author: Imre Kaloz <Kaloz@openwrt.org>
147 +#include <linux/kernel.h>
148 +#include <linux/serial.h>
149 +#include <linux/serial_8250.h>
151 +#include <asm/mach-types.h>
152 +#include <asm/mach/arch.h>
153 +#include <asm/mach/flash.h>
155 +static struct flash_platform_data sidewinder_flash_data = {
156 + .map_name = "cfi_probe",
160 +static struct resource sidewinder_flash_resource = {
161 + .flags = IORESOURCE_MEM,
164 +static struct platform_device sidewinder_flash = {
165 + .name = "IXP4XX-Flash",
168 + .platform_data = &sidewinder_flash_data,
170 + .num_resources = 1,
171 + .resource = &sidewinder_flash_resource,
174 +static struct resource sidewinder_uart_resources[] = {
176 + .start = IXP4XX_UART1_BASE_PHYS,
177 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
178 + .flags = IORESOURCE_MEM,
181 + .start = IXP4XX_UART2_BASE_PHYS,
182 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
183 + .flags = IORESOURCE_MEM,
187 +static struct plat_serial8250_port sidewinder_uart_data[] = {
189 + .mapbase = IXP4XX_UART1_BASE_PHYS,
190 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
191 + .irq = IRQ_IXP4XX_UART1,
192 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
193 + .iotype = UPIO_MEM,
195 + .uartclk = IXP4XX_UART_XTAL,
198 + .mapbase = IXP4XX_UART2_BASE_PHYS,
199 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
200 + .irq = IRQ_IXP4XX_UART2,
201 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
202 + .iotype = UPIO_MEM,
204 + .uartclk = IXP4XX_UART_XTAL,
209 +static struct platform_device sidewinder_uart = {
210 + .name = "serial8250",
211 + .id = PLAT8250_DEV_PLATFORM,
213 + .platform_data = sidewinder_uart_data,
215 + .num_resources = ARRAY_SIZE(sidewinder_uart_resources),
216 + .resource = sidewinder_uart_resources,
219 +static struct eth_plat_info sidewinder_plat_eth[] = {
225 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
236 +static struct platform_device sidewinder_eth[] = {
238 + .name = "ixp4xx_eth",
239 + .id = IXP4XX_ETH_NPEB,
240 + .dev.platform_data = sidewinder_plat_eth,
242 + .name = "ixp4xx_eth",
243 + .id = IXP4XX_ETH_NPEC,
244 + .dev.platform_data = sidewinder_plat_eth + 1,
246 + .name = "ixp4xx_eth",
247 + .id = IXP4XX_ETH_NPEA,
248 + .dev.platform_data = sidewinder_plat_eth + 2,
252 +static struct platform_device *sidewinder_devices[] __initdata = {
255 + &sidewinder_eth[0],
256 + &sidewinder_eth[1],
257 + &sidewinder_eth[2],
260 +static void __init sidewinder_init(void)
264 + sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
265 + sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1;
267 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
268 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
270 + platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices));
273 +MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder")
274 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
275 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
276 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
277 + .map_io = ixp4xx_map_io,
278 + .init_irq = ixp4xx_init_irq,
279 + .timer = &ixp4xx_timer,
280 + .boot_params = 0x0100,
281 + .init_machine = sidewinder_init,