aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-08-11 11:36:48 +0000
committerJonas Gorski <jogo@openwrt.org>2014-08-11 11:36:48 +0000
commit3b703b5dd7a111aefee2ebb36dbf8d82af64c266 (patch)
tree0a56cab123ff3d02e60d7a34b9b790bc5b5c0640 /target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch
parent647c40e6dc9394fd6ba09cbef53c345f714f8bcf (diff)
downloadmaster-187ad058-3b703b5dd7a111aefee2ebb36dbf8d82af64c266.tar.gz
master-187ad058-3b703b5dd7a111aefee2ebb36dbf8d82af64c266.tar.bz2
master-187ad058-3b703b5dd7a111aefee2ebb36dbf8d82af64c266.zip
brcm63xx: add and enable support for loading an appended dtb
Allow appending a dtb blob to the binary and use it for identifying the board. Fall back to nvram based identification in case of no dtb passed. Signed-off-by: Jonas Gorski <jogo@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42119 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch')
-rw-r--r--target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch b/target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch
new file mode 100644
index 0000000000..577df55d0e
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.14/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch
@@ -0,0 +1,96 @@
+From db896341299cbcb703821228574ba9b79b6a3565 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Tue, 24 Jun 2014 10:57:51 +0200
+Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB
+
+---
+ arch/mips/bcm63xx/boards/Kconfig | 4 ++++
+ arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+--- a/arch/mips/bcm63xx/boards/Kconfig
++++ b/arch/mips/bcm63xx/boards/Kconfig
+@@ -1,6 +1,10 @@
+ menu "Board support"
+ depends on BCM63XX
+
++config BOARD_BCM63XX_DT
++ bool "Device Tree boards (experimential)"
++ select USE_OF
++
+ config BOARD_BCM963XX
+ bool "Generic Broadcom 963xx boards"
+ select SSB
+--- a/arch/mips/bcm63xx/boards/board_common.c
++++ b/arch/mips/bcm63xx/boards/board_common.c
+@@ -10,6 +10,8 @@
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+ #include <linux/string.h>
++#include <linux/of_fdt.h>
++#include <linux/of_platform.h>
+ #include <linux/platform_device.h>
+ #include <linux/ssb/ssb.h>
+ #include <linux/gpio_keys.h>
+@@ -17,6 +19,7 @@
+ #include <asm/addrspace.h>
+ #include <asm/bootinfo.h>
+ #include <asm/fw/cfe/cfe_api.h>
++#include <asm/prom.h>
+ #include <bcm63xx_board.h>
+ #include <bcm63xx_cpu.h>
+ #include <bcm63xx_dev_uart.h>
+@@ -129,8 +132,23 @@ void __init board_setup(void)
+ /* make sure we're running on expected cpu */
+ if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
+ panic("unexpected CPU for bcm963xx board");
++
++#if CONFIG_OF
++ if (initial_boot_params)
++ __dt_setup_arch(initial_boot_params);
++#endif
+ }
+
++#if CONFIG_OF
++void __init device_tree_init(void)
++{
++ if (!initial_boot_params)
++ return;
++
++ unflatten_and_copy_device_tree();
++}
++#endif
++
+ static struct gpio_led_platform_data bcm63xx_led_data;
+
+ static struct platform_device bcm63xx_gpio_leds = {
+@@ -149,6 +167,13 @@ static struct platform_device bcm63xx_gp
+ .dev.platform_data = &bcm63xx_gpio_keys_data,
+ };
+
++#if CONFIG_OF
++static struct of_device_id of_ids[] = {
++ { /* filled at runtime */ },
++ { .compatible = "simple-bus" },
++ { },
++};
++#endif
+ /*
+ * third stage init callback, register all board devices.
+ */
+@@ -158,6 +183,15 @@ int __init board_register_devices(void)
+ int led_count = 0;
+ int usbh_ports = 0;
+
++#if CONFIG_OF
++ if (of_have_populated_dt()) {
++ snprintf(of_ids[0].compatible, sizeof(of_ids[0].compatible),
++ "brcm,bcm%x", bcm63xx_get_cpu_id());
++
++ of_platform_populate(NULL, of_ids, NULL, NULL);
++ }
++#endif
++
+ if (board.has_uart0)
+ bcm63xx_uart_register(0);
+