Path: blob/master/arch/arm/mach-ixp23xx/roadrunner.c
10817 views
/*1* arch/arm/mach-ixp23xx/roadrunner.c2*3* RoadRunner board-specific routines4*5* Author: Deepak Saxena <[email protected]>6*7* Copyright 2005 (c) MontaVista Software, Inc.8*9* Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation10*11* This file is licensed under the terms of the GNU General Public12* License version 2. This program is licensed "as is" without any13* warranty of any kind, whether express or implied.14*/1516#include <linux/kernel.h>17#include <linux/init.h>18#include <linux/spinlock.h>19#include <linux/sched.h>20#include <linux/interrupt.h>21#include <linux/serial.h>22#include <linux/tty.h>23#include <linux/bitops.h>24#include <linux/ioport.h>25#include <linux/serial_8250.h>26#include <linux/serial_core.h>27#include <linux/device.h>28#include <linux/mm.h>29#include <linux/pci.h>30#include <linux/mtd/physmap.h>3132#include <asm/types.h>33#include <asm/setup.h>34#include <asm/memory.h>35#include <mach/hardware.h>36#include <asm/mach-types.h>37#include <asm/irq.h>38#include <asm/system.h>39#include <asm/tlbflush.h>40#include <asm/pgtable.h>4142#include <asm/mach/map.h>43#include <asm/mach/irq.h>44#include <asm/mach/arch.h>45#include <asm/mach/pci.h>4647/*48* Interrupt mapping49*/50#define INTA IRQ_ROADRUNNER_PCI_INTA51#define INTB IRQ_ROADRUNNER_PCI_INTB52#define INTC IRQ_ROADRUNNER_PCI_INTC53#define INTD IRQ_ROADRUNNER_PCI_INTD5455#define INTC_PIN IXP23XX_GPIO_PIN_1156#define INTD_PIN IXP23XX_GPIO_PIN_125758static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)59{60static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};61static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};62static int usb_irq[] = {INTB, INTC, INTD, -1};63static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};64static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};6566switch(dev->bus->number) {67case 0:68switch(dev->devfn) {69case 0x0: // PCI-PCI bridge70break;71case 0x8: // PCI Card Slot72return pci_card_slot_irq[pin - 1];73case 0x10: // PMC Slot74return pmc_card_slot_irq[pin - 1];75case 0x18: // PMC Slot Secondary Agent76break;77case 0x20: // IXP Processor78break;79default:80return NO_IRQ;81}82break;8384case 1:85switch(dev->devfn) {86case 0x0: // IDE Controller87return (pin == 1) ? INTC : -1;88case 0x8: // USB fun 089case 0x9: // USB fun 190case 0xa: // USB fun 291return usb_irq[pin - 1];92case 0x10: // Mini PCI 193return mini_pci_1_irq[pin-1];94case 0x18: // Mini PCI 295return mini_pci_2_irq[pin-1];96case 0x20: // MEM slot97return (pin == 1) ? INTA : -1;98default:99return NO_IRQ;100}101break;102103default:104return NO_IRQ;105}106107return NO_IRQ;108}109110static void __init roadrunner_pci_preinit(void)111{112irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQ_TYPE_LEVEL_LOW);113irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQ_TYPE_LEVEL_LOW);114115ixp23xx_pci_preinit();116}117118static struct hw_pci roadrunner_pci __initdata = {119.nr_controllers = 1,120.preinit = roadrunner_pci_preinit,121.setup = ixp23xx_pci_setup,122.scan = ixp23xx_pci_scan_bus,123.map_irq = roadrunner_map_irq,124};125126static int __init roadrunner_pci_init(void)127{128if (machine_is_roadrunner())129pci_common_init(&roadrunner_pci);130131return 0;132};133134subsys_initcall(roadrunner_pci_init);135136static struct physmap_flash_data roadrunner_flash_data = {137.width = 2,138};139140static struct resource roadrunner_flash_resource = {141.start = 0x90000000,142.end = 0x93ffffff,143.flags = IORESOURCE_MEM,144};145146static struct platform_device roadrunner_flash = {147.name = "physmap-flash",148.id = 0,149.dev = {150.platform_data = &roadrunner_flash_data,151},152.num_resources = 1,153.resource = &roadrunner_flash_resource,154};155156static void __init roadrunner_init(void)157{158platform_device_register(&roadrunner_flash);159160/*161* Mark flash as writeable162*/163IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;164IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;165IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;166IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;167168ixp23xx_sys_init();169}170171MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")172/* Maintainer: Deepak Saxena */173.map_io = ixp23xx_map_io,174.init_irq = ixp23xx_init_irq,175.timer = &ixp23xx_timer,176.boot_params = 0x00000100,177.init_machine = roadrunner_init,178MACHINE_END179180181