aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-02-01 23:34:14 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-02-09 10:33:10 -0500
commit51975db0b7333cf389b64b5040c2a910341d241a (patch)
treeaba9d6bf56eec915265a8b630c3192affc2a549c /arch/microblaze
parent71a157e8edca55198e808f8561dd49017a54ee34 (diff)
of/flattree: merge early_init_dt_scan_memory() common code
Merge common code between PowerPC and Microblaze architectures. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/kernel/prom.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index f7bd0ee8d481..459c32e4a5fe 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -45,61 +45,14 @@
45/* export that to outside world */ 45/* export that to outside world */
46struct device_node *of_chosen; 46struct device_node *of_chosen;
47 47
48#define early_init_dt_scan_drconf_memory(node) 0
49
50void __init early_init_dt_scan_chosen_arch(unsigned long node) 48void __init early_init_dt_scan_chosen_arch(unsigned long node)
51{ 49{
52 /* No Microblaze specific code here */ 50 /* No Microblaze specific code here */
53} 51}
54 52
55static int __init early_init_dt_scan_memory(unsigned long node, 53void __init early_init_dt_add_memory_arch(u64 base, u64 size)
56 const char *uname, int depth, void *data)
57{ 54{
58 char *type = of_get_flat_dt_prop(node, "device_type", NULL); 55 lmb_add(base, size);
59 __be32 *reg, *endp;
60 unsigned long l;
61
62 /* Look for the ibm,dynamic-reconfiguration-memory node */
63/* if (depth == 1 &&
64 strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0)
65 return early_init_dt_scan_drconf_memory(node);
66*/
67 /* We are scanning "memory" nodes only */
68 if (type == NULL) {
69 /*
70 * The longtrail doesn't have a device_type on the
71 * /memory node, so look for the node called /memory@0.
72 */
73 if (depth != 1 || strcmp(uname, "memory@0") != 0)
74 return 0;
75 } else if (strcmp(type, "memory") != 0)
76 return 0;
77
78 reg = (__be32 *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
79 if (reg == NULL)
80 reg = (__be32 *)of_get_flat_dt_prop(node, "reg", &l);
81 if (reg == NULL)
82 return 0;
83
84 endp = reg + (l / sizeof(__be32));
85
86 pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
87 uname, l, reg[0], reg[1], reg[2], reg[3]);
88
89 while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
90 u64 base, size;
91
92 base = dt_mem_next_cell(dt_root_addr_cells, &reg);
93 size = dt_mem_next_cell(dt_root_size_cells, &reg);
94
95 if (size == 0)
96 continue;
97 pr_debug(" - %llx , %llx\n", (unsigned long long)base,
98 (unsigned long long)size);
99
100 lmb_add(base, size);
101 }
102 return 0;
103} 56}
104 57
105#ifdef CONFIG_EARLY_PRINTK 58#ifdef CONFIG_EARLY_PRINTK