From: Dave Jiang <djiang@mvista.com>
To: galak@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, bluesmoke-devel@lists.sourceforge.net,
norsk5@yahoo.com
Subject: [PATCH v3 2/3] powerpc: create pci err platform device for EDAC on mpc85xx
Date: Thu, 2 Aug 2007 11:04:57 -0700 [thread overview]
Message-ID: <20070802180457.GA29926@blade.az.mvista.com> (raw)
In-Reply-To: <20070731220749.GB29780@blade.az.mvista.com>
Creating a platform device for the PCI error registers in order for the
mpc85xx EDAC driver to pick up proper resources. This is to prevent the EDAC
driver from monopolizing the of_device and thus preventing future PCI code from
using the PCI of_device(s).
Signed-off-by: Dave Jiang <djiang@mvista.com>
---
Code reworked to setup the platform device as a child of the PCI of_device.
The routine has to be called after device_initcall() due to having to wait
for the of_device to be setup first in order to pick up the parent.
arch/powerpc/sysdev/fsl_pci.c | 52 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 9fb0ce5..a769bbb 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -19,6 +19,8 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/bootmem.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/prom.h>
@@ -27,6 +29,56 @@
#include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
+#ifdef CONFIG_85xx
+/* setting up 85xx PCI error platform device for EDAC consumption */
+static int __init mpc85xx_pcierr_setup(void)
+{
+ struct device_node *np = NULL;
+ struct of_device *of_dev;
+ struct platform_device *pdev;
+ struct resource res[2];
+ int id = 0;
+ int err;
+
+ for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") {
+ memset(res, 0, sizeof(struct resource) * 2);
+ if (of_address_to_resource(np, 0, &res[0])) {
+ printk(KERN_WARNING "Can't get pci register base!\n");
+ continue;
+ }
+
+ /* move start to where the error registers are */
+ res[0].start += 0xe00;
+
+ of_irq_to_resource(np, 0, &res[1]);
+
+ of_dev = of_find_device_by_node(np);
+ if (!of_dev)
+ return -ENODEV;
+
+ pdev = platform_device_alloc("mpc85xx_pci_err", id++);
+ if (!pdev)
+ return -ENOMEM;
+
+ err = platform_device_add_resources(pdev, res, 2);
+ if (err)
+ goto error;
+
+ pdev->dev.parent = &of_dev->dev;
+
+ err = platform_device_add(pdev);
+ if (err)
+ goto error;
+ }
+ return 0;
+
+error:
+ platform_device_put(pdev);
+ return err;
+}
+late_initcall(mpc85xx_pcierr_setup);
+#endif
+
/* atmu setup for fsl pci/pcie controller */
void __init setup_pci_atmu(struct pci_controller *hose, struct resource *rsrc)
{
next prev parent reply other threads:[~2007-08-02 18:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 22:20 [PATCH 1/2] powerpc: publish 85xx soc dts entries as of_device on cds and ads platforms Dave Jiang
2007-07-31 22:05 ` [PATCH v2 1/3] " Dave Jiang
2007-07-31 22:07 ` [PATCH v2 2/3] powerpc: create pci err platform device for EDAC on mpc85xx Dave Jiang
2007-08-02 18:04 ` Dave Jiang [this message]
2007-07-31 22:10 ` [PATCH v2 3/3] powerpc: MPC85xx EDAC device driver Dave Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070802180457.GA29926@blade.az.mvista.com \
--to=djiang@mvista.com \
--cc=bluesmoke-devel@lists.sourceforge.net \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=norsk5@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox