aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/prom_init.c40
-rw-r--r--arch/powerpc/platforms/maple/setup.c59
2 files changed, 99 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ef6f64950e9b..a538824616fd 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1947,8 +1947,47 @@ static void __init fixup_device_tree_maple(void)
1947 prom_setprop(isa, name, "ranges", 1947 prom_setprop(isa, name, "ranges",
1948 isa_ranges, sizeof(isa_ranges)); 1948 isa_ranges, sizeof(isa_ranges));
1949} 1949}
1950
1951#define CPC925_MC_START 0xf8000000
1952#define CPC925_MC_LENGTH 0x1000000
1953/* The values for memory-controller don't have right number of cells */
1954static void __init fixup_device_tree_maple_memory_controller(void)
1955{
1956 phandle mc;
1957 u32 mc_reg[4];
1958 char *name = "/hostbridge@f8000000";
1959 struct prom_t *_prom = &RELOC(prom);
1960 u32 ac, sc;
1961
1962 mc = call_prom("finddevice", 1, 1, ADDR(name));
1963 if (!PHANDLE_VALID(mc))
1964 return;
1965
1966 if (prom_getproplen(mc, "reg") != 8)
1967 return;
1968
1969 prom_getprop(_prom->root, "#address-cells", &ac, sizeof(ac));
1970 prom_getprop(_prom->root, "#size-cells", &sc, sizeof(sc));
1971 if ((ac != 2) || (sc != 2))
1972 return;
1973
1974 if (prom_getprop(mc, "reg", mc_reg, sizeof(mc_reg)) == PROM_ERROR)
1975 return;
1976
1977 if (mc_reg[0] != CPC925_MC_START || mc_reg[1] != CPC925_MC_LENGTH)
1978 return;
1979
1980 prom_printf("Fixing up bogus hostbridge on Maple...\n");
1981
1982 mc_reg[0] = 0x0;
1983 mc_reg[1] = CPC925_MC_START;
1984 mc_reg[2] = 0x0;
1985 mc_reg[3] = CPC925_MC_LENGTH;
1986 prom_setprop(mc, name, "reg", mc_reg, sizeof(mc_reg));
1987}
1950#else 1988#else
1951#define fixup_device_tree_maple() 1989#define fixup_device_tree_maple()
1990#define fixup_device_tree_maple_memory_controller()
1952#endif 1991#endif
1953 1992
1954#ifdef CONFIG_PPC_CHRP 1993#ifdef CONFIG_PPC_CHRP
@@ -2189,6 +2228,7 @@ static void __init fixup_device_tree_efika(void)
2189static void __init fixup_device_tree(void) 2228static void __init fixup_device_tree(void)
2190{ 2229{
2191 fixup_device_tree_maple(); 2230 fixup_device_tree_maple();
2231 fixup_device_tree_maple_memory_controller();
2192 fixup_device_tree_chrp(); 2232 fixup_device_tree_chrp();
2193 fixup_device_tree_pmac(); 2233 fixup_device_tree_pmac();
2194 fixup_device_tree_efika(); 2234 fixup_device_tree_efika();
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index bfd60e4accee..0636a3df6978 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