openwrtv3/target/linux/brcm2708/patches-3.18/0049-BCM2708-Add-core-Device-Tree-support.patch
John Crispin 9b74de00f7 brcm2708: refresh patches
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>

SVN-Revision: 44433
2015-02-13 07:38:27 +00:00

155 lines
4.9 KiB
Diff

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);