diff options
Diffstat (limited to 'arch/powerpc/sysdev/tsi108_pci.c')
-rw-r--r-- | arch/powerpc/sysdev/tsi108_pci.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c index 322f86e93de5..ae249c6bbbcf 100644 --- a/arch/powerpc/sysdev/tsi108_pci.c +++ b/arch/powerpc/sysdev/tsi108_pci.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * | 3 | * |
4 | * 2004-2005 (c) Tundra Semiconductor Corp. | 4 | * 2004-2005 (c) Tundra Semiconductor Corp. |
5 | * Author: Alex Bounine (alexandreb@tundra.com) | 5 | * Author: Alex Bounine (alexandreb@tundra.com) |
6 | * Author: Roy Zang (tie-fei.zang@freescale.com) | ||
7 | * Add pci interrupt router host | ||
6 | * | 8 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the Free | 10 | * under the terms of the GNU General Public License as published by the Free |
@@ -48,6 +50,8 @@ | |||
48 | 50 | ||
49 | u32 tsi108_pci_cfg_base; | 51 | u32 tsi108_pci_cfg_base; |
50 | u32 tsi108_csr_vir_base; | 52 | u32 tsi108_csr_vir_base; |
53 | static struct device_node *pci_irq_node; | ||
54 | static struct irq_host *pci_irq_host; | ||
51 | 55 | ||
52 | extern u32 get_vir_csrbase(void); | 56 | extern u32 get_vir_csrbase(void); |
53 | extern u32 tsi108_read_reg(u32 reg_offset); | 57 | extern u32 tsi108_read_reg(u32 reg_offset); |
@@ -378,6 +382,38 @@ static struct irq_chip tsi108_pci_irq = { | |||
378 | .unmask = tsi108_pci_irq_enable, | 382 | .unmask = tsi108_pci_irq_enable, |
379 | }; | 383 | }; |
380 | 384 | ||
385 | static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct, | ||
386 | u32 *intspec, unsigned int intsize, | ||
387 | irq_hw_number_t *out_hwirq, unsigned int *out_flags) | ||
388 | { | ||
389 | *out_hwirq = intspec[0]; | ||
390 | *out_flags = IRQ_TYPE_LEVEL_HIGH; | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static int pci_irq_host_map(struct irq_host *h, unsigned int virq, | ||
395 | irq_hw_number_t hw) | ||
396 | { unsigned int irq; | ||
397 | DBG("%s(%d, 0x%lx)\n", __FUNCTION__, virq, hw); | ||
398 | if ((virq >= 1) && (virq <= 4)){ | ||
399 | irq = virq + IRQ_PCI_INTAD_BASE - 1; | ||
400 | get_irq_desc(irq)->status |= IRQ_LEVEL; | ||
401 | set_irq_chip(irq, &tsi108_pci_irq); | ||
402 | } | ||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int pci_irq_host_match(struct irq_host *h, struct device_node *node) | ||
407 | { | ||
408 | return pci_irq_node == node; | ||
409 | } | ||
410 | |||
411 | static struct irq_host_ops pci_irq_host_ops = { | ||
412 | .match = pci_irq_host_match, | ||
413 | .map = pci_irq_host_map, | ||
414 | .xlate = pci_irq_host_xlate, | ||
415 | }; | ||
416 | |||
381 | /* | 417 | /* |
382 | * Exported functions | 418 | * Exported functions |
383 | */ | 419 | */ |
@@ -391,15 +427,15 @@ static struct irq_chip tsi108_pci_irq = { | |||
391 | * to the MPIC. | 427 | * to the MPIC. |
392 | */ | 428 | */ |
393 | 429 | ||
394 | void __init tsi108_pci_int_init(void) | 430 | void __init tsi108_pci_int_init(struct device_node *node) |
395 | { | 431 | { |
396 | u_int i; | ||
397 | |||
398 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); | 432 | DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); |
399 | 433 | ||
400 | for (i = 0; i < NUM_PCI_IRQS; i++) { | 434 | pci_irq_node = of_node_get(node); |
401 | irq_desc[i + IRQ_PCI_INTAD_BASE].chip = &tsi108_pci_irq; | 435 | pci_irq_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &pci_irq_host_ops, 0); |
402 | irq_desc[i + IRQ_PCI_INTAD_BASE].status |= IRQ_LEVEL; | 436 | if (pci_irq_host == NULL) { |
437 | printk(KERN_ERR "pci_irq_host: failed to allocate irq host !\n"); | ||
438 | return; | ||
403 | } | 439 | } |
404 | 440 | ||
405 | init_pci_source(); | 441 | init_pci_source(); |