From: Harry Ciao <qingtao.cao@windriver.com>
To: norsk5@yahoo.com, bluesmoke-devel@lists.sourceforge.net,
linuxppc-dev@ozlabs.org
Cc: linux-kernel@vger.kernel.org
Subject: [v1 PATCH 3/3] EDAC: CPC925 MC platform device setup
Date: Fri, 3 Apr 2009 14:10:44 +0800 [thread overview]
Message-ID: <1238739044-19926-2-git-send-email-qingtao.cao@windriver.com> (raw)
In-Reply-To: <1238739044-19926-1-git-send-email-qingtao.cao@windriver.com>
Setup a platform device for the CPC925 Memory Controller during system
booting up, against which CPC925 MC EDAC driver would be matched.
Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
---
arch/powerpc/platforms/maple/setup.c | 47 ++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index bfd60e4..ca8a3ff 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -335,3 +335,50 @@ define_machine(maple) {
.progress = maple_progress,
.power_save = power4_idle,
};
+
+#ifdef CONFIG_EDAC
+#define CPC925_MC_START 0xf8000000
+#define CPC925_MC_END 0xf8ffffff /* sizeof 16MB */
+/* Register a platform device for CPC925 memory controller */
+static int __init maple_cpc925_edac_setup(void)
+{
+ struct platform_device *pdev;
+ struct device_node *np = NULL;
+ struct resource r;
+
+ np = of_find_node_by_name(NULL, "hostbridge");
+ if (!np) {
+ printk(KERN_ERR "%s: Unable to find hostbridge node\n",
+ __func__);
+ return -ENODEV;
+ }
+
+ if (of_address_to_resource(np, 0, &r)) {
+ /*
+ * of_address_to_resource() would get the #address-cells
+ * and #size-cells properties for a node from its parent.
+ * On Maple 64bit target hostbridge parent node has specified
+ * both of these two properties to be 2. However, the actual
+ * "cell" value for host bridge node is 1. Since we can't
+ * fix this firmware-generated DTB, we have to setup a
+ * resource structure manually.
+ */
+ memset(&r, 0, sizeof(r));
+ r.start = CPC925_MC_START;
+ r.end = CPC925_MC_END;
+ r.name = "hostbridge";
+ r.flags = IORESOURCE_MEM;
+ }
+
+ of_node_put(np);
+
+ pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1);
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ printk(KERN_INFO "%s: CPC925 platform device created\n", __func__);
+
+ return 0;
+}
+arch_initcall(maple_cpc925_edac_setup);
+#endif
--
1.5.6.2
next prev parent reply other threads:[~2009-04-03 6:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-03 6:10 Harry Ciao
2009-04-03 6:10 ` Harry Ciao [this message]
2009-04-03 6:51 ` Michael Ellerman
2009-04-03 10:06 ` Harry Ciao
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=1238739044-19926-2-git-send-email-qingtao.cao@windriver.com \
--to=qingtao.cao@windriver.com \
--cc=bluesmoke-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®