[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1238652440-9224-6-git-send-email-qingtao.cao@windriver.com>
Date: Thu, 2 Apr 2009 14:07:20 +0800
From: Harry Ciao <qingtao.cao@...driver.com>
To: norsk5@...oo.com
Cc: linux-kernel@...r.kernel.org, bluesmoke-devel@...ts.sourceforge.net
Subject: [v0 PATCH 5/5] EDAC: CPC925 MC platform device setup
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@...driver.com>
---
arch/powerpc/platforms/maple/setup.c | 47 +++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
--- 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists