2 * arch/arm/mach-ixp23xx/roadrunner.c
4 * RoadRunner board-specific routines
6 * Author: Deepak Saxena <dsaxena@plexity.net>
8 * Copyright 2005 (c) MontaVista Software, Inc.
10 * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
17 #include <linux/config.h>
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/spinlock.h>
21 #include <linux/sched.h>
22 #include <linux/interrupt.h>
23 #include <linux/serial.h>
24 #include <linux/tty.h>
25 #include <linux/bitops.h>
26 #include <linux/ioport.h>
27 #include <linux/serial.h>
28 #include <linux/serial_8250.h>
29 #include <linux/serial_core.h>
30 #include <linux/device.h>
32 #include <linux/pci.h>
33 #include <linux/mtd/physmap.h>
35 #include <asm/types.h>
36 #include <asm/setup.h>
37 #include <asm/memory.h>
38 #include <asm/hardware.h>
39 #include <asm/mach-types.h>
41 #include <asm/system.h>
42 #include <asm/tlbflush.h>
43 #include <asm/pgtable.h>
45 #include <asm/mach/map.h>
46 #include <asm/mach/irq.h>
47 #include <asm/mach/arch.h>
48 #include <asm/mach/irq.h>
49 #include <asm/mach/pci.h>
54 #define INTA IRQ_ROADRUNNER_PCI_INTA
55 #define INTB IRQ_ROADRUNNER_PCI_INTB
56 #define INTC IRQ_ROADRUNNER_PCI_INTC
57 #define INTD IRQ_ROADRUNNER_PCI_INTD
59 #define INTC_PIN IXP23XX_GPIO_PIN_11
60 #define INTD_PIN IXP23XX_GPIO_PIN_12
62 static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
64 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
65 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
66 static int usb_irq[] = {INTB, INTC, INTD, -1};
67 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
68 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
70 switch(dev->bus->number) {
73 case 0x0: // PCI-PCI bridge
75 case 0x8: // PCI Card Slot
76 return pci_card_slot_irq[pin - 1];
77 case 0x10: // PMC Slot
78 return pmc_card_slot_irq[pin - 1];
79 case 0x18: // PMC Slot Secondary Agent
81 case 0x20: // IXP Processor
90 case 0x0: // IDE Controller
91 return (pin == 1) ? INTC : -1;
92 case 0x8: // USB fun 0
93 case 0x9: // USB fun 1
94 case 0xa: // USB fun 2
95 return usb_irq[pin - 1];
96 case 0x10: // Mini PCI 1
97 return mini_pci_1_irq[pin-1];
98 case 0x18: // Mini PCI 2
99 return mini_pci_2_irq[pin-1];
100 case 0x20: // MEM slot
101 return (pin == 1) ? INTA : -1;
114 static void roadrunner_pci_preinit(void)
116 set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
117 set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
119 ixp23xx_pci_preinit();
122 static struct hw_pci roadrunner_pci __initdata = {
124 .preinit = roadrunner_pci_preinit,
125 .setup = ixp23xx_pci_setup,
126 .scan = ixp23xx_pci_scan_bus,
127 .map_irq = roadrunner_map_irq,
130 static int __init roadrunner_pci_init(void)
132 if (machine_is_roadrunner())
133 pci_common_init(&roadrunner_pci);
138 subsys_initcall(roadrunner_pci_init);
140 static void __init roadrunner_init(void)
142 physmap_configure(0x90000000, 0x04000000, 2, NULL);
145 * Mark flash as writeable
147 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
148 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
149 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
150 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
155 MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
156 /* Maintainer: Deepak Saxena */
157 .phys_io = IXP23XX_PERIPHERAL_PHYS,
158 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
159 .map_io = ixp23xx_map_io,
160 .init_irq = ixp23xx_init_irq,
161 .timer = &ixp23xx_timer,
162 .boot_params = 0x00000100,
163 .init_machine = roadrunner_init,