aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorHarry Ciao <qingtao.cao@windriver.com>2009-06-17 19:28:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:57 -0400
commit8f101a051ef054c33186abcd54b30a88afea47ef (patch)
treed1f977c58f86c0495ec578548fcdf45c2789e8c1 /arch/powerpc/platforms
parent1dc9b70d7d48abd8a5c6f83021f38992f3b5a77f (diff)
edac: cpc925 MC platform device setup
Fix up the number of cells for the values of CPC925 Memory Controller, and setup related platform device during system booting up, against which CPC925 Memory Controller EDAC driver would be matched. Signed-off-by: Harry Ciao <qingtao.cao@windriver.com> Cc: Doug Thompson <norsk5@yahoo.com> Cc: Michael Ellerman <michael@ellerman.id.au> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Kumar Gala <galak@gate.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/maple/setup.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index bfd60e4acce..0636a3df697 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -335,3 +335,62 @@ define_machine(maple) {
335 .progress = maple_progress, 335 .progress = maple_progress,
336 .power_save = power4_idle, 336 .power_save = power4_idle,
337}; 337};
338
339#ifdef CONFIG_EDAC
340/*
341 * Register a platform device for CPC925 memory controller on
342 * Motorola ATCA-6101 blade.
343 */
344#define MAPLE_CPC925_MODEL "Motorola,ATCA-6101"
345static int __init maple_cpc925_edac_setup(void)
346{
347 struct platform_device *pdev;
348 struct device_node *np = NULL;
349 struct resource r;
350 const unsigned char *model;
351 int ret;
352
353 np = of_find_node_by_path("/");
354 if (!np) {
355 printk(KERN_ERR "%s: Unable to get root node\n", __func__);
356 return -ENODEV;
357 }
358
359 model = (const unsigned char *)of_get_property(np, "model", NULL);
360 if (!model) {
361 printk(KERN_ERR "%s: Unabel to get model info\n", __func__);
362 return -ENODEV;
363 }
364
365 ret = strcmp(model, MAPLE_CPC925_MODEL);
366 of_node_put(np);
367
368 if (ret != 0)
369 return 0;
370
371 np = of_find_node_by_type(NULL, "memory-controller");
372 if (!np) {
373 printk(KERN_ERR "%s: Unable to find memory-controller node\n",
374 __func__);
375 return -ENODEV;
376 }
377
378 ret = of_address_to_resource(np, 0, &r);
379 of_node_put(np);
380
381 if (ret < 0) {
382 printk(KERN_ERR "%s: Unable to get memory-controller reg\n",
383 __func__);
384 return -ENODEV;
385 }
386
387 pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1);
388 if (IS_ERR(pdev))
389 return PTR_ERR(pdev);
390
391 printk(KERN_INFO "%s: CPC925 platform device created\n", __func__);
392
393 return 0;
394}
395machine_device_initcall(maple, maple_cpc925_edac_setup);
396#endif