As a device for pci node isn't created, create a special platform_device
for PCI EDAC device on MPC85xx.

Signed-off-by: Dmitry Eremin-Solenikov <dbarysh...@gmail.com>
---
 arch/powerpc/sysdev/fsl_pci.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 68ca929..2498229 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -381,6 +381,34 @@ int __init fsl_add_bridge(struct device_node *dev, int 
is_primary)
        return 0;
 }
 
+static int __init fsl_add_pci_err(void)
+{
+       struct device_node *np;
+
+       /* Only PCI, not PCI Express! */
+       for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") {
+               struct resource r[2] = {};
+
+               if (of_address_to_resource(np, 0, &r[0])) {
+                       printk(KERN_WARNING
+                                       "Can't get register base for PCI 
EDAC!\n");
+                       continue;
+               }
+               r[0].start += 0xe00;
+
+               if (of_irq_to_resource(np, 0, &r[1]) == NO_IRQ) {
+                       printk(KERN_WARNING
+                                       "Can't get irq for PCI EDAC!\n");
+                       continue;
+               }
+               platform_device_register_simple("mpc85xx_pci_err", -1,
+                               r, ARRAY_SIZE(r));
+       }
+
+       return 0;
+}
+device_initcall(fsl_add_pci_err);
+
 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8548E, 
quirk_fsl_pcie_header);
 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8548, quirk_fsl_pcie_header);
 DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8543E, 
quirk_fsl_pcie_header);
-- 
1.7.4.4

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to