From patchwork Mon Jun 13 06:39:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 873942 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5D6fKWh010423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 13 Jun 2011 06:41:41 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QW0pf-0002pl-9x; Mon, 13 Jun 2011 06:41:07 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QW0pe-0001sw-SY; Mon, 13 Jun 2011 06:41:06 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QW0pa-0001se-RG for linux-arm-kernel@lists.infradead.org; Mon, 13 Jun 2011 06:41:04 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QW0pY-00030k-MV; Mon, 13 Jun 2011 06:41:01 +0000 Received: from [222.65.92.83] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QW0pC-0002gb-3V; Mon, 13 Jun 2011 06:41:00 +0000 From: Bryan Wu To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, linus.walleij@linaro.org Subject: [PATCH 1/6] arm: footbridge: consolidation code of CATS machine Date: Mon, 13 Jun 2011 14:39:40 +0800 Message-Id: <1307947185-5159-2-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.5 In-Reply-To: <1307947185-5159-1-git-send-email-bryan.wu@canonical.com> References: <1307947185-5159-1-git-send-email-bryan.wu@canonical.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110613_024103_100957_35EFD17F X-CRM114-Status: GOOD ( 18.12 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [91.189.90.139 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 13 Jun 2011 06:41:41 +0000 (UTC) move PCI code to board file Signed-off-by: Bryan Wu --- arch/arm/mach-footbridge/Makefile | 3 +- arch/arm/mach-footbridge/cats-hw.c | 95 ----------------------- arch/arm/mach-footbridge/cats-pci.c | 58 -------------- arch/arm/mach-footbridge/cats.c | 143 +++++++++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 155 deletions(-) delete mode 100644 arch/arm/mach-footbridge/cats-hw.c delete mode 100644 arch/arm/mach-footbridge/cats-pci.c create mode 100644 arch/arm/mach-footbridge/cats.c diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile index 3afb1b2..e0a8b21 100644 --- a/arch/arm/mach-footbridge/Makefile +++ b/arch/arm/mach-footbridge/Makefile @@ -9,7 +9,6 @@ obj-m := obj-n := obj- := -pci-$(CONFIG_ARCH_CATS) += cats-pci.o pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o @@ -17,7 +16,7 @@ pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o -obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o +obj-$(CONFIG_ARCH_CATS) += cats.o isa-timer.o obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c deleted file mode 100644 index 5b1a8db..0000000 --- a/arch/arm/mach-footbridge/cats-hw.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * linux/arch/arm/mach-footbridge/cats-hw.c - * - * CATS machine fixup - * - * Copyright (C) 1998, 1999 Russell King, Phil Blundell - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "common.h" - -#define CFG_PORT 0x370 -#define INDEX_PORT (CFG_PORT) -#define DATA_PORT (CFG_PORT + 1) - -static int __init cats_hw_init(void) -{ - if (machine_is_cats()) { - /* Set Aladdin to CONFIGURE mode */ - outb(0x51, CFG_PORT); - outb(0x23, CFG_PORT); - - /* Select logical device 3 */ - outb(0x07, INDEX_PORT); - outb(0x03, DATA_PORT); - - /* Set parallel port to DMA channel 3, ECP+EPP1.9, - enable EPP timeout */ - outb(0x74, INDEX_PORT); - outb(0x03, DATA_PORT); - - outb(0xf0, INDEX_PORT); - outb(0x0f, DATA_PORT); - - outb(0xf1, INDEX_PORT); - outb(0x07, DATA_PORT); - - /* Select logical device 4 */ - outb(0x07, INDEX_PORT); - outb(0x04, DATA_PORT); - - /* UART1 high speed mode */ - outb(0xf0, INDEX_PORT); - outb(0x02, DATA_PORT); - - /* Select logical device 5 */ - outb(0x07, INDEX_PORT); - outb(0x05, DATA_PORT); - - /* UART2 high speed mode */ - outb(0xf0, INDEX_PORT); - outb(0x02, DATA_PORT); - - /* Set Aladdin to RUN mode */ - outb(0xbb, CFG_PORT); - } - - return 0; -} - -__initcall(cats_hw_init); - -/* - * CATS uses soft-reboot by default, since - * hard reboots fail on early boards. - */ -static void __init -fixup_cats(struct machine_desc *desc, struct tag *tags, - char **cmdline, struct meminfo *mi) -{ - screen_info.orig_video_lines = 25; - screen_info.orig_video_points = 16; - screen_info.orig_y = 24; -} - -MACHINE_START(CATS, "Chalice-CATS") - /* Maintainer: Philip Blundell */ - .boot_params = 0x00000100, - .soft_reboot = 1, - .fixup = fixup_cats, - .map_io = footbridge_map_io, - .init_irq = footbridge_init_irq, - .timer = &isa_timer, -MACHINE_END diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c deleted file mode 100644 index ae3e1c8..0000000 --- a/arch/arm/mach-footbridge/cats-pci.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * linux/arch/arm/mach-footbridge/cats-pci.c - * - * PCI bios-type initialisation for PCI machines - * - * Bits taken from various places. - */ -#include -#include -#include - -#include -#include -#include - -/* cats host-specific stuff */ -static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; - -static int __init cats_map_irq(struct pci_dev *dev, u8 slot, u8 pin) -{ - if (dev->irq >= 255) - return -1; /* not a valid interrupt. */ - - if (dev->irq >= 128) - return dev->irq & 0x1f; - - if (dev->irq >= 1 && dev->irq <= 4) - return irqmap_cats[dev->irq - 1]; - - if (dev->irq != 0) - printk("PCI: device %02x:%02x has unknown irq line %x\n", - dev->bus->number, dev->devfn, dev->irq); - - return -1; -} - -/* - * why not the standard PCI swizzle? does this prevent 4-port tulip - * cards being used (ie, pci-pci bridge based cards)? - */ -static struct hw_pci cats_pci __initdata = { - .swizzle = NULL, - .map_irq = cats_map_irq, - .nr_controllers = 1, - .setup = dc21285_setup, - .scan = dc21285_scan_bus, - .preinit = dc21285_preinit, - .postinit = dc21285_postinit, -}; - -static int __init cats_pci_init(void) -{ - if (machine_is_cats()) - pci_common_init(&cats_pci); - return 0; -} - -subsys_initcall(cats_pci_init); diff --git a/arch/arm/mach-footbridge/cats.c b/arch/arm/mach-footbridge/cats.c new file mode 100644 index 0000000..3f643f4 --- /dev/null +++ b/arch/arm/mach-footbridge/cats.c @@ -0,0 +1,143 @@ +/* + * linux/arch/arm/mach-footbridge/cats.c + * + * CATS machine fixup + * + * Copyright (C) 1998, 1999 Russell King, Phil Blundell + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "common.h" + +#define CFG_PORT 0x370 +#define INDEX_PORT (CFG_PORT) +#define DATA_PORT (CFG_PORT + 1) + +static int __init cats_init(void) +{ + if (machine_is_cats()) { + /* Set Aladdin to CONFIGURE mode */ + outb(0x51, CFG_PORT); + outb(0x23, CFG_PORT); + + /* Select logical device 3 */ + outb(0x07, INDEX_PORT); + outb(0x03, DATA_PORT); + + /* Set parallel port to DMA channel 3, ECP+EPP1.9, + enable EPP timeout */ + outb(0x74, INDEX_PORT); + outb(0x03, DATA_PORT); + + outb(0xf0, INDEX_PORT); + outb(0x0f, DATA_PORT); + + outb(0xf1, INDEX_PORT); + outb(0x07, DATA_PORT); + + /* Select logical device 4 */ + outb(0x07, INDEX_PORT); + outb(0x04, DATA_PORT); + + /* UART1 high speed mode */ + outb(0xf0, INDEX_PORT); + outb(0x02, DATA_PORT); + + /* Select logical device 5 */ + outb(0x07, INDEX_PORT); + outb(0x05, DATA_PORT); + + /* UART2 high speed mode */ + outb(0xf0, INDEX_PORT); + outb(0x02, DATA_PORT); + + /* Set Aladdin to RUN mode */ + outb(0xbb, CFG_PORT); + } + + return 0; +} + +__initcall(cats_init); + +/* + * CATS uses soft-reboot by default, since + * hard reboots fail on early boards. + */ +static void __init +fixup_cats(struct machine_desc *desc, struct tag *tags, + char **cmdline, struct meminfo *mi) +{ + screen_info.orig_video_lines = 25; + screen_info.orig_video_points = 16; + screen_info.orig_y = 24; +} + +/* cats host-specific PCI stuff */ +static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; + +static int __init cats_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +{ + if (dev->irq >= 255) + return -1; /* not a valid interrupt. */ + + if (dev->irq >= 128) + return dev->irq & 0x1f; + + if (dev->irq >= 1 && dev->irq <= 4) + return irqmap_cats[dev->irq - 1]; + + if (dev->irq != 0) + printk("PCI: device %02x:%02x has unknown irq line %x\n", + dev->bus->number, dev->devfn, dev->irq); + + return -1; +} + +/* + * why not the standard PCI swizzle? does this prevent 4-port tulip + * cards being used (ie, pci-pci bridge based cards)? + */ +static struct hw_pci cats_pci __initdata = { + .swizzle = NULL, + .map_irq = cats_map_irq, + .nr_controllers = 1, + .setup = dc21285_setup, + .scan = dc21285_scan_bus, + .preinit = dc21285_preinit, + .postinit = dc21285_postinit, +}; + +static int __init cats_pci_init(void) +{ + if (machine_is_cats()) + pci_common_init(&cats_pci); + return 0; +} + +subsys_initcall(cats_pci_init); + + +MACHINE_START(CATS, "Chalice-CATS") + /* Maintainer: Philip Blundell */ + .boot_params = 0x00000100, + .soft_reboot = 1, + .fixup = fixup_cats, + .map_io = footbridge_map_io, + .init_irq = footbridge_init_irq, + .timer = &isa_timer, +MACHINE_END