1 From db896341299cbcb703821228574ba9b79b6a3565 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 24 Jun 2014 10:57:51 +0200
4 Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB
7 arch/mips/bcm63xx/boards/Kconfig | 4 ++++
8 arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++++
9 2 files changed, 38 insertions(+)
11 --- a/arch/mips/bcm63xx/boards/Kconfig
12 +++ b/arch/mips/bcm63xx/boards/Kconfig
17 +config BOARD_BCM63XX_DT
18 + bool "Device Tree boards (experimential)"
22 bool "Generic Broadcom 963xx boards"
24 --- a/arch/mips/bcm63xx/boards/board_common.c
25 +++ b/arch/mips/bcm63xx/boards/board_common.c
27 #include <linux/init.h>
28 #include <linux/kernel.h>
29 #include <linux/string.h>
30 +#include <linux/of_fdt.h>
31 +#include <linux/of_platform.h>
32 #include <linux/platform_device.h>
33 #include <linux/ssb/ssb.h>
34 #include <linux/gpio_keys.h>
36 #include <asm/addrspace.h>
37 #include <asm/bootinfo.h>
38 #include <asm/fw/cfe/cfe_api.h>
39 +#include <asm/prom.h>
40 #include <bcm63xx_board.h>
41 #include <bcm63xx_cpu.h>
42 #include <bcm63xx_dev_uart.h>
43 @@ -129,8 +132,23 @@ void __init board_setup(void)
44 /* make sure we're running on expected cpu */
45 if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
46 panic("unexpected CPU for bcm963xx board");
49 + if (initial_boot_params)
50 + __dt_setup_arch(initial_boot_params);
55 +void __init device_tree_init(void)
57 + if (!initial_boot_params)
60 + unflatten_and_copy_device_tree();
64 static struct gpio_led_platform_data bcm63xx_led_data;
66 static struct platform_device bcm63xx_gpio_leds = {
67 @@ -149,6 +167,13 @@ static struct platform_device bcm63xx_gp
68 .dev.platform_data = &bcm63xx_gpio_keys_data,
72 +static struct of_device_id of_ids[] = {
73 + { /* filled at runtime */ },
74 + { .compatible = "simple-bus" },
79 * third stage init callback, register all board devices.
81 @@ -158,6 +183,15 @@ int __init board_register_devices(void)
86 + if (of_have_populated_dt()) {
87 + snprintf(of_ids[0].compatible, sizeof(of_ids[0].compatible),
88 + "brcm,bcm%x", bcm63xx_get_cpu_id());
90 + of_platform_populate(NULL, of_ids, NULL, NULL);
95 bcm63xx_uart_register(0);