• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/arch/arm/mach-ixp23xx/
1/*
2 * arch/arm/mach-ixp23xx/roadrunner.c
3 *
4 * RoadRunner board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
11 *
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.
15 */
16
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>
32
33#include <asm/types.h>
34#include <asm/setup.h>
35#include <asm/memory.h>
36#include <mach/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>
42
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45#include <asm/mach/arch.h>
46#include <asm/mach/pci.h>
47
48/*
49 * Interrupt mapping
50 */
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
55
56#define INTC_PIN	IXP23XX_GPIO_PIN_11
57#define INTD_PIN	IXP23XX_GPIO_PIN_12
58
59static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
60{
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};
66
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;
82			}
83			break;
84
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;
101			}
102			break;
103
104		default:
105			return NO_IRQ;
106	}
107
108	return NO_IRQ;
109}
110
111static void __init roadrunner_pci_preinit(void)
112{
113	set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
114	set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
115
116	ixp23xx_pci_preinit();
117}
118
119static 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,
125};
126
127static int __init roadrunner_pci_init(void)
128{
129	if (machine_is_roadrunner())
130		pci_common_init(&roadrunner_pci);
131
132	return 0;
133};
134
135subsys_initcall(roadrunner_pci_init);
136
137static struct physmap_flash_data roadrunner_flash_data = {
138	.width		= 2,
139};
140
141static struct resource roadrunner_flash_resource = {
142	.start		= 0x90000000,
143	.end		= 0x93ffffff,
144	.flags		= IORESOURCE_MEM,
145};
146
147static struct platform_device roadrunner_flash = {
148	.name		= "physmap-flash",
149	.id		= 0,
150	.dev		= {
151		.platform_data	= &roadrunner_flash_data,
152	},
153	.num_resources	= 1,
154	.resource	= &roadrunner_flash_resource,
155};
156
157static void __init roadrunner_init(void)
158{
159	platform_device_register(&roadrunner_flash);
160
161	/*
162	 * Mark flash as writeable
163	 */
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;
168
169	ixp23xx_sys_init();
170}
171
172MACHINE_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,
181MACHINE_END
182