brcm63xx: remove broken DSP platform device code
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.14 / 367-MIPS-BCM63XX-add-support-for-loading-DTB.patch
1 From 26546e5499d98616322fb3472b977e2e86603f3a 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
5
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
7 ---
8 arch/mips/bcm63xx/boards/Kconfig | 4 ++++
9 arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++
10 arch/mips/bcm63xx/prom.c | 6 ++++++
11 3 files changed, 44 insertions(+)
12
13 --- a/arch/mips/bcm63xx/boards/Kconfig
14 +++ b/arch/mips/bcm63xx/boards/Kconfig
15 @@ -2,6 +2,10 @@
16 menu "Board support"
17 depends on BCM63XX
18
19 +config BOARD_BCM63XX_DT
20 + bool "Device Tree boards (experimential)"
21 + select USE_OF
22 +
23 config BOARD_BCM963XX
24 bool "Generic Broadcom 963xx boards"
25 select SSB
26 --- a/arch/mips/bcm63xx/boards/board_common.c
27 +++ b/arch/mips/bcm63xx/boards/board_common.c
28 @@ -10,11 +10,14 @@
29 #include <linux/init.h>
30 #include <linux/kernel.h>
31 #include <linux/string.h>
32 +#include <linux/of_fdt.h>
33 +#include <linux/of_platform.h>
34 #include <linux/platform_device.h>
35 #include <linux/ssb/ssb.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 @@ -125,8 +128,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");
47 +
48 +#if CONFIG_OF
49 + if (initial_boot_params)
50 + __dt_setup_arch(initial_boot_params);
51 +#endif
52 }
53
54 +#if CONFIG_OF
55 +void __init device_tree_init(void)
56 +{
57 + if (!initial_boot_params)
58 + return;
59 +
60 + unflatten_and_copy_device_tree();
61 +}
62 +#endif
63 +
64 static struct gpio_led_platform_data bcm63xx_led_data;
65
66 static struct platform_device bcm63xx_gpio_leds = {
67 @@ -135,6 +153,13 @@ static struct platform_device bcm63xx_gp
68 .dev.platform_data = &bcm63xx_led_data,
69 };
70
71 +#if CONFIG_OF
72 +static struct of_device_id of_ids[] = {
73 + { /* filled at runtime */ },
74 + { .compatible = "simple-bus" },
75 + { },
76 +};
77 +#endif
78 /*
79 * third stage init callback, register all board devices.
80 */
81 @@ -142,6 +167,15 @@ int __init board_register_devices(void)
82 {
83 int usbh_ports = 0;
84
85 +#if CONFIG_OF
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());
89 +
90 + of_platform_populate(NULL, of_ids, NULL, NULL);
91 + }
92 +#endif
93 +
94 if (board.has_uart0)
95 bcm63xx_uart_register(0);
96
97 --- a/arch/mips/bcm63xx/prom.c
98 +++ b/arch/mips/bcm63xx/prom.c
99 @@ -8,6 +8,7 @@
100
101 #include <linux/init.h>
102 #include <linux/bootmem.h>
103 +#include <linux/of_fdt.h>
104 #include <linux/smp.h>
105 #include <asm/bootinfo.h>
106 #include <asm/bmips.h>
107 @@ -23,6 +24,11 @@ void __init prom_init(void)
108 {
109 u32 reg, mask;
110
111 +#if CONFIG_OF
112 + if (fw_passed_dtb)
113 + early_init_dt_verify((void *)fw_passed_dtb);
114 +#endif
115 +
116 bcm63xx_cpu_init();
117
118 /* stop any running watchdog */