summaryrefslogtreecommitdiff
path: root/arch/arm/mach-bcm2708
diff options
context:
space:
mode:
authornotro <notro@tronnes.org>2014-07-09 14:46:08 +0200
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:10:39 +0100
commit1f608b5afc2ee72f700681f91b23b1844cf76563 (patch)
treec81431684eaa530fdcc90f92f72f89b9001b712f /arch/arm/mach-bcm2708
parent8c07f3005b875170a3b33738e081681d7f97e733 (diff)
downloadlinux-1f608b5afc2ee72f700681f91b23b1844cf76563.tar.gz
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 BCM2708_DT: Correct length of the peripheral space
Diffstat (limited to 'arch/arm/mach-bcm2708')
-rw-r--r--arch/arm/mach-bcm2708/Kconfig8
-rw-r--r--arch/arm/mach-bcm2708/bcm2708.c45
2 files changed, 50 insertions, 3 deletions
diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig
index e151ed4efbbb..182e7bafbfe3 100644
--- 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
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 080e26024b0c..496cbcd55c8b 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -33,7 +33,9 @@
#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/gpio/machine.h>
#include <linux/version.h>
#include <linux/clkdev.h>
@@ -84,6 +86,8 @@ static unsigned disk_led_gpio = 16;
static unsigned disk_led_active_low = 1;
static unsigned reboot_part = 0;
+static unsigned use_dt = 0;
+
static void __init bcm2708_init_led(void);
void __init bcm2708_init_irq(void)
@@ -599,6 +603,16 @@ int __init bcm_register_device(struct platform_device *pdev)
return ret;
}
+/*
+ * Use these macros for platform and i2c devices that are present in the
+ * Device Tree. This way the devices are only added on non-DT systems.
+ */
+#define bcm_register_device_dt(pdev) \
+ if (!use_dt) bcm_register_device(pdev)
+
+#define i2c_register_board_info_dt(busnum, info, n) \
+ if (!use_dt) i2c_register_board_info(busnum, info, n)
+
int calc_rsts(int partition)
{
return PM_PASSWORD |
@@ -664,6 +678,24 @@ 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);
+ /* Proceed as if CONFIG_OF was not defined */
+ } else {
+ use_dt = 1;
+ }
+}
+#else
+static void __init bcm2708_dt_init(void) { }
+#endif /* CONFIG_OF */
+
void __init bcm2708_init(void)
{
int i;
@@ -675,6 +707,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_dmaengine_device);
@@ -842,9 +875,9 @@ static struct platform_device bcm2708_led_device = {
static void __init bcm2708_init_led(void)
{
- bcm2708_leds[0].gpio = disk_led_gpio;
- bcm2708_leds[0].active_low = disk_led_active_low;
- platform_device_register(&bcm2708_led_device);
+ bcm2708_leds[0].gpio = disk_led_gpio;
+ bcm2708_leds[0].active_low = disk_led_active_low;
+ bcm_register_device_dt(&bcm2708_led_device);
}
#else
static inline void bcm2708_init_led(void)
@@ -869,6 +902,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,
@@ -878,6 +916,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);