summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/setup-r8a7779.c
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2012-11-21 22:00:15 +0900
committerSimon Horman <horms+renesas@verge.net.au>2013-03-13 02:13:19 +0900
commit10e8d4f6dddb0f9dc408c2f2bde8399b243a42ca (patch)
treed0a463c7c4cc44a57b2d8984973f838af17a7ba0 /arch/arm/mach-shmobile/setup-r8a7779.c
parentc58a1545e39ed1ff54dd2c167d3d25ae62c0dbd3 (diff)
ARM: mach-shmobile: r8a7779: Minimal setup using DT
Allow a minimal setup of the r8a7779 SoC using a flattened device tree. In particular, configure the i2c and ethernet controllers using a flattened device tree. SCI serial controller and TMU clock source, whose drivers do not yet support configuration using a flattened device tree, are still configured using C code in order to allow booting of a board with this SoC. The ethernet controller also requires a regulator which is a board property. A sample snippet DT for the marzen board is as follows: /dts-v1/; /include/ "r8a7779.dtsi" / { fixedregulator3v3: fixedregulator@0 { compatible = "regulator-fixed"; regulator-name = "fixed-3.3V"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-boot-on; regulator-always-on; }; }; &lan0 { vddvario-supply = <&fixedregulator3v3>; vdd33a-supply = <&fixedregulator3v3>; }; Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/setup-r8a7779.c')
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c59
1 files changed, 53 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index c54ff9b29fe5..922dd4db21a0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/input.h>
@@ -321,7 +322,7 @@ static struct platform_device i2c3_device = {
.num_resources = ARRAY_SIZE(rcar_i2c3_res),
};
-static struct platform_device *r8a7779_early_devices[] __initdata = {
+static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
&scif0_device,
&scif1_device,
&scif2_device,
@@ -330,15 +331,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
&scif5_device,
&tmu00_device,
&tmu01_device,
+};
+
+static struct platform_device *r8a7779_early_devices[] __initdata = {
&i2c0_device,
&i2c1_device,
&i2c2_device,
&i2c3_device,
};
-static struct platform_device *r8a7779_late_devices[] __initdata = {
-};
-
void __init r8a7779_add_standard_devices(void)
{
#ifdef CONFIG_CACHE_L2X0
@@ -349,10 +350,10 @@ void __init r8a7779_add_standard_devices(void)
r8a7779_init_pm_domains();
+ platform_add_devices(r8a7779_early_devices_dt,
+ ARRAY_SIZE(r8a7779_early_devices_dt));
platform_add_devices(r8a7779_early_devices,
ARRAY_SIZE(r8a7779_early_devices));
- platform_add_devices(r8a7779_late_devices,
- ARRAY_SIZE(r8a7779_late_devices));
}
/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -367,6 +368,8 @@ void __init r8a7779_earlytimer_init(void)
void __init r8a7779_add_early_devices(void)
{
+ early_platform_add_devices(r8a7779_early_devices_dt,
+ ARRAY_SIZE(r8a7779_early_devices_dt));
early_platform_add_devices(r8a7779_early_devices,
ARRAY_SIZE(r8a7779_early_devices));
@@ -386,3 +389,47 @@ void __init r8a7779_add_early_devices(void)
* command line in case of the marzen board.
*/
}
+
+#ifdef CONFIG_USE_OF
+void __init r8a7779_add_early_devices_dt(void)
+{
+ shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
+
+ early_platform_add_devices(r8a7779_early_devices_dt,
+ ARRAY_SIZE(r8a7779_early_devices_dt));
+
+ /* Early serial console setup is not included here.
+ * See comment in r8a7779_add_early_devices().
+ */
+}
+
+static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
+ {},
+};
+
+void __init r8a7779_add_standard_devices_dt(void)
+{
+ /* clocks are setup late during boot in the case of DT */
+ r8a7779_clock_init();
+
+ platform_add_devices(r8a7779_early_devices_dt,
+ ARRAY_SIZE(r8a7779_early_devices_dt));
+ of_platform_populate(NULL, of_default_bus_match_table,
+ r8a7779_auxdata_lookup, NULL);
+}
+
+static const char *r8a7779_compat_dt[] __initdata = {
+ "renesas,r8a7779",
+ NULL,
+};
+
+DT_MACHINE_START(SH73A0_DT, "Generic R8A7779 (Flattened Device Tree)")
+ .map_io = r8a7779_map_io,
+ .init_early = r8a7779_add_early_devices_dt,
+ .nr_irqs = NR_IRQS_LEGACY,
+ .init_irq = r8a7779_init_irq_dt,
+ .init_machine = r8a7779_add_standard_devices_dt,
+ .init_time = shmobile_timer_init,
+ .dt_compat = r8a7779_compat_dt,
+MACHINE_END
+#endif /* CONFIG_USE_OF */