Blame view

arch/arm/mach-ixp23xx/roadrunner.c 4.19 KB
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  /*
   * arch/arm/mach-ixp23xx/roadrunner.c
   *
   * RoadRunner board-specific routines
   *
   * Author: Deepak Saxena <dsaxena@plexity.net>
   *
   * Copyright 2005 (c) MontaVista Software, Inc.
   *
   * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
   *
   * This file is licensed under the terms of the GNU General Public
   * License version 2. This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
16
17
18
19
20
21
22
23
24
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/spinlock.h>
  #include <linux/sched.h>
  #include <linux/interrupt.h>
  #include <linux/serial.h>
  #include <linux/tty.h>
  #include <linux/bitops.h>
  #include <linux/ioport.h>
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
25
26
27
28
29
30
31
32
33
34
  #include <linux/serial_8250.h>
  #include <linux/serial_core.h>
  #include <linux/device.h>
  #include <linux/mm.h>
  #include <linux/pci.h>
  #include <linux/mtd/physmap.h>
  
  #include <asm/types.h>
  #include <asm/setup.h>
  #include <asm/memory.h>
a09e64fbc   Russell King   [ARM] Move includ...
35
  #include <mach/hardware.h>
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
36
37
38
39
40
41
42
43
44
  #include <asm/mach-types.h>
  #include <asm/irq.h>
  #include <asm/system.h>
  #include <asm/tlbflush.h>
  #include <asm/pgtable.h>
  
  #include <asm/mach/map.h>
  #include <asm/mach/irq.h>
  #include <asm/mach/arch.h>
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
45
46
47
48
49
50
51
52
53
54
55
56
  #include <asm/mach/pci.h>
  
  /*
   * Interrupt mapping
   */
  #define INTA		IRQ_ROADRUNNER_PCI_INTA
  #define INTB		IRQ_ROADRUNNER_PCI_INTB
  #define INTC		IRQ_ROADRUNNER_PCI_INTC
  #define INTD		IRQ_ROADRUNNER_PCI_INTD
  
  #define INTC_PIN	IXP23XX_GPIO_PIN_11
  #define INTD_PIN	IXP23XX_GPIO_PIN_12
d5341942d   Ralf Baechle   PCI: Make the str...
57
58
  static int __init roadrunner_map_irq(const struct pci_dev *dev, u8 idsel,
  	u8 pin)
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  {
  	static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
  	static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
  	static int usb_irq[] = {INTB, INTC, INTD, -1};
  	static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
  	static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
  
  	switch(dev->bus->number) {
  		case 0:
  			switch(dev->devfn) {
  			case 0x0: // PCI-PCI bridge
  				break;
  			case 0x8: // PCI Card Slot
  				return pci_card_slot_irq[pin - 1];
  			case 0x10: // PMC Slot
  				return pmc_card_slot_irq[pin - 1];
  			case 0x18: // PMC Slot Secondary Agent
  				break;
  			case 0x20: // IXP Processor
  				break;
  			default:
  				return NO_IRQ;
  			}
  			break;
  
  		case 1:
  			switch(dev->devfn) {
  			case 0x0: // IDE Controller
  				return (pin == 1) ? INTC : -1;
  			case 0x8: // USB fun 0
  			case 0x9: // USB fun 1
  			case 0xa: // USB fun 2
  				return usb_irq[pin - 1];
  			case 0x10: // Mini PCI 1
  				return mini_pci_1_irq[pin-1];
  			case 0x18: // Mini PCI 2
  				return mini_pci_2_irq[pin-1];
  			case 0x20: // MEM slot
  				return (pin == 1) ? INTA : -1;
  			default:
  				return NO_IRQ;
  			}
  			break;
  
  		default:
  			return NO_IRQ;
  	}
  
  	return NO_IRQ;
  }
cdea46064   Russell King   [ARM] Fix some se...
109
  static void __init roadrunner_pci_preinit(void)
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
110
  {
6845664a6   Thomas Gleixner   arm: Cleanup the ...
111
112
  	irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
  	irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  
  	ixp23xx_pci_preinit();
  }
  
  static struct hw_pci roadrunner_pci __initdata = {
  	.nr_controllers	= 1,
  	.preinit	= roadrunner_pci_preinit,
  	.setup		= ixp23xx_pci_setup,
  	.scan		= ixp23xx_pci_scan_bus,
  	.map_irq	= roadrunner_map_irq,
  };
  
  static int __init roadrunner_pci_init(void)
  {
  	if (machine_is_roadrunner())
  		pci_common_init(&roadrunner_pci);
  
  	return 0;
  };
  
  subsys_initcall(roadrunner_pci_init);
84b61f6d3   Lennert Buytenhek   [ARM] 3615/1: ixp...
134
135
136
137
138
139
  static struct physmap_flash_data roadrunner_flash_data = {
  	.width		= 2,
  };
  
  static struct resource roadrunner_flash_resource = {
  	.start		= 0x90000000,
562ca1e32   Lennert Buytenhek   [ARM] 3663/1: fix...
140
  	.end		= 0x93ffffff,
84b61f6d3   Lennert Buytenhek   [ARM] 3615/1: ixp...
141
142
143
144
145
146
147
148
149
150
151
152
  	.flags		= IORESOURCE_MEM,
  };
  
  static struct platform_device roadrunner_flash = {
  	.name		= "physmap-flash",
  	.id		= 0,
  	.dev		= {
  		.platform_data	= &roadrunner_flash_data,
  	},
  	.num_resources	= 1,
  	.resource	= &roadrunner_flash_resource,
  };
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
153
154
  static void __init roadrunner_init(void)
  {
84b61f6d3   Lennert Buytenhek   [ARM] 3615/1: ixp...
155
  	platform_device_register(&roadrunner_flash);
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
  
  	/*
  	 * Mark flash as writeable
  	 */
  	IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
  	IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
  	IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
  	IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
  
  	ixp23xx_sys_init();
  }
  
  MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
  	/* Maintainer: Deepak Saxena */
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
170
171
172
  	.map_io		= ixp23xx_map_io,
  	.init_irq	= ixp23xx_init_irq,
  	.timer		= &ixp23xx_timer,
36f7a1e7c   Nicolas Pitre   ARM: mach-ixp23xx...
173
  	.atag_offset	= 0x100,
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
174
  	.init_machine	= roadrunner_init,
b219415c3   Russell King   ARM: restart: ixp...
175
  	.restart	= ixp23xx_restart,
c47130743   Lennert Buytenhek   [ARM] 3388/1: ixp...
176
  MACHINE_END