brcm2708: refresh patches
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0049-BCM2708-Add-core-Device-Tree-support.patch
1 From f6459ef9602c16b02516be4848a77d30ce75d168 Mon Sep 17 00:00:00 2001
2 From: notro <notro@tronnes.org>
3 Date: Wed, 9 Jul 2014 14:46:08 +0200
4 Subject: [PATCH 049/114] BCM2708: Add core Device Tree support
5
6 Add the bare minimum needed to boot BCM2708 from a Device Tree.
7
8 Signed-off-by: Noralf Tronnes <notro@tronnes.org>
9
10 BCM2708: DT: change 'axi' nodename to 'soc'
11
12 Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835.
13 The VC4 bootloader fills in certain properties in the 'axi' subtree,
14 but since this is part of an upstreaming effort, the name is changed.
15
16 Signed-off-by: Noralf Tronnes notro@tronnes.org
17 ---
18 arch/arm/boot/dts/Makefile | 1 +
19 arch/arm/boot/dts/bcm2708-rpi-b.dts | 8 ++++++++
20 arch/arm/boot/dts/bcm2708.dtsi | 27 +++++++++++++++++++++++++++
21 arch/arm/mach-bcm2708/Kconfig | 8 ++++++++
22 arch/arm/mach-bcm2708/bcm2708.c | 24 ++++++++++++++++++++++++
23 5 files changed, 68 insertions(+)
24 create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts
25 create mode 100644 arch/arm/boot/dts/bcm2708.dtsi
26
27 --- a/arch/arm/boot/dts/Makefile
28 +++ b/arch/arm/boot/dts/Makefile
29 @@ -53,6 +53,7 @@ dtb-$(CONFIG_ARCH_AT91) += at91-sama5d4e
30
31 dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
32 dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
33 +dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
34 dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
35 dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
36 dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
37 --- /dev/null
38 +++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
39 @@ -0,0 +1,8 @@
40 +/dts-v1/;
41 +
42 +/include/ "bcm2708.dtsi"
43 +
44 +/ {
45 + compatible = "brcm,bcm2708";
46 + model = "Raspberry Pi";
47 +};
48 --- /dev/null
49 +++ b/arch/arm/boot/dts/bcm2708.dtsi
50 @@ -0,0 +1,27 @@
51 +/include/ "skeleton.dtsi"
52 +
53 +/ {
54 + compatible = "brcm,bcm2708";
55 + model = "BCM2708";
56 +
57 + chosen {
58 + /*
59 + bootargs must be 1024 characters long because the
60 + VC bootloader can't expand it
61 + */
62 + bootargs = "console=ttyAMA0 ";
63 + };
64 +
65 + soc {
66 + compatible = "simple-bus";
67 + #address-cells = <1>;
68 + #size-cells = <1>;
69 + ranges = <0x7e000000 0x20000000 0x02000000>;
70 + };
71 +
72 + clocks {
73 + compatible = "simple-bus";
74 + #address-cells = <1>;
75 + #size-cells = <0>;
76 + };
77 +};
78 --- a/arch/arm/mach-bcm2708/Kconfig
79 +++ b/arch/arm/mach-bcm2708/Kconfig
80 @@ -9,6 +9,14 @@ config MACH_BCM2708
81 help
82 Include support for the Broadcom(R) BCM2708 platform.
83
84 +config BCM2708_DT
85 + bool "BCM2708 Device Tree support"
86 + depends on MACH_BCM2708
87 + default n
88 + select USE_OF
89 + help
90 + Enable Device Tree support for BCM2708
91 +
92 config BCM2708_GPIO
93 bool "BCM2708 gpio support"
94 depends on MACH_BCM2708
95 --- a/arch/arm/mach-bcm2708/bcm2708.c
96 +++ b/arch/arm/mach-bcm2708/bcm2708.c
97 @@ -33,6 +33,7 @@
98 #include <linux/cnt32_to_63.h>
99 #include <linux/io.h>
100 #include <linux/module.h>
101 +#include <linux/of_platform.h>
102 #include <linux/spi/spi.h>
103 #include <linux/w1-gpio.h>
104
105 @@ -734,6 +735,22 @@ static void bcm2708_power_off(void)
106 }
107 }
108
109 +#ifdef CONFIG_OF
110 +static void __init bcm2708_dt_init(void)
111 +{
112 + int ret;
113 +
114 + of_clk_init(NULL);
115 + ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
116 + if (ret) {
117 + pr_err("of_platform_populate failed: %d\n", ret);
118 + BUG();
119 + }
120 +}
121 +#else
122 +static void __init bcm2708_dt_init(void) { }
123 +#endif /* CONFIG_OF */
124 +
125 void __init bcm2708_init(void)
126 {
127 int i;
128 @@ -745,6 +762,7 @@ void __init bcm2708_init(void)
129 pm_power_off = bcm2708_power_off;
130
131 bcm2708_init_clocks();
132 + bcm2708_dt_init();
133
134 bcm_register_device(&bcm2708_dmaman_device);
135 bcm_register_device(&bcm2708_vcio_device);
136 @@ -965,6 +983,11 @@ static void __init board_reserve(void)
137 #endif
138 }
139
140 +static const char * const bcm2708_compat[] = {
141 + "brcm,bcm2708",
142 + NULL
143 +};
144 +
145 MACHINE_START(BCM2708, "BCM2708")
146 /* Maintainer: Broadcom Europe Ltd. */
147 .map_io = bcm2708_map_io,
148 @@ -974,6 +997,7 @@ MACHINE_START(BCM2708, "BCM2708")
149 .init_early = bcm2708_init_early,
150 .reserve = board_reserve,
151 .restart = bcm2708_restart,
152 + .dt_compat = bcm2708_compat,
153 MACHINE_END
154
155 module_param(boardrev, uint, 0644);