From e40c8c45ba1829d0ca28109c3c83432c45d80bef Mon Sep 17 00:00:00 2001
From: Imre Kaloz <kaloz@openwrt.org>
Date: Mon, 2 Apr 2007 14:44:20 +0000
Subject: [PATCH] add basic support for the ADI Engineering Pronghorn Metro

SVN-Revision: 6831
---
 .../patches/400-pronghorn_metro.patch         | 353 ++++++++++++++++++
 1 file changed, 353 insertions(+)
 create mode 100644 target/linux/ixp4xx-2.6/patches/400-pronghorn_metro.patch

diff --git a/target/linux/ixp4xx-2.6/patches/400-pronghorn_metro.patch b/target/linux/ixp4xx-2.6/patches/400-pronghorn_metro.patch
new file mode 100644
index 0000000000..f4773cf31f
--- /dev/null
+++ b/target/linux/ixp4xx-2.6/patches/400-pronghorn_metro.patch
@@ -0,0 +1,353 @@
+diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig
+--- linux-2.6.19.2/arch/arm/mach-ixp4xx/Kconfig	2007-04-02 16:10:51.000000000 +0200
++++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Kconfig	2007-04-02 16:11:12.000000000 +0200
+@@ -49,6 +49,22 @@
+ 	  WG302 v2 or WAG302 v2 Access Points. For more information
+ 	  on this platform, see http://openwrt.org
+ 
++config MACH_PRONGHORN
++	bool "Pronghorn"
++	select PCI
++	help
++	  Say 'Y' here if you want your kernel to support the ADI 
++	  Engineering Pronghorn Platform. For more
++	  information on this platform, see <file:Documentation/arm/IXP4xx>.
++
++config MACH_PRONGHORNMETRO
++	bool "Pronghorn Metro"
++	select PCI
++	help
++	  Say 'Y' here if you want your kernel to support the ADI 
++	  Engineering Pronghorn Metro Platform. For more
++	  information on this platform, see <file:Documentation/arm/IXP4xx>.
++
+ config ARCH_IXDP425
+ 	bool "IXDP425"
+ 	help
+diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile
+--- linux-2.6.19.2/arch/arm/mach-ixp4xx/Makefile	2007-04-02 16:10:51.000000000 +0200
++++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/Makefile	2007-04-02 16:15:51.000000000 +0200
+@@ -13,6 +13,7 @@
+ obj-pci-$(CONFIG_MACH_NAS100D)		+= nas100d-pci.o
+ obj-pci-$(CONFIG_MACH_GATEWAY7001)	+= gateway7001-pci.o
+ obj-pci-$(CONFIG_MACH_WG302V2)		+= wg302v2-pci.o
++obj-pci-$(CONFIG_MACH_PRONGHORNMETRO)	+= pronghornmetro-pci.o
+ 
+ obj-y	+= common.o
+ 
+@@ -24,5 +25,6 @@
+ obj-$(CONFIG_MACH_NAS100D)	+= nas100d-setup.o nas100d-power.o
+ obj-$(CONFIG_MACH_GATEWAY7001)	+= gateway7001-setup.o
+ obj-$(CONFIG_MACH_WG302V2)	+= wg302v2-setup.o
++obj-$(CONFIG_MACH_PRONGHORNMETRO)	+= pronghornmetro-setup.o
+ 
+ obj-$(CONFIG_PCI)		+= $(obj-pci-$(CONFIG_PCI)) common-pci.o
+diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-pci.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c
+--- linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-pci.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-pci.c	2007-04-02 16:17:35.000000000 +0200
+@@ -0,0 +1,70 @@
++/*
++ * arch/arch/mach-ixp4xx/pronghornmetro-pci.c
++ *
++ * PCI setup routines for ADI Engineering Pronghorn Metro platform
++ *
++ * Copyright (C) 2002 Jungo Software Technologies.
++ * Copyright (C) 2003 MontaVista Softwrae, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * Author: Copied from coyote-pci.c
++ */
++
++#include <linux/kernel.h>
++#include <linux/pci.h>
++#include <linux/init.h>
++#include <linux/irq.h>
++
++#include <asm/mach-types.h>
++#include <asm/hardware.h>
++#include <asm/irq.h>
++
++#include <asm/mach/pci.h>
++
++extern void ixp4xx_pci_preinit(void);
++extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
++extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
++
++void __init pronghornmetro_pci_preinit(void)
++{
++	set_irq_type(IRQ_PCI_SLOT0, IRQT_LOW);
++	set_irq_type(IRQ_PCI_SLOT1, IRQT_LOW);
++	set_irq_type(IRQ_PCI_SLOT2, IRQT_LOW);
++	set_irq_type(IRQ_PCI_SLOT3, IRQT_LOW);
++
++	ixp4xx_pci_preinit();
++}
++
++static int __init pronghornmetro_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
++{
++	if (slot == PCI_SLOT0_DEVID)
++		return IRQ_PCI_SLOT0;
++	else if (slot == PCI_SLOT1_DEVID)
++		return IRQ_PCI_SLOT1;
++	else if (slot == PCI_SLOT2_DEVID)
++		return IRQ_PCI_SLOT2;
++	else if (slot == PCI_SLOT3_DEVID)
++		return IRQ_PCI_SLOT3;
++	else return -1;
++}
++
++struct hw_pci pronghornmetro_pci __initdata = {
++	.nr_controllers = 1,
++	.preinit =        pronghornmetro_pci_preinit,
++	.swizzle =        pci_std_swizzle,
++	.setup =          ixp4xx_setup,
++	.scan =           ixp4xx_scan_bus,
++	.map_irq =        pronghornmetro_map_irq,
++};
++
++int __init pronghornmetro_pci_init(void)
++{
++	if (machine_is_pronghorn_metro())
++		pci_common_init(&pronghornmetro_pci);
++	return 0;
++}
++
++subsys_initcall(pronghornmetro_pci_init);
+diff -Nur linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-setup.c linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c
+--- linux-2.6.19.2/arch/arm/mach-ixp4xx/pronghornmetro-setup.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19.2-owrt/arch/arm/mach-ixp4xx/pronghornmetro-setup.c	2007-04-02 16:18:13.000000000 +0200
+@@ -0,0 +1,119 @@
++/*
++ * arch/arm/mach-ixp4xx/pronghornmetro-setup.c
++ *
++ * Board setup for ADI Engineering Pronghorn Metro
++ *
++ * Copyright (C) 2003-2005 MontaVista Software, Inc.
++ *
++ * Author: Copied from coyote-setup.c
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/device.h>
++#include <linux/serial.h>
++#include <linux/tty.h>
++#include <linux/serial_8250.h>
++#include <linux/slab.h>
++
++#include <asm/types.h>
++#include <asm/setup.h>
++#include <asm/memory.h>
++#include <asm/hardware.h>
++#include <asm/irq.h>
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/mach/flash.h>
++
++static struct flash_platform_data pronghornmetro_flash_data = {
++	.map_name	= "cfi_probe",
++	.width		= 2,
++};
++
++static struct resource pronghornmetro_flash_resource = {
++	.flags		= IORESOURCE_MEM,
++};
++
++static struct platform_device pronghornmetro_flash = {
++	.name		= "IXP4XX-Flash",
++	.id		= 0,
++	.dev		= {
++		.platform_data = &pronghornmetro_flash_data,
++	},
++	.num_resources	= 1,
++	.resource	= &pronghornmetro_flash_resource,
++};
++
++static struct resource pronghornmetro_uart_resource = {
++	.start	= IXP4XX_UART2_BASE_PHYS,
++	.end	= IXP4XX_UART2_BASE_PHYS + 0x0fff,
++	.flags	= IORESOURCE_MEM,
++};
++
++static struct ixp4xx_i2c_pins pronghornmetro_i2c_gpio_pins = {
++	.sda_pin	= PRONGHORNMETRO_SDA_PIN,
++	.scl_pin	= PRONGHORNMETRO_SCL_PIN,
++};
++
++static struct platform_device pronghornmetro_i2c_controller = {
++	.name		= "IXP4XX-I2C",
++	.id		= 0,
++	.dev		= {
++		.platform_data = &pronghornmetro_i2c_gpio_pins,
++	},
++	.num_resources	= 0
++};
++
++static struct plat_serial8250_port pronghornmetro_uart_data[] = {
++	{
++		.mapbase	= IXP4XX_UART2_BASE_PHYS,
++		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
++		.irq		= IRQ_IXP4XX_UART2,
++		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
++		.iotype		= UPIO_MEM,
++		.regshift	= 2,
++		.uartclk	= IXP4XX_UART_XTAL,
++	},
++	{ },
++};
++
++static struct platform_device pronghornmetro_uart = {
++	.name		= "serial8250",
++	.id		= PLAT8250_DEV_PLATFORM,
++	.dev			= {
++		.platform_data	= pronghornmetro_uart_data,
++	},
++	.num_resources	= 1,
++	.resource	= &pronghornmetro_uart_resource,
++};
++
++static struct platform_device *pronghornmetro_devices[] __initdata = {
++	&pronghornmetro_i2c_controller,
++	&pronghornmetro_flash,
++	&pronghornmetro_uart
++};
++
++static void __init pronghornmetro_init(void)
++{
++	ixp4xx_sys_init();
++
++	pronghornmetro_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
++	pronghornmetro_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
++
++	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
++	*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
++
++	platform_add_devices(pronghornmetro_devices, ARRAY_SIZE(pronghornmetro_devices));
++}
++
++#ifdef CONFIG_MACH_PRONGHORNMETRO
++MACHINE_START(PRONGHORNMETRO, "ADI Engineering Pronghorn Metro")
++	.phys_io	= IXP4XX_PERIPHERAL_BASE_PHYS,
++	.io_pg_offst	= ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
++	.map_io		= ixp4xx_map_io,
++	.init_irq	= ixp4xx_init_irq,
++	.timer		= &ixp4xx_timer,
++	.boot_params	= 0x0100,
++	.init_machine	= pronghornmetro_init,
++MACHINE_END
++#endif
+diff -Nur linux-2.6.19.2/Documentation/arm/IXP4xx linux-2.6.19.2-owrt/Documentation/arm/IXP4xx
+--- linux-2.6.19.2/Documentation/arm/IXP4xx	2007-01-10 20:10:37.000000000 +0100
++++ linux-2.6.19.2-owrt/Documentation/arm/IXP4xx	2007-04-02 16:11:12.000000000 +0200
+@@ -111,6 +111,9 @@
+    the platform has two mini-PCI slots used for 802.11[bga] cards.
+    Finally, there is an IDE port hanging off the expansion bus.
+ 
++ADI Engineering Pronghorn Metro Platform
++http://www.adiengineering.com/productsPronghornMetro.html
++
+ Gateworks Avila Network Platform
+ http://www.gateworks.com/avila_sbc.htm
+ 
+diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/hardware.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/hardware.h
+--- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/hardware.h	2007-01-10 20:10:37.000000000 +0100
++++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/hardware.h	2007-04-02 16:11:12.000000000 +0200
+@@ -43,6 +43,7 @@
+ /* Platform specific details */
+ #include "ixdp425.h"
+ #include "coyote.h"
++#include "pronghornmetro.h"
+ #include "prpmc1100.h"
+ #include "nslu2.h"
+ #include "nas100d.h"
+diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/irqs.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/irqs.h
+--- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/irqs.h	2007-01-10 20:10:37.000000000 +0100
++++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/irqs.h	2007-04-02 16:11:12.000000000 +0200
+@@ -94,6 +94,21 @@
+ #define	IRQ_COYOTE_IDE		IRQ_IXP4XX_GPIO5
+ 
+ /*
++ * ADI Pronghorn Metro Board IRQs
++ */
++#if defined(CONFIG_MACH_PRONGHORNMETRO)
++#define IRQ_PCI_SLOT0	 IRQ_IXP4XX_GPIO4
++#define IRQ_PCI_SLOT1	 IRQ_IXP4XX_GPIO6
++#define IRQ_PCI_SLOT2	 IRQ_IXP4XX_GPIO11
++#define IRQ_PCI_SLOT3	 IRQ_IXP4XX_GPIO1
++#define	IRQ_IDE 		 IRQ_IXP4XX_GPIO0
++#elif defined (CONFIG_MACH_PRONGHORN)
++#define IRQ_PCI_SLOT0	 IRQ_IXP4XX_GPIO11
++#define IRQ_PCI_SLOT1	 IRQ_IXP4XX_GPIO6
++#define	IRQ_IDE 		 IRQ_IXP4XX_GPIO0
++#endif
++
++/*
+  * NSLU2 board IRQs
+  */
+ #define        IRQ_NSLU2_PCI_INTA      IRQ_IXP4XX_GPIO11
+diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/pronghornmetro.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/pronghornmetro.h
+--- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/pronghornmetro.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/pronghornmetro.h	2007-04-02 16:11:12.000000000 +0200
+@@ -0,0 +1,47 @@
++/*
++ * include/asm-arm/arch-ixp4xx/pronghornmetro.h
++ *
++ * ADI Engineering platform specific definitions
++ *
++ * Copyright 2004 (c) MontaVista, Software, Inc. 
++ * 
++ * This file is licensed under  the terms of the GNU General Public 
++ * License version 2. This program is licensed "as is" without any 
++ * warranty of any kind, whether express or implied.
++ */
++
++#ifndef __ASM_ARCH_HARDWARE_H__
++#error "Do not include this directly, instead #include <asm/hardware.h>"
++#endif
++
++#if	defined(CONFIG_MACH_PRONGHORNMETRO)
++#define	PRONGHORNMETRO_SDA_PIN		9
++#define	PRONGHORNMETRO_SCL_PIN		10
++
++/* PCI controller GPIO to IRQ pin mappings */
++#define	PCI_SLOT0_PIN	 1
++#define	PCI_SLOT1_PIN	 11
++#define	PCI_SLOT2_PIN	 6
++#define	PCI_SLOT3_PIN	 4
++
++#define	PCI_SLOT0_DEVID  13
++#define	PCI_SLOT1_DEVID  14
++#define	PCI_SLOT2_DEVID  15
++#define	PCI_SLOT3_DEVID  16
++
++#define	TASKFILE_CS 	 3
++#define	TASKFILE_CS_REG	IXP4XX_EXP_CS3
++#define	ALTSTAT_CS  	 4
++
++#elif defined(CONFIG_MACH_PRONGHORN)
++/* PCI controller GPIO to IRQ pin mappings */
++#define	PCI_SLOT0_PIN     11
++#define	PCI_SLOT1_PIN     6
++
++#define	PCI_SLOT0_DEVID   15
++#define	PCI_SLOT1_DEVID   14
++
++#define	TASKFILE_CS       2
++#define	TASKFILE_CS_REG   IXP4XX_EXP_CS2
++#define	ALTSTAT_CS		  3
++#endif
+diff -Nur linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h
+--- linux-2.6.19.2/include/asm-arm/arch-ixp4xx/uncompress.h	2007-04-02 16:10:51.000000000 +0200
++++ linux-2.6.19.2-owrt/include/asm-arm/arch-ixp4xx/uncompress.h	2007-04-02 16:12:24.000000000 +0200
+@@ -40,7 +40,7 @@
+ 	/*
+ 	 * Some boards are using UART2 as console
+ 	 */
+-	if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2())
++	if (machine_is_adi_coyote() || machine_is_gtwx5715() || machine_is_gateway7001() || machine_is_wg302v2() || machine_is_pronghorn() || machine_is_pronghorn_metro())
+ 		uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
+ 	else
+ 		uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
-- 
GitLab