summaryrefslogtreecommitdiff
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-11-24 03:26:58 -0700
committerGrant Likely <grant.likely@secretlab.ca>2009-12-10 15:18:03 -0700
commitf7b3a8355ba6cad251297844a0bdd08898ea36e0 (patch)
tree018eee7bfdbf99961e929644a761354bbea12688 /drivers/of
parent2be09cb993826b52c9fc1d44747c20dd43a50038 (diff)
downloadlinux-3.10-f7b3a8355ba6cad251297844a0bdd08898ea36e0.tar.gz
linux-3.10-f7b3a8355ba6cad251297844a0bdd08898ea36e0.tar.bz2
linux-3.10-f7b3a8355ba6cad251297844a0bdd08898ea36e0.zip
of/flattree: Merge early_init_dt_check_for_initrd()
Merge common code between PowerPC and Microblaze Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/fdt.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 43d236cbc17..6ad98e85dc9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/lmb.h>
+#include <linux/initrd.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
@@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
return mem;
}
+#ifdef CONFIG_BLK_DEV_INITRD
+/**
+ * early_init_dt_check_for_initrd - Decode initrd location from flat tree
+ * @node: reference to node containing initrd location ('chosen')
+ */
+void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+ unsigned long len;
+ u32 *prop;
+
+ pr_debug("Looking for initrd properties... ");
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+ if (prop) {
+ initrd_start = (unsigned long)
+ __va(of_read_ulong(prop, len/4));
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+ if (prop) {
+ initrd_end = (unsigned long)
+ __va(of_read_ulong(prop, len/4));
+ initrd_below_start_ok = 1;
+ } else {
+ initrd_start = 0;
+ }
+ }
+
+ pr_debug("initrd_start=0x%lx initrd_end=0x%lx\n",
+ initrd_start, initrd_end);
+}
+#else
+inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
/**
* unflatten_device_tree - create tree of device_nodes from flat blob
*