summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/prom.c
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-10-20 21:28:02 -0700
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 07:45:12 +0100
commit84988c068108c99cf0e7d2391f5bf6bd91e2494c (patch)
tree6e0fcbfa1e23b9606a424fbaf9edd1e70d572bac /arch/mips/kernel/prom.c
parent68e6a78373a6d3ab6d2811f891596fdd8408efec (diff)
downloadlinux-84988c068108c99cf0e7d2391f5bf6bd91e2494c.tar.bz2
MIPS: Create a helper function for DT setup
A couple of platforms register two buses and call of_platform_populate(). Move this into a common function to reduce duplication. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Cc: f.fainelli@gmail.com Cc: mbizon@freebox.fr Cc: jogo@openwrt.org Cc: jfraser@broadcom.com Cc: linux-mips@linux-mips.org Cc: devicetree@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/8167/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/prom.c')
-rw-r--r--arch/mips/kernel/prom.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 5d39bb85bf35..452d4350ce42 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -16,6 +16,7 @@
#include <linux/debugfs.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
#include <asm/page.h>
#include <asm/prom.h>
@@ -54,4 +55,21 @@ void __init __dt_setup_arch(void *bph)
mips_set_machine_name(of_flat_dt_get_machine_name());
}
+
+int __init __dt_register_buses(const char *bus0, const char *bus1)
+{
+ static struct of_device_id of_ids[3];
+
+ if (!of_have_populated_dt())
+ panic("device tree not present");
+
+ strlcpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible));
+ strlcpy(of_ids[1].compatible, bus1, sizeof(of_ids[1].compatible));
+
+ if (of_platform_populate(NULL, of_ids, NULL, NULL))
+ panic("failed to populate DT");
+
+ return 0;
+}
+
#endif