Commit 8f101a05 authored by Harry Ciao's avatar Harry Ciao Committed by Linus Torvalds
Browse files

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: default avatarHarry Ciao <>
Cc: Doug Thompson <>
Cc: Michael Ellerman <>
Cc: Benjamin Herrenschmidt <>
Cc: Kumar Gala <>
Cc: Paul Mackerras <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1dc9b70d
......@@ -1947,8 +1947,47 @@ static void __init fixup_device_tree_maple(void)
prom_setprop(isa, name, "ranges",
isa_ranges, sizeof(isa_ranges));
#define CPC925_MC_START 0xf8000000
#define CPC925_MC_LENGTH 0x1000000
/* The values for memory-controller don't have right number of cells */
static void __init fixup_device_tree_maple_memory_controller(void)
phandle mc;
u32 mc_reg[4];
char *name = "/hostbridge@f8000000";
struct prom_t *_prom = &RELOC(prom);
u32 ac, sc;
mc = call_prom("finddevice", 1, 1, ADDR(name));
if (prom_getproplen(mc, "reg") != 8)
prom_getprop(_prom->root, "#address-cells", &ac, sizeof(ac));
prom_getprop(_prom->root, "#size-cells", &sc, sizeof(sc));
if ((ac != 2) || (sc != 2))
if (prom_getprop(mc, "reg", mc_reg, sizeof(mc_reg)) == PROM_ERROR)
if (mc_reg[0] != CPC925_MC_START || mc_reg[1] != CPC925_MC_LENGTH)
prom_printf("Fixing up bogus hostbridge on Maple...\n");
mc_reg[0] = 0x0;
mc_reg[1] = CPC925_MC_START;
mc_reg[2] = 0x0;
mc_reg[3] = CPC925_MC_LENGTH;
prom_setprop(mc, name, "reg", mc_reg, sizeof(mc_reg));
#define fixup_device_tree_maple()
#define fixup_device_tree_maple_memory_controller()
......@@ -2189,6 +2228,7 @@ static void __init fixup_device_tree_efika(void)
static void __init fixup_device_tree(void)
......@@ -335,3 +335,62 @@ define_machine(maple) {
.progress = maple_progress,
.power_save = power4_idle,
* Register a platform device for CPC925 memory controller on
* Motorola ATCA-6101 blade.
#define MAPLE_CPC925_MODEL "Motorola,ATCA-6101"
static int __init maple_cpc925_edac_setup(void)
struct platform_device *pdev;
struct device_node *np = NULL;
struct resource r;
const unsigned char *model;
int ret;
np = of_find_node_by_path("/");
if (!np) {
printk(KERN_ERR "%s: Unable to get root node\n", __func__);
return -ENODEV;
model = (const unsigned char *)of_get_property(np, "model", NULL);
if (!model) {
printk(KERN_ERR "%s: Unabel to get model info\n", __func__);
return -ENODEV;
ret = strcmp(model, MAPLE_CPC925_MODEL);
if (ret != 0)
return 0;
np = of_find_node_by_type(NULL, "memory-controller");
if (!np) {
printk(KERN_ERR "%s: Unable to find memory-controller node\n",
return -ENODEV;
ret = of_address_to_resource(np, 0, &r);
if (ret < 0) {
printk(KERN_ERR "%s: Unable to get memory-controller reg\n",
return -ENODEV;
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;
machine_device_initcall(maple, maple_cpc925_edac_setup);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment