diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-16 22:51:46 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-06-29 03:48:26 -0400 |
commit | 8a0360a563cffc9a0712426820bedbb96bbc511b (patch) | |
tree | 9520b866c3fec5988230ab431d439468884891c9 | |
parent | de2780a3d82372a6bfc7f474905e346c0f26dfa4 (diff) |
powerpc/maple: Register CPC925 EDAC device on all boards with CPC925
Currently Maple setup code creates cpc925_edac device only on
Motorola ATCA-6101 blade. Make setup code check bridge revision
and enable EDAC on all U3H bridges.
Verified on Momentum MapleD (ppc970fx kit) board.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/platforms/maple/setup.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index fe34c3d9bb74..5b3388b9f911 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
@@ -338,35 +338,16 @@ define_machine(maple) { | |||
338 | #ifdef CONFIG_EDAC | 338 | #ifdef CONFIG_EDAC |
339 | /* | 339 | /* |
340 | * Register a platform device for CPC925 memory controller on | 340 | * Register a platform device for CPC925 memory controller on |
341 | * Motorola ATCA-6101 blade. | 341 | * all boards with U3H (CPC925) bridge. |
342 | */ | 342 | */ |
343 | #define MAPLE_CPC925_MODEL "Motorola,ATCA-6101" | ||
344 | static int __init maple_cpc925_edac_setup(void) | 343 | static int __init maple_cpc925_edac_setup(void) |
345 | { | 344 | { |
346 | struct platform_device *pdev; | 345 | struct platform_device *pdev; |
347 | struct device_node *np = NULL; | 346 | struct device_node *np = NULL; |
348 | struct resource r; | 347 | struct resource r; |
349 | const unsigned char *model; | ||
350 | int ret; | 348 | int ret; |
351 | 349 | volatile void __iomem *mem; | |
352 | np = of_find_node_by_path("/"); | 350 | u32 rev; |
353 | if (!np) { | ||
354 | printk(KERN_ERR "%s: Unable to get root node\n", __func__); | ||
355 | return -ENODEV; | ||
356 | } | ||
357 | |||
358 | model = (const unsigned char *)of_get_property(np, "model", NULL); | ||
359 | if (!model) { | ||
360 | printk(KERN_ERR "%s: Unabel to get model info\n", __func__); | ||
361 | of_node_put(np); | ||
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 | 351 | ||
371 | np = of_find_node_by_type(NULL, "memory-controller"); | 352 | np = of_find_node_by_type(NULL, "memory-controller"); |
372 | if (!np) { | 353 | if (!np) { |
@@ -384,6 +365,22 @@ static int __init maple_cpc925_edac_setup(void) | |||
384 | return -ENODEV; | 365 | return -ENODEV; |
385 | } | 366 | } |
386 | 367 | ||
368 | mem = ioremap(r.start, resource_size(&r)); | ||
369 | if (!mem) { | ||
370 | printk(KERN_ERR "%s: Unable to map memory-controller memory\n", | ||
371 | __func__); | ||
372 | return -ENOMEM; | ||
373 | } | ||
374 | |||
375 | rev = __raw_readl(mem); | ||
376 | iounmap(mem); | ||
377 | |||
378 | if (rev < 0x34 || rev > 0x3f) { /* U3H */ | ||
379 | printk(KERN_ERR "%s: Non-CPC925(U3H) bridge revision: %02x\n", | ||
380 | __func__, rev); | ||
381 | return 0; | ||
382 | } | ||
383 | |||
387 | pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1); | 384 | pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1); |
388 | if (IS_ERR(pdev)) | 385 | if (IS_ERR(pdev)) |
389 | return PTR_ERR(pdev); | 386 | return PTR_ERR(pdev); |