diff options
Diffstat (limited to 'arch/mips/alchemy/devboards/db1x00/platform.c')
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/platform.c | 198 |
1 files changed, 174 insertions, 24 deletions
diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c index 7057d28f730..9e6b3d442ac 100644 --- a/arch/mips/alchemy/devboards/db1x00/platform.c +++ b/arch/mips/alchemy/devboards/db1x00/platform.c | |||
@@ -20,14 +20,16 @@ | |||
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/dma-mapping.h> | ||
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
24 | 25 | ||
25 | #include <asm/mach-au1x00/au1000.h> | 26 | #include <asm/mach-au1x00/au1000.h> |
26 | #include <asm/mach-au1x00/au1000_dma.h> | 27 | #include <asm/mach-au1x00/au1000_dma.h> |
27 | #include <asm/mach-au1x00/au1xxx.h> | ||
28 | #include <asm/mach-db1x00/bcsr.h> | 28 | #include <asm/mach-db1x00/bcsr.h> |
29 | #include "../platform.h" | 29 | #include "../platform.h" |
30 | 30 | ||
31 | struct pci_dev; | ||
32 | |||
31 | /* DB1xxx PCMCIA interrupt sources: | 33 | /* DB1xxx PCMCIA interrupt sources: |
32 | * CD0/1 GPIO0/3 | 34 | * CD0/1 GPIO0/3 |
33 | * STSCHG0/1 GPIO1/4 | 35 | * STSCHG0/1 GPIO1/4 |
@@ -88,6 +90,155 @@ | |||
88 | #endif | 90 | #endif |
89 | #endif | 91 | #endif |
90 | 92 | ||
93 | #ifdef CONFIG_PCI | ||
94 | #ifdef CONFIG_MIPS_DB1500 | ||
95 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
96 | { | ||
97 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
98 | return -1; | ||
99 | if (slot == 12) | ||
100 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
101 | if (slot == 13) { | ||
102 | switch (pin) { | ||
103 | case 1: return AU1500_PCI_INTA; | ||
104 | case 2: return AU1500_PCI_INTB; | ||
105 | case 3: return AU1500_PCI_INTC; | ||
106 | case 4: return AU1500_PCI_INTD; | ||
107 | } | ||
108 | } | ||
109 | return -1; | ||
110 | } | ||
111 | #endif | ||
112 | |||
113 | #ifdef CONFIG_MIPS_DB1550 | ||
114 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
115 | { | ||
116 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
117 | return -1; | ||
118 | if (slot == 11) | ||
119 | return (pin == 1) ? AU1550_PCI_INTC : 0xff; | ||
120 | if (slot == 12) { | ||
121 | switch (pin) { | ||
122 | case 1: return AU1550_PCI_INTB; | ||
123 | case 2: return AU1550_PCI_INTC; | ||
124 | case 3: return AU1550_PCI_INTD; | ||
125 | case 4: return AU1550_PCI_INTA; | ||
126 | } | ||
127 | } | ||
128 | if (slot == 13) { | ||
129 | switch (pin) { | ||
130 | case 1: return AU1550_PCI_INTA; | ||
131 | case 2: return AU1550_PCI_INTB; | ||
132 | case 3: return AU1550_PCI_INTC; | ||
133 | case 4: return AU1550_PCI_INTD; | ||
134 | } | ||
135 | } | ||
136 | return -1; | ||
137 | } | ||
138 | #endif | ||
139 | |||
140 | #ifdef CONFIG_MIPS_BOSPORUS | ||
141 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
142 | { | ||
143 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
144 | return -1; | ||
145 | if (slot == 12) | ||
146 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
147 | if (slot == 11) { | ||
148 | switch (pin) { | ||
149 | case 1: return AU1500_PCI_INTA; | ||
150 | case 2: return AU1500_PCI_INTB; | ||
151 | default: return 0xff; | ||
152 | } | ||
153 | } | ||
154 | if (slot == 13) { | ||
155 | switch (pin) { | ||
156 | case 1: return AU1500_PCI_INTA; | ||
157 | case 2: return AU1500_PCI_INTB; | ||
158 | case 3: return AU1500_PCI_INTC; | ||
159 | case 4: return AU1500_PCI_INTD; | ||
160 | } | ||
161 | } | ||
162 | return -1; | ||
163 | } | ||
164 | #endif | ||
165 | |||
166 | #ifdef CONFIG_MIPS_MIRAGE | ||
167 | static int db1xxx_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
168 | { | ||
169 | if ((slot < 11) || (slot > 13) || pin == 0) | ||
170 | return -1; | ||
171 | if (slot == 11) | ||
172 | return (pin == 1) ? AU1500_PCI_INTD : 0xff; | ||
173 | if (slot == 12) | ||
174 | return (pin == 3) ? AU1500_PCI_INTC : 0xff; | ||
175 | if (slot == 13) { | ||
176 | switch (pin) { | ||
177 | case 1: return AU1500_PCI_INTA; | ||
178 | case 2: return AU1500_PCI_INTB; | ||
179 | default: return 0xff; | ||
180 | } | ||
181 | } | ||
182 | return -1; | ||
183 | } | ||
184 | #endif | ||
185 | |||
186 | static struct resource alchemy_pci_host_res[] = { | ||
187 | [0] = { | ||
188 | .start = AU1500_PCI_PHYS_ADDR, | ||
189 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
190 | .flags = IORESOURCE_MEM, | ||
191 | }, | ||
192 | }; | ||
193 | |||
194 | static struct alchemy_pci_platdata db1xxx_pci_pd = { | ||
195 | .board_map_irq = db1xxx_map_pci_irq, | ||
196 | }; | ||
197 | |||
198 | static struct platform_device db1xxx_pci_host_dev = { | ||
199 | .dev.platform_data = &db1xxx_pci_pd, | ||
200 | .name = "alchemy-pci", | ||
201 | .id = 0, | ||
202 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
203 | .resource = alchemy_pci_host_res, | ||
204 | }; | ||
205 | |||
206 | static int __init db15x0_pci_init(void) | ||
207 | { | ||
208 | return platform_device_register(&db1xxx_pci_host_dev); | ||
209 | } | ||
210 | /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */ | ||
211 | arch_initcall(db15x0_pci_init); | ||
212 | #endif | ||
213 | |||
214 | #ifdef CONFIG_MIPS_DB1100 | ||
215 | static struct resource au1100_lcd_resources[] = { | ||
216 | [0] = { | ||
217 | .start = AU1100_LCD_PHYS_ADDR, | ||
218 | .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1, | ||
219 | .flags = IORESOURCE_MEM, | ||
220 | }, | ||
221 | [1] = { | ||
222 | .start = AU1100_LCD_INT, | ||
223 | .end = AU1100_LCD_INT, | ||
224 | .flags = IORESOURCE_IRQ, | ||
225 | } | ||
226 | }; | ||
227 | |||
228 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); | ||
229 | |||
230 | static struct platform_device au1100_lcd_device = { | ||
231 | .name = "au1100-lcd", | ||
232 | .id = 0, | ||
233 | .dev = { | ||
234 | .dma_mask = &au1100_lcd_dmamask, | ||
235 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
236 | }, | ||
237 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), | ||
238 | .resource = au1100_lcd_resources, | ||
239 | }; | ||
240 | #endif | ||
241 | |||
91 | static struct resource alchemy_ac97c_res[] = { | 242 | static struct resource alchemy_ac97c_res[] = { |
92 | [0] = { | 243 | [0] = { |
93 | .start = AU1000_AC97_PHYS_ADDR, | 244 | .start = AU1000_AC97_PHYS_ADDR, |
@@ -130,29 +281,28 @@ static struct platform_device db1x00_audio_dev = { | |||
130 | static int __init db1xxx_dev_init(void) | 281 | static int __init db1xxx_dev_init(void) |
131 | { | 282 | { |
132 | #ifdef DB1XXX_HAS_PCMCIA | 283 | #ifdef DB1XXX_HAS_PCMCIA |
133 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR, | 284 | db1x_register_pcmcia_socket( |
134 | PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | 285 | AU1000_PCMCIA_ATTR_PHYS_ADDR, |
135 | PCMCIA_MEM_PHYS_ADDR, | 286 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, |
136 | PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | 287 | AU1000_PCMCIA_MEM_PHYS_ADDR, |
137 | PCMCIA_IO_PHYS_ADDR, | 288 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, |
138 | PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | 289 | AU1000_PCMCIA_IO_PHYS_ADDR, |
139 | DB1XXX_PCMCIA_CARD0, | 290 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, |
140 | DB1XXX_PCMCIA_CD0, | 291 | DB1XXX_PCMCIA_CARD0, DB1XXX_PCMCIA_CD0, |
141 | /*DB1XXX_PCMCIA_STSCHG0*/0, | 292 | /*DB1XXX_PCMCIA_STSCHG0*/0, 0, 0); |
142 | 0, | 293 | |
143 | 0); | 294 | db1x_register_pcmcia_socket( |
144 | 295 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | |
145 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | 296 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, |
146 | PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, | 297 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, |
147 | PCMCIA_MEM_PHYS_ADDR + 0x004000000, | 298 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, |
148 | PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | 299 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, |
149 | PCMCIA_IO_PHYS_ADDR + 0x004000000, | 300 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, |
150 | PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | 301 | DB1XXX_PCMCIA_CARD1, DB1XXX_PCMCIA_CD1, |
151 | DB1XXX_PCMCIA_CARD1, | 302 | /*DB1XXX_PCMCIA_STSCHG1*/0, 0, 1); |
152 | DB1XXX_PCMCIA_CD1, | 303 | #endif |
153 | /*DB1XXX_PCMCIA_STSCHG1*/0, | 304 | #ifdef CONFIG_MIPS_DB1100 |
154 | 0, | 305 | platform_device_register(&au1100_lcd_device); |
155 | 1); | ||
156 | #endif | 306 | #endif |
157 | db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED); | 307 | db1x_register_norflash(BOARD_FLASH_SIZE, BOARD_FLASH_WIDTH, F_SWAPPED); |
158 | 308 | ||