summaryrefslogtreecommitdiff
path: root/cpu/mpc83xx/cpu.c
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2007-08-15 22:30:26 -0500
committerKim Phillips <kim.phillips@freescale.com>2007-08-15 22:36:33 -0500
commit6a16e0dfcc4119b46adb1dce2d6c8fb3c5d108e1 (patch)
tree7b67b067fc514ec885677b99bac2b0c77e144f02 /cpu/mpc83xx/cpu.c
parent8f9e0e9f339aee4ce31a338d5f27356eb5457f85 (diff)
mpc83xx: move common /memory node update mechanism to cpu.c
also adds common prototypes to include/common.h. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Diffstat (limited to 'cpu/mpc83xx/cpu.c')
-rw-r--r--cpu/mpc83xx/cpu.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index 4deb5e516..e634f0a25 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -523,9 +523,10 @@ static const struct {
void
ft_cpu_setup(void *blob, bd_t *bd)
{
- int nodeoffset;
- int err;
- int j;
+ int nodeoffset;
+ int err;
+ int j;
+ int tmp[2];
for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
nodeoffset = fdt_find_node_by_path(blob, fixup_props[j].node);
@@ -534,15 +535,29 @@ ft_cpu_setup(void *blob, bd_t *bd)
fixup_props[j].prop, bd);
if (err < 0)
debug("Problem setting %s = %s: %s\n",
- fixup_props[j].node,
- fixup_props[j].prop,
- fdt_strerror(err));
+ fixup_props[j].node, fixup_props[j].prop,
+ fdt_strerror(err));
} else {
debug("Couldn't find %s: %s\n",
- fixup_props[j].node,
- fdt_strerror(nodeoffset));
+ fixup_props[j].node, fdt_strerror(nodeoffset));
}
}
+
+ /* update, or add and update /memory node */
+ nodeoffset = fdt_find_node_by_path(blob, "/memory");
+ if (nodeoffset < 0) {
+ nodeoffset = fdt_add_subnode(blob, 0, "memory");
+ if (nodeoffset < 0)
+ debug("failed to add /memory node: %s\n",
+ fdt_strerror(nodeoffset));
+ }
+ if (nodeoffset >= 0) {
+ fdt_setprop(blob, nodeoffset, "device_type",
+ "memory", sizeof("memory"));
+ tmp[0] = cpu_to_be32(bd->bi_memstart);
+ tmp[1] = cpu_to_be32(bd->bi_memsize);
+ fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
+ }
}
#elif defined(CONFIG_OF_FLAT_TREE)
void