summaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.18/0049-BCM2708-Add-core-Device-Tree-support.patch
blob: 73b073510b8453b70cffba1c4b243e17cfd998c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
From f6459ef9602c16b02516be4848a77d30ce75d168 Mon Sep 17 00:00:00 2001
From: notro <notro@tronnes.org>
Date: Wed, 9 Jul 2014 14:46:08 +0200
Subject: [PATCH 049/114] BCM2708: Add core Device Tree support

Add the bare minimum needed to boot BCM2708 from a Device Tree.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

BCM2708: DT: change 'axi' nodename to 'soc'

Change DT node named 'axi' to 'soc' so it matches ARCH_BCM2835.
The VC4 bootloader fills in certain properties in the 'axi' subtree,
but since this is part of an upstreaming effort, the name is changed.

Signed-off-by: Noralf Tronnes notro@tronnes.org
---
 arch/arm/boot/dts/Makefile          |  1 +
 arch/arm/boot/dts/bcm2708-rpi-b.dts |  8 ++++++++
 arch/arm/boot/dts/bcm2708.dtsi      | 27 +++++++++++++++++++++++++++
 arch/arm/mach-bcm2708/Kconfig       |  8 ++++++++
 arch/arm/mach-bcm2708/bcm2708.c     | 24 ++++++++++++++++++++++++
 5 files changed, 68 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts
 create mode 100644 arch/arm/boot/dts/bcm2708.dtsi

--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -53,6 +53,7 @@ dtb-$(CONFIG_ARCH_AT91)	+= at91-sama5d4e
 
 dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
 dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
+dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
 dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+/include/ "bcm2708.dtsi"
+
+/ {
+	compatible = "brcm,bcm2708";
+	model = "Raspberry Pi";
+};
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2708.dtsi
@@ -0,0 +1,27 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "brcm,bcm2708";
+	model = "BCM2708";
+
+	chosen {
+		/*
+		   bootargs must be 1024 characters long because the
+		   VC bootloader can't expand it
+		*/
+		bootargs = "console=ttyAMA0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ";
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0x7e000000 0x20000000 0x02000000>;
+	};
+
+	clocks {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+};
--- a/arch/arm/mach-bcm2708/Kconfig
+++ b/arch/arm/mach-bcm2708/Kconfig
@@ -9,6 +9,14 @@ config MACH_BCM2708
 	help
 	  Include support for the Broadcom(R) BCM2708 platform.
 
+config BCM2708_DT
+	bool "BCM2708 Device Tree support"
+	depends on MACH_BCM2708
+	default n
+	select USE_OF
+	help
+	  Enable Device Tree support for BCM2708
+
 config BCM2708_GPIO
 	bool "BCM2708 gpio support"
 	depends on MACH_BCM2708
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -33,6 +33,7 @@
 #include <linux/cnt32_to_63.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/of_platform.h>
 #include <linux/spi/spi.h>
 #include <linux/w1-gpio.h>
 
@@ -734,6 +735,22 @@ static void bcm2708_power_off(void)
 	}
 }
 
+#ifdef CONFIG_OF
+static void __init bcm2708_dt_init(void)
+{
+	int ret;
+
+	of_clk_init(NULL);
+	ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	if (ret) {
+		pr_err("of_platform_populate failed: %d\n", ret);
+		BUG();
+	}
+}
+#else
+static void __init bcm2708_dt_init(void) { }
+#endif /* CONFIG_OF */
+
 void __init bcm2708_init(void)
 {
 	int i;
@@ -745,6 +762,7 @@ void __init bcm2708_init(void)
 	pm_power_off = bcm2708_power_off;
 
 	bcm2708_init_clocks();
+	bcm2708_dt_init();
 
 	bcm_register_device(&bcm2708_dmaman_device);
 	bcm_register_device(&bcm2708_vcio_device);
@@ -965,6 +983,11 @@ static void __init board_reserve(void)
 #endif
 }
 
+static const char * const bcm2708_compat[] = {
+	"brcm,bcm2708",
+	NULL
+};
+
 MACHINE_START(BCM2708, "BCM2708")
     /* Maintainer: Broadcom Europe Ltd. */
 	.map_io = bcm2708_map_io,
@@ -974,6 +997,7 @@ MACHINE_START(BCM2708, "BCM2708")
 	.init_early = bcm2708_init_early,
 	.reserve = board_reserve,
 	.restart	= bcm2708_restart,
+	.dt_compat = bcm2708_compat,
 MACHINE_END
 
 module_param(boardrev, uint, 0644);