1 From 95dac4a842a3c66f69f949b48f9075e16275f77b Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sun, 30 Jun 2013 15:48:47 +0200
4 Subject: [PATCH 07/36] 115-sidewinder_support.patch
7 arch/arm/mach-ixp4xx/Kconfig | 10 +-
8 arch/arm/mach-ixp4xx/Makefile | 2 +
9 arch/arm/mach-ixp4xx/sidewinder-pci.c | 68 ++++++++++++++
10 arch/arm/mach-ixp4xx/sidewinder-setup.c | 151 +++++++++++++++++++++++++++++++
11 4 files changed, 230 insertions(+), 1 deletion(-)
12 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-pci.c
13 create mode 100644 arch/arm/mach-ixp4xx/sidewinder-setup.c
15 --- a/arch/arm/mach-ixp4xx/Kconfig
16 +++ b/arch/arm/mach-ixp4xx/Kconfig
17 @@ -77,6 +77,14 @@ config MACH_PRONGHORN
18 config MACH_PRONGHORNMETRO
19 def_bool MACH_PRONGHORN
21 +config MACH_SIDEWINDER
22 + bool "ADI Sidewinder"
25 + Say 'Y' here if you want your kernel to support the ADI
26 + Engineering Sidewinder board. For more information on this
27 + platform, see http://www.adiengineering.com
32 @@ -173,7 +181,7 @@ config MACH_ARCOM_VULCAN
36 - depends on MACH_IXDP465
37 + depends on MACH_IXDP465 || MACH_SIDEWINDER
41 --- a/arch/arm/mach-ixp4xx/Makefile
42 +++ b/arch/arm/mach-ixp4xx/Makefile
43 @@ -20,6 +20,7 @@ obj-pci-$(CONFIG_MACH_WG302V2) += wg302
44 obj-pci-$(CONFIG_MACH_FSG) += fsg-pci.o
45 obj-pci-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-pci.o
46 obj-pci-$(CONFIG_MACH_PRONGHORN) += pronghorn-pci.o
47 +obj-pci-$(CONFIG_MACH_SIDEWINDER) += sidewinder-pci.o
51 @@ -41,6 +42,7 @@ obj-$(CONFIG_MACH_FSG) += fsg-setup.o
52 obj-$(CONFIG_MACH_GORAMO_MLR) += goramo_mlr.o
53 obj-$(CONFIG_MACH_ARCOM_VULCAN) += vulcan-setup.o
54 obj-$(CONFIG_MACH_PRONGHORN) += pronghorn-setup.o
55 +obj-$(CONFIG_MACH_SIDEWINDER) += sidewinder-setup.o
57 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
58 obj-$(CONFIG_IXP4XX_QMGR) += ixp4xx_qmgr.o
60 +++ b/arch/arm/mach-ixp4xx/sidewinder-pci.c
63 + * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
65 + * PCI setup routines for ADI Engineering Sidewinder
67 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
69 + * based on coyote-pci.c:
70 + * Copyright (C) 2002 Jungo Software Technologies.
71 + * Copyright (C) 2003 MontaVista Softwrae, Inc.
73 + * Maintainer: Imre Kaloz <kaloz@openwrt.org>
75 + * This program is free software; you can redistribute it and/or modify
76 + * it under the terms of the GNU General Public License version 2 as
77 + * published by the Free Software Foundation.
81 +#include <linux/kernel.h>
82 +#include <linux/pci.h>
83 +#include <linux/init.h>
84 +#include <linux/irq.h>
86 +#include <asm/mach-types.h>
87 +#include <mach/hardware.h>
90 +#include <asm/mach/pci.h>
92 +void __init sidewinder_pci_preinit(void)
94 + irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);
95 + irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
96 + irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);
98 + ixp4xx_pci_preinit();
101 +static int __init sidewinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
104 + return IRQ_IXP4XX_GPIO11;
105 + else if (slot == 2)
106 + return IRQ_IXP4XX_GPIO10;
107 + else if (slot == 3)
108 + return IRQ_IXP4XX_GPIO9;
113 +struct hw_pci sidewinder_pci __initdata = {
114 + .nr_controllers = 1,
115 + .preinit = sidewinder_pci_preinit,
116 + .ops = &ixp4xx_ops,
117 + .setup = ixp4xx_setup,
118 + .map_irq = sidewinder_map_irq,
121 +int __init sidewinder_pci_init(void)
123 + if (machine_is_sidewinder())
124 + pci_common_init(&sidewinder_pci);
128 +subsys_initcall(sidewinder_pci_init);
130 +++ b/arch/arm/mach-ixp4xx/sidewinder-setup.c
133 + * arch/arm/mach-ixp4xx/sidewinder-setup.c
135 + * Board setup for the ADI Engineering Sidewinder
137 + * Copyright (C) 2008 Imre Kaloz <Kaloz@openwrt.org>
139 + * based on coyote-setup.c:
140 + * Copyright (C) 2003-2005 MontaVista Software, Inc.
142 + * Author: Imre Kaloz <Kaloz@openwrt.org>
145 +#include <linux/kernel.h>
146 +#include <linux/serial.h>
147 +#include <linux/serial_8250.h>
148 +#include <linux/dma-mapping.h>
150 +#include <asm/mach-types.h>
151 +#include <asm/mach/arch.h>
152 +#include <asm/mach/flash.h>
154 +static struct flash_platform_data sidewinder_flash_data = {
155 + .map_name = "cfi_probe",
159 +static struct resource sidewinder_flash_resource = {
160 + .flags = IORESOURCE_MEM,
163 +static struct platform_device sidewinder_flash = {
164 + .name = "IXP4XX-Flash",
167 + .platform_data = &sidewinder_flash_data,
169 + .num_resources = 1,
170 + .resource = &sidewinder_flash_resource,
173 +static struct resource sidewinder_uart_resources[] = {
175 + .start = IXP4XX_UART1_BASE_PHYS,
176 + .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
177 + .flags = IORESOURCE_MEM,
180 + .start = IXP4XX_UART2_BASE_PHYS,
181 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
182 + .flags = IORESOURCE_MEM,
186 +static struct plat_serial8250_port sidewinder_uart_data[] = {
188 + .mapbase = IXP4XX_UART1_BASE_PHYS,
189 + .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
190 + .irq = IRQ_IXP4XX_UART1,
191 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
192 + .iotype = UPIO_MEM,
194 + .uartclk = IXP4XX_UART_XTAL,
197 + .mapbase = IXP4XX_UART2_BASE_PHYS,
198 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
199 + .irq = IRQ_IXP4XX_UART2,
200 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
201 + .iotype = UPIO_MEM,
203 + .uartclk = IXP4XX_UART_XTAL,
208 +static struct platform_device sidewinder_uart = {
209 + .name = "serial8250",
210 + .id = PLAT8250_DEV_PLATFORM,
212 + .platform_data = sidewinder_uart_data,
214 + .num_resources = ARRAY_SIZE(sidewinder_uart_resources),
215 + .resource = sidewinder_uart_resources,
218 +static struct eth_plat_info sidewinder_plat_eth[] = {
224 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
235 +static struct platform_device sidewinder_eth[] = {
237 + .name = "ixp4xx_eth",
238 + .id = IXP4XX_ETH_NPEB,
239 + .dev.platform_data = sidewinder_plat_eth,
240 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
242 + .name = "ixp4xx_eth",
243 + .id = IXP4XX_ETH_NPEC,
244 + .dev.platform_data = sidewinder_plat_eth + 1,
245 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
247 + .name = "ixp4xx_eth",
248 + .id = IXP4XX_ETH_NPEA,
249 + .dev.platform_data = sidewinder_plat_eth + 2,
250 + .dev.coherent_dma_mask = DMA_BIT_MASK(32),
254 +static struct platform_device *sidewinder_devices[] __initdata = {
257 + &sidewinder_eth[0],
258 + &sidewinder_eth[1],
259 + &sidewinder_eth[2],
262 +static void __init sidewinder_init(void)
266 + sidewinder_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
267 + sidewinder_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_64M - 1;
269 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
270 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
272 + platform_add_devices(sidewinder_devices, ARRAY_SIZE(sidewinder_devices));
275 +MACHINE_START(SIDEWINDER, "ADI Engineering Sidewinder")
276 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
277 + .map_io = ixp4xx_map_io,
278 + .init_irq = ixp4xx_init_irq,
279 + .init_time = ixp4xx_timer_init,
280 + .atag_offset = 0x0100,
281 + .init_machine = sidewinder_init,
282 +#if defined(CONFIG_PCI)
283 + .dma_zone_size = SZ_64M,
285 + .restart = ixp4xx_restart,