aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powermac/pci.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-07-10 07:44:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:20 -0400
commit6e99e4582861578fb00d84d085f8f283569f51dd (patch)
tree8890d540932f02fa47e49248adcc918b42c335b8 /arch/powerpc/platforms/powermac/pci.c
parent50099328e4fe7c9f8981f408071a1ff82d59ddf8 (diff)
[PATCH] powerpc: fix trigger handling in the new irq code
This patch slightly reworks the new irq code to fix a small design error. I removed the passing of the trigger to the map() calls entirely, it was not a good idea to have one call do two different things. It also fixes a couple of corner cases. Mapping a linux virtual irq to a physical irq now does only that. Setting the trigger is a different action which has a different call. The main changes are: - I no longer call host->ops->map() for an already mapped irq, I just return the virtual number that was already mapped. It was called before to give an opportunity to change the trigger, but that was causing issues as that could happen while the interrupt was in use by a device, and because of the trigger change, map would potentially muck around with things in a racy way. That was causing much burden on a given's controller implementation of map() to get it right. This is much simpler now. map() is only called on the initial mapping of an irq, meaning that you know that this irq is _not_ being used. You can initialize the hardware if you want (though you don't have to). - Controllers that can handle different type of triggers (level/edge/etc...) now implement the standard irq_chip->set_type() call as defined by the generic code. That means that you can use the standard set_irq_type() to configure an irq line manually if you wish or (though I don't like that interface), pass explicit trigger flags to request_irq() as defined by the generic kernel interfaces. Also, using those interfaces guarantees that your controller set_type callback is called with the descriptor lock held, thus providing locking against activity on the same interrupt (including mask/unmask/etc...) automatically. A result is that, for example, MPIC's own map() implementation calls irq_set_type(NONE) to configure the hardware to the default triggers. - To allow the above, the irq_map array entry for the new mapped interrupt is now set before map() callback is called for the controller. - The irq_create_of_mapping() (also used by irq_of_parse_and_map()) function for mapping interrupts from the device-tree now also call the separate set_irq_type(), and only does so if there is a change in the trigger type. - While I was at it, I changed pci_read_irq_line() (which is the helper I would expect most archs to use in their pcibios_fixup() to get the PCI interrupt routing from the device tree) to also handle a fallback when the DT mapping fails consisting of reading the PCI_INTERRUPT_PIN to know wether the device has an interrupt at all, and the the PCI_INTERRUPT_LINE to get an interrupt number from the device. That number is then mapped using the default controller, and the trigger is set to level low. That default behaviour works for several platforms that don't have a proper interrupt tree like Pegasos. If it doesn't work for your platform, then either provide a proper interrupt tree from the firmware so that fallback isn't needed, or don't call pci_read_irq_line() - Add back a bit that got dropped by my main rework patch for properly clearing pending IPIs on pSeries when using a kexec Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/powerpc/platforms/powermac/pci.c')
-rw-r--r--arch/powerpc/platforms/powermac/pci.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 556b349797e..205d0447116 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h> 18#include <linux/bootmem.h>
19#include <linux/irq.h>
19 20
20#include <asm/sections.h> 21#include <asm/sections.h>
21#include <asm/io.h> 22#include <asm/io.h>
@@ -24,10 +25,7 @@
24#include <asm/machdep.h> 25#include <asm/machdep.h>
25#include <asm/pmac_feature.h> 26#include <asm/pmac_feature.h>
26#include <asm/grackle.h> 27#include <asm/grackle.h>
27#ifdef CONFIG_PPC64
28//#include <asm/iommu.h>
29#include <asm/ppc-pci.h> 28#include <asm/ppc-pci.h>
30#endif
31 29
32#undef DEBUG 30#undef DEBUG
33 31
@@ -46,7 +44,6 @@ static int has_uninorth;
46static struct pci_controller *u3_agp; 44static struct pci_controller *u3_agp;
47static struct pci_controller *u4_pcie; 45static struct pci_controller *u4_pcie;
48static struct pci_controller *u3_ht; 46static struct pci_controller *u3_ht;
49#define has_second_ohare 0
50#else 47#else
51static int has_second_ohare; 48static int has_second_ohare;
52#endif /* CONFIG_PPC64 */ 49#endif /* CONFIG_PPC64 */
@@ -993,6 +990,7 @@ void __init pmac_pcibios_fixup(void)
993 /* Read interrupt from the device-tree */ 990 /* Read interrupt from the device-tree */
994 pci_read_irq_line(dev); 991 pci_read_irq_line(dev);
995 992
993#ifdef CONFIG_PPC32
996 /* Fixup interrupt for the modem/ethernet combo controller. 994 /* Fixup interrupt for the modem/ethernet combo controller.
997 * on machines with a second ohare chip. 995 * on machines with a second ohare chip.
998 * The number in the device tree (27) is bogus (correct for 996 * The number in the device tree (27) is bogus (correct for
@@ -1002,8 +1000,11 @@ void __init pmac_pcibios_fixup(void)
1002 */ 1000 */
1003 if (has_second_ohare && 1001 if (has_second_ohare &&
1004 dev->vendor == PCI_VENDOR_ID_DEC && 1002 dev->vendor == PCI_VENDOR_ID_DEC &&
1005 dev->device == PCI_DEVICE_ID_DEC_TULIP_PLUS) 1003 dev->device == PCI_DEVICE_ID_DEC_TULIP_PLUS) {
1006 dev->irq = irq_create_mapping(NULL, 60, 0); 1004 dev->irq = irq_create_mapping(NULL, 60);
1005 set_irq_type(dev->irq, IRQ_TYPE_LEVEL_LOW);
1006 }
1007#endif /* CONFIG_PPC32 */
1007 } 1008 }
1008} 1009}
1009 1010