Linux 2.6.25-rc4
[linux-2.6/next.git] / arch / arm / mach-ixp23xx / roadrunner.c
blobf0f70ba1e46d7c6a14d6b0ccb8ca10ede4777e5e
1 /*
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/kernel.h>
18 #include <linux/init.h>
19 #include <linux/spinlock.h>
20 #include <linux/sched.h>
21 #include <linux/interrupt.h>
22 #include <linux/serial.h>
23 #include <linux/tty.h>
24 #include <linux/bitops.h>
25 #include <linux/ioport.h>
26 #include <linux/serial_8250.h>
27 #include <linux/serial_core.h>
28 #include <linux/device.h>
29 #include <linux/mm.h>
30 #include <linux/pci.h>
31 #include <linux/mtd/physmap.h>
33 #include <asm/types.h>
34 #include <asm/setup.h>
35 #include <asm/memory.h>
36 #include <asm/hardware.h>
37 #include <asm/mach-types.h>
38 #include <asm/irq.h>
39 #include <asm/system.h>
40 #include <asm/tlbflush.h>
41 #include <asm/pgtable.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/irq.h>
45 #include <asm/mach/arch.h>
46 #include <asm/mach/pci.h>
49 * Interrupt mapping
51 #define INTA IRQ_ROADRUNNER_PCI_INTA
52 #define INTB IRQ_ROADRUNNER_PCI_INTB
53 #define INTC IRQ_ROADRUNNER_PCI_INTC
54 #define INTD IRQ_ROADRUNNER_PCI_INTD
56 #define INTC_PIN IXP23XX_GPIO_PIN_11
57 #define INTD_PIN IXP23XX_GPIO_PIN_12
59 static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
61 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
62 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
63 static int usb_irq[] = {INTB, INTC, INTD, -1};
64 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
65 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
67 switch(dev->bus->number) {
68 case 0:
69 switch(dev->devfn) {
70 case 0x0: // PCI-PCI bridge
71 break;
72 case 0x8: // PCI Card Slot
73 return pci_card_slot_irq[pin - 1];
74 case 0x10: // PMC Slot
75 return pmc_card_slot_irq[pin - 1];
76 case 0x18: // PMC Slot Secondary Agent
77 break;
78 case 0x20: // IXP Processor
79 break;
80 default:
81 return NO_IRQ;
83 break;
85 case 1:
86 switch(dev->devfn) {
87 case 0x0: // IDE Controller
88 return (pin == 1) ? INTC : -1;
89 case 0x8: // USB fun 0
90 case 0x9: // USB fun 1
91 case 0xa: // USB fun 2
92 return usb_irq[pin - 1];
93 case 0x10: // Mini PCI 1
94 return mini_pci_1_irq[pin-1];
95 case 0x18: // Mini PCI 2
96 return mini_pci_2_irq[pin-1];
97 case 0x20: // MEM slot
98 return (pin == 1) ? INTA : -1;
99 default:
100 return NO_IRQ;
102 break;
104 default:
105 return NO_IRQ;
108 return NO_IRQ;
111 static void __init roadrunner_pci_preinit(void)
113 set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
114 set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
116 ixp23xx_pci_preinit();
119 static struct hw_pci roadrunner_pci __initdata = {
120 .nr_controllers = 1,
121 .preinit = roadrunner_pci_preinit,
122 .setup = ixp23xx_pci_setup,
123 .scan = ixp23xx_pci_scan_bus,
124 .map_irq = roadrunner_map_irq,
127 static int __init roadrunner_pci_init(void)
129 if (machine_is_roadrunner())
130 pci_common_init(&roadrunner_pci);
132 return 0;
135 subsys_initcall(roadrunner_pci_init);
137 static struct physmap_flash_data roadrunner_flash_data = {
138 .width = 2,
141 static struct resource roadrunner_flash_resource = {
142 .start = 0x90000000,
143 .end = 0x93ffffff,
144 .flags = IORESOURCE_MEM,
147 static struct platform_device roadrunner_flash = {
148 .name = "physmap-flash",
149 .id = 0,
150 .dev = {
151 .platform_data = &roadrunner_flash_data,
153 .num_resources = 1,
154 .resource = &roadrunner_flash_resource,
157 static void __init roadrunner_init(void)
159 platform_device_register(&roadrunner_flash);
162 * Mark flash as writeable
164 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
165 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
166 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
167 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
169 ixp23xx_sys_init();
172 MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
173 /* Maintainer: Deepak Saxena */
174 .phys_io = IXP23XX_PERIPHERAL_PHYS,
175 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
176 .map_io = ixp23xx_map_io,
177 .init_irq = ixp23xx_init_irq,
178 .timer = &ixp23xx_timer,
179 .boot_params = 0x00000100,
180 .init_machine = roadrunner_init,
181 MACHINE_END