brcm2708: remove CMA_DEBUG
[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 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
28 index 38c89ca..c727f71 100644
29 --- a/arch/arm/boot/dts/Makefile
30 +++ b/arch/arm/boot/dts/Makefile
31 @@ -53,6 +53,7 @@ dtb-$(CONFIG_ARCH_AT91)       += at91-sama5d4ek.dtb
32  
33  dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
34  dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
35 +dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb
36  dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
37  dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
38  dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
39 diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts
40 new file mode 100644
41 index 0000000..e319c8e
42 --- /dev/null
43 +++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
44 @@ -0,0 +1,8 @@
45 +/dts-v1/;
46 +
47 +/include/ "bcm2708.dtsi"
48 +
49 +/ {
50 +       compatible = "brcm,bcm2708";
51 +       model = "Raspberry Pi";
52 +};
53 diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi
54 new file mode 100644
55 index 0000000..50da059
56 --- /dev/null
57 +++ b/arch/arm/boot/dts/bcm2708.dtsi
58 @@ -0,0 +1,27 @@
59 +/include/ "skeleton.dtsi"
60 +
61 +/ {
62 +       compatible = "brcm,bcm2708";
63 +       model = "BCM2708";
64 +
65 +       chosen {
66 +               /*
67 +                  bootargs must be 1024 characters long because the
68 +                  VC bootloader can't expand it
69 +               */
70 +               bootargs = "console=ttyAMA0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ";
71 +       };
72 +
73 +       soc {
74 +               compatible = "simple-bus";
75 +               #address-cells = <1>;
76 +               #size-cells = <1>;
77 +               ranges = <0x7e000000 0x20000000 0x02000000>;
78 +       };
79 +
80 +       clocks {
81 +               compatible = "simple-bus";
82 +               #address-cells = <1>;
83 +               #size-cells = <0>;
84 +       };
85 +};
86 diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig
87 index e151ed4..182e7ba 100644
88 --- a/arch/arm/mach-bcm2708/Kconfig
89 +++ b/arch/arm/mach-bcm2708/Kconfig
90 @@ -9,6 +9,14 @@ config MACH_BCM2708
91         help
92           Include support for the Broadcom(R) BCM2708 platform.
93  
94 +config BCM2708_DT
95 +       bool "BCM2708 Device Tree support"
96 +       depends on MACH_BCM2708
97 +       default n
98 +       select USE_OF
99 +       help
100 +         Enable Device Tree support for BCM2708
101 +
102  config BCM2708_GPIO
103         bool "BCM2708 gpio support"
104         depends on MACH_BCM2708
105 diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
106 index ef12cb8..747e27a 100644
107 --- a/arch/arm/mach-bcm2708/bcm2708.c
108 +++ b/arch/arm/mach-bcm2708/bcm2708.c
109 @@ -33,6 +33,7 @@
110  #include <linux/cnt32_to_63.h>
111  #include <linux/io.h>
112  #include <linux/module.h>
113 +#include <linux/of_platform.h>
114  #include <linux/spi/spi.h>
115  #include <linux/w1-gpio.h>
116  
117 @@ -734,6 +735,22 @@ static void bcm2708_power_off(void)
118         }
119  }
120  
121 +#ifdef CONFIG_OF
122 +static void __init bcm2708_dt_init(void)
123 +{
124 +       int ret;
125 +
126 +       of_clk_init(NULL);
127 +       ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
128 +       if (ret) {
129 +               pr_err("of_platform_populate failed: %d\n", ret);
130 +               BUG();
131 +       }
132 +}
133 +#else
134 +static void __init bcm2708_dt_init(void) { }
135 +#endif /* CONFIG_OF */
136 +
137  void __init bcm2708_init(void)
138  {
139         int i;
140 @@ -745,6 +762,7 @@ void __init bcm2708_init(void)
141         pm_power_off = bcm2708_power_off;
142  
143         bcm2708_init_clocks();
144 +       bcm2708_dt_init();
145  
146         bcm_register_device(&bcm2708_dmaman_device);
147         bcm_register_device(&bcm2708_vcio_device);
148 @@ -965,6 +983,11 @@ static void __init board_reserve(void)
149  #endif
150  }
151  
152 +static const char * const bcm2708_compat[] = {
153 +       "brcm,bcm2708",
154 +       NULL
155 +};
156 +
157  MACHINE_START(BCM2708, "BCM2708")
158      /* Maintainer: Broadcom Europe Ltd. */
159         .map_io = bcm2708_map_io,
160 @@ -974,6 +997,7 @@ MACHINE_START(BCM2708, "BCM2708")
161         .init_early = bcm2708_init_early,
162         .reserve = board_reserve,
163         .restart        = bcm2708_restart,
164 +       .dt_compat = bcm2708_compat,
165  MACHINE_END
166  
167  module_param(boardrev, uint, 0644);
168 -- 
169 1.8.3.2
170