From 1e1b20a119ac45a290bbc6261f69a2a6a2cc064a Mon Sep 17 00:00:00 2001
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Mon, 9 Oct 2006 13:27:28 +1000
Subject: [POWERPC] Fix Maple secondary IDE interrupt

The IDE driver will pick up the PCI IRQ for both channels on Maple
despite the fact that it's in legacy mode. This works around it by
"hiding" the PCI IRQ of the AMD8111 IDE controller when it's configured
in legacy mode on the Maple platform, thus causing the driver to call
pci_get_legacy_ide_irq() which will return the correct interrupts for
both channels.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/platforms/maple/pci.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 8debae3..63b4d1b 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -516,8 +516,21 @@ void __init maple_pcibios_fixup(void)
 			dev->irq = irq_create_mapping(NULL, 1);
 			if (dev->irq != NO_IRQ)
 				set_irq_type(dev->irq, IRQ_TYPE_LEVEL_LOW);
-		} else
-			pci_read_irq_line(dev);
+			continue;
+		}
+
+		/* Hide AMD8111 IDE interrupt when in legacy mode so
+		 * the driver calls pci_get_legacy_ide_irq()
+		 */
+		if (dev->vendor == PCI_VENDOR_ID_AMD &&
+		    dev->device == PCI_DEVICE_ID_AMD_8111_IDE &&
+		    (dev->class & 5) != 5) {
+			dev->irq = NO_IRQ;
+			continue;
+		}
+
+		/* For all others, map the interrupt from the device-tree */
+		pci_read_irq_line(dev);
 	}
 
 	DBG(" <- maple_pcibios_fixup\n");
-- 
cgit v1.1