[PPPOL2TP]: Add CONFIG_INET Kconfig dependency.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-ixp23xx / roadrunner.c
blobe35644961aa442d9766a168088bee79713bd3151
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.h>
27 #include <linux/serial_8250.h>
28 #include <linux/serial_core.h>
29 #include <linux/device.h>
30 #include <linux/mm.h>
31 #include <linux/pci.h>
32 #include <linux/mtd/physmap.h>
34 #include <asm/types.h>
35 #include <asm/setup.h>
36 #include <asm/memory.h>
37 #include <asm/hardware.h>
38 #include <asm/mach-types.h>
39 #include <asm/irq.h>
40 #include <asm/system.h>
41 #include <asm/tlbflush.h>
42 #include <asm/pgtable.h>
44 #include <asm/mach/map.h>
45 #include <asm/mach/irq.h>
46 #include <asm/mach/arch.h>
47 #include <asm/mach/irq.h>
48 #include <asm/mach/pci.h>
51 * Interrupt mapping
53 #define INTA IRQ_ROADRUNNER_PCI_INTA
54 #define INTB IRQ_ROADRUNNER_PCI_INTB
55 #define INTC IRQ_ROADRUNNER_PCI_INTC
56 #define INTD IRQ_ROADRUNNER_PCI_INTD
58 #define INTC_PIN IXP23XX_GPIO_PIN_11
59 #define INTD_PIN IXP23XX_GPIO_PIN_12
61 static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
63 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
64 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
65 static int usb_irq[] = {INTB, INTC, INTD, -1};
66 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
67 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
69 switch(dev->bus->number) {
70 case 0:
71 switch(dev->devfn) {
72 case 0x0: // PCI-PCI bridge
73 break;
74 case 0x8: // PCI Card Slot
75 return pci_card_slot_irq[pin - 1];
76 case 0x10: // PMC Slot
77 return pmc_card_slot_irq[pin - 1];
78 case 0x18: // PMC Slot Secondary Agent
79 break;
80 case 0x20: // IXP Processor
81 break;
82 default:
83 return NO_IRQ;
85 break;
87 case 1:
88 switch(dev->devfn) {
89 case 0x0: // IDE Controller
90 return (pin == 1) ? INTC : -1;
91 case 0x8: // USB fun 0
92 case 0x9: // USB fun 1
93 case 0xa: // USB fun 2
94 return usb_irq[pin - 1];
95 case 0x10: // Mini PCI 1
96 return mini_pci_1_irq[pin-1];
97 case 0x18: // Mini PCI 2
98 return mini_pci_2_irq[pin-1];
99 case 0x20: // MEM slot
100 return (pin == 1) ? INTA : -1;
101 default:
102 return NO_IRQ;
104 break;
106 default:
107 return NO_IRQ;
110 return NO_IRQ;
113 static void __init roadrunner_pci_preinit(void)
115 set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
116 set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
118 ixp23xx_pci_preinit();
121 static struct hw_pci roadrunner_pci __initdata = {
122 .nr_controllers = 1,
123 .preinit = roadrunner_pci_preinit,
124 .setup = ixp23xx_pci_setup,
125 .scan = ixp23xx_pci_scan_bus,
126 .map_irq = roadrunner_map_irq,
129 static int __init roadrunner_pci_init(void)
131 if (machine_is_roadrunner())
132 pci_common_init(&roadrunner_pci);
134 return 0;
137 subsys_initcall(roadrunner_pci_init);
139 static struct physmap_flash_data roadrunner_flash_data = {
140 .width = 2,
143 static struct resource roadrunner_flash_resource = {
144 .start = 0x90000000,
145 .end = 0x93ffffff,
146 .flags = IORESOURCE_MEM,
149 static struct platform_device roadrunner_flash = {
150 .name = "physmap-flash",
151 .id = 0,
152 .dev = {
153 .platform_data = &roadrunner_flash_data,
155 .num_resources = 1,
156 .resource = &roadrunner_flash_resource,
159 static void __init roadrunner_init(void)
161 platform_device_register(&roadrunner_flash);
164 * Mark flash as writeable
166 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
167 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
168 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
169 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
171 ixp23xx_sys_init();
174 MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
175 /* Maintainer: Deepak Saxena */
176 .phys_io = IXP23XX_PERIPHERAL_PHYS,
177 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
178 .map_io = ixp23xx_map_io,
179 .init_irq = ixp23xx_init_irq,
180 .timer = &ixp23xx_timer,
181 .boot_params = 0x00000100,
182 .init_machine = roadrunner_init,
183 MACHINE_END