diff options
Diffstat (limited to 'arch/ppc/platforms/85xx')
-rw-r--r-- | arch/ppc/platforms/85xx/mpc85xx_cds_common.c | 138 | ||||
-rw-r--r-- | arch/ppc/platforms/85xx/mpc85xx_cds_common.h | 3 |
2 files changed, 139 insertions, 2 deletions
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c index 11fb758d269f..c2a512735183 100644 --- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c +++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/machdep.h> | 44 | #include <asm/machdep.h> |
45 | #include <asm/prom.h> | 45 | #include <asm/prom.h> |
46 | #include <asm/open_pic.h> | 46 | #include <asm/open_pic.h> |
47 | #include <asm/i8259.h> | ||
47 | #include <asm/bootinfo.h> | 48 | #include <asm/bootinfo.h> |
48 | #include <asm/pci-bridge.h> | 49 | #include <asm/pci-bridge.h> |
49 | #include <asm/mpc85xx.h> | 50 | #include <asm/mpc85xx.h> |
@@ -181,6 +182,7 @@ void __init | |||
181 | mpc85xx_cds_init_IRQ(void) | 182 | mpc85xx_cds_init_IRQ(void) |
182 | { | 183 | { |
183 | bd_t *binfo = (bd_t *) __res; | 184 | bd_t *binfo = (bd_t *) __res; |
185 | int i; | ||
184 | 186 | ||
185 | /* Determine the Physical Address of the OpenPIC regs */ | 187 | /* Determine the Physical Address of the OpenPIC regs */ |
186 | phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET; | 188 | phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET; |
@@ -198,6 +200,13 @@ mpc85xx_cds_init_IRQ(void) | |||
198 | */ | 200 | */ |
199 | openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET); | 201 | openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET); |
200 | 202 | ||
203 | openpic_hookup_cascade(PIRQ0A, "82c59 cascade", i8259_irq); | ||
204 | |||
205 | for (i = 0; i < NUM_8259_INTERRUPTS; i++) | ||
206 | irq_desc[i].handler = &i8259_pic; | ||
207 | |||
208 | i8259_init(0); | ||
209 | |||
201 | #ifdef CONFIG_CPM2 | 210 | #ifdef CONFIG_CPM2 |
202 | /* Setup CPM2 PIC */ | 211 | /* Setup CPM2 PIC */ |
203 | cpm2_init_IRQ(); | 212 | cpm2_init_IRQ(); |
@@ -231,7 +240,7 @@ mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) | |||
231 | * interrupt on slot */ | 240 | * interrupt on slot */ |
232 | { | 241 | { |
233 | { 0, 1, 2, 3 }, /* 16 - PMC */ | 242 | { 0, 1, 2, 3 }, /* 16 - PMC */ |
234 | { 3, 0, 0, 0 }, /* 17 P2P (Tsi320) */ | 243 | { 0, 1, 2, 3 }, /* 17 P2P (Tsi320) */ |
235 | { 0, 1, 2, 3 }, /* 18 - Slot 1 */ | 244 | { 0, 1, 2, 3 }, /* 18 - Slot 1 */ |
236 | { 1, 2, 3, 0 }, /* 19 - Slot 2 */ | 245 | { 1, 2, 3, 0 }, /* 19 - Slot 2 */ |
237 | { 2, 3, 0, 1 }, /* 20 - Slot 3 */ | 246 | { 2, 3, 0, 1 }, /* 20 - Slot 3 */ |
@@ -280,13 +289,135 @@ mpc85xx_exclude_device(u_char bus, u_char devfn) | |||
280 | return PCIBIOS_DEVICE_NOT_FOUND; | 289 | return PCIBIOS_DEVICE_NOT_FOUND; |
281 | #endif | 290 | #endif |
282 | /* We explicitly do not go past the Tundra 320 Bridge */ | 291 | /* We explicitly do not go past the Tundra 320 Bridge */ |
283 | if (bus == 1) | 292 | if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) |
284 | return PCIBIOS_DEVICE_NOT_FOUND; | 293 | return PCIBIOS_DEVICE_NOT_FOUND; |
285 | if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) | 294 | if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) |
286 | return PCIBIOS_DEVICE_NOT_FOUND; | 295 | return PCIBIOS_DEVICE_NOT_FOUND; |
287 | else | 296 | else |
288 | return PCIBIOS_SUCCESSFUL; | 297 | return PCIBIOS_SUCCESSFUL; |
289 | } | 298 | } |
299 | |||
300 | void __init | ||
301 | mpc85xx_cds_enable_via(struct pci_controller *hose) | ||
302 | { | ||
303 | u32 pci_class; | ||
304 | u16 vid, did; | ||
305 | |||
306 | early_read_config_dword(hose, 0, 0x88, PCI_CLASS_REVISION, &pci_class); | ||
307 | if ((pci_class >> 16) != PCI_CLASS_BRIDGE_PCI) | ||
308 | return; | ||
309 | |||
310 | /* Configure P2P so that we can reach bus 1 */ | ||
311 | early_write_config_byte(hose, 0, 0x88, PCI_PRIMARY_BUS, 0); | ||
312 | early_write_config_byte(hose, 0, 0x88, PCI_SECONDARY_BUS, 1); | ||
313 | early_write_config_byte(hose, 0, 0x88, PCI_SUBORDINATE_BUS, 0xff); | ||
314 | |||
315 | early_read_config_word(hose, 1, 0x10, PCI_VENDOR_ID, &vid); | ||
316 | early_read_config_word(hose, 1, 0x10, PCI_DEVICE_ID, &did); | ||
317 | |||
318 | if ((vid != PCI_VENDOR_ID_VIA) || | ||
319 | (did != PCI_DEVICE_ID_VIA_82C686)) | ||
320 | return; | ||
321 | |||
322 | /* Enable USB and IDE functions */ | ||
323 | early_write_config_byte(hose, 1, 0x10, 0x48, 0x08); | ||
324 | } | ||
325 | |||
326 | void __init | ||
327 | mpc85xx_cds_fixup_via(struct pci_controller *hose) | ||
328 | { | ||
329 | u32 pci_class; | ||
330 | u16 vid, did; | ||
331 | |||
332 | early_read_config_dword(hose, 0, 0x88, PCI_CLASS_REVISION, &pci_class); | ||
333 | if ((pci_class >> 16) != PCI_CLASS_BRIDGE_PCI) | ||
334 | return; | ||
335 | |||
336 | /* | ||
337 | * Force the backplane P2P bridge to have a window | ||
338 | * open from 0x00000000-0x00001fff in PCI I/O space. | ||
339 | * This allows legacy I/O (i8259, etc) on the VIA | ||
340 | * southbridge to be accessed. | ||
341 | */ | ||
342 | early_write_config_byte(hose, 0, 0x88, PCI_IO_BASE, 0x00); | ||
343 | early_write_config_word(hose, 0, 0x88, PCI_IO_BASE_UPPER16, 0x0000); | ||
344 | early_write_config_byte(hose, 0, 0x88, PCI_IO_LIMIT, 0x10); | ||
345 | early_write_config_word(hose, 0, 0x88, PCI_IO_LIMIT_UPPER16, 0x0000); | ||
346 | |||
347 | early_read_config_word(hose, 1, 0x10, PCI_VENDOR_ID, &vid); | ||
348 | early_read_config_word(hose, 1, 0x10, PCI_DEVICE_ID, &did); | ||
349 | if ((vid != PCI_VENDOR_ID_VIA) || | ||
350 | (did != PCI_DEVICE_ID_VIA_82C686)) | ||
351 | return; | ||
352 | |||
353 | /* | ||
354 | * Since the P2P window was forced to cover the fixed | ||
355 | * legacy I/O addresses, it is necessary to manually | ||
356 | * place the base addresses for the IDE and USB functions | ||
357 | * within this window. | ||
358 | */ | ||
359 | /* Function 1, IDE */ | ||
360 | early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_0, 0x1ff8); | ||
361 | early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_1, 0x1ff4); | ||
362 | early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_2, 0x1fe8); | ||
363 | early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_3, 0x1fe4); | ||
364 | early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_4, 0x1fd0); | ||
365 | |||
366 | /* Function 2, USB ports 0-1 */ | ||
367 | early_write_config_dword(hose, 1, 0x12, PCI_BASE_ADDRESS_4, 0x1fa0); | ||
368 | |||
369 | /* Function 3, USB ports 2-3 */ | ||
370 | early_write_config_dword(hose, 1, 0x13, PCI_BASE_ADDRESS_4, 0x1f80); | ||
371 | |||
372 | /* Function 5, Power Management */ | ||
373 | early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_0, 0x1e00); | ||
374 | early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_1, 0x1dfc); | ||
375 | early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_2, 0x1df8); | ||
376 | |||
377 | /* Function 6, AC97 Interface */ | ||
378 | early_write_config_dword(hose, 1, 0x16, PCI_BASE_ADDRESS_0, 0x1c00); | ||
379 | } | ||
380 | |||
381 | void __init | ||
382 | mpc85xx_cds_pcibios_fixup(void) | ||
383 | { | ||
384 | struct pci_dev *dev = NULL; | ||
385 | u_char c; | ||
386 | |||
387 | if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, | ||
388 | PCI_DEVICE_ID_VIA_82C586_1, NULL))) { | ||
389 | /* | ||
390 | * U-Boot does not set the enable bits | ||
391 | * for the IDE device. Force them on here. | ||
392 | */ | ||
393 | pci_read_config_byte(dev, 0x40, &c); | ||
394 | c |= 0x03; /* IDE: Chip Enable Bits */ | ||
395 | pci_write_config_byte(dev, 0x40, c); | ||
396 | |||
397 | /* | ||
398 | * Since only primary interface works, force the | ||
399 | * IDE function to standard primary IDE interrupt | ||
400 | * w/ 8259 offset | ||
401 | */ | ||
402 | dev->irq = 14; | ||
403 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * Force legacy USB interrupt routing | ||
408 | */ | ||
409 | if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, | ||
410 | PCI_DEVICE_ID_VIA_82C586_2, NULL))) { | ||
411 | dev->irq = 10; | ||
412 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10); | ||
413 | } | ||
414 | |||
415 | if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, | ||
416 | PCI_DEVICE_ID_VIA_82C586_2, dev))) { | ||
417 | dev->irq = 11; | ||
418 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11); | ||
419 | } | ||
420 | } | ||
290 | #endif /* CONFIG_PCI */ | 421 | #endif /* CONFIG_PCI */ |
291 | 422 | ||
292 | TODC_ALLOC(); | 423 | TODC_ALLOC(); |
@@ -308,6 +439,9 @@ mpc85xx_cds_setup_arch(void) | |||
308 | 439 | ||
309 | printk("mpc85xx_cds_setup_arch\n"); | 440 | printk("mpc85xx_cds_setup_arch\n"); |
310 | 441 | ||
442 | /* VIA IDE configuration */ | ||
443 | ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup; | ||
444 | |||
311 | #ifdef CONFIG_CPM2 | 445 | #ifdef CONFIG_CPM2 |
312 | cpm2_reset(); | 446 | cpm2_reset(); |
313 | #endif | 447 | #endif |
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h index 7627d77504bd..12b292c6ae32 100644 --- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h +++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h | |||
@@ -77,4 +77,7 @@ | |||
77 | 77 | ||
78 | #define MPC85XX_PCI2_IO_SIZE 0x01000000 | 78 | #define MPC85XX_PCI2_IO_SIZE 0x01000000 |
79 | 79 | ||
80 | #define NR_8259_INTS 16 | ||
81 | #define CPM_IRQ_OFFSET NR_8259_INTS | ||
82 | |||
80 | #endif /* __MACH_MPC85XX_CDS_H__ */ | 83 | #endif /* __MACH_MPC85XX_CDS_H__ */ |