aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2012-11-21 08:00:15 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-03-12 13:13:19 -0400
commit10e8d4f6dddb0f9dc408c2f2bde8399b243a42ca (patch)
treed0a463c7c4cc44a57b2d8984973f838af17a7ba0
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>
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi45
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h2
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c59
3 files changed, 100 insertions, 6 deletions
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 8c6d52cee6c6..2913759e93e2 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -47,4 +47,49 @@
47 reg = <0xf0001000 0x1000>, 47 reg = <0xf0001000 0x1000>,
48 <0xf0000100 0x100>; 48 <0xf0000100 0x100>;
49 }; 49 };
50
51 i2c0: i2c@0xffc70000 {
52 #address-cells = <1>;
53 #size-cells = <0>;
54 compatible = "renesas,rmobile-iic";
55 reg = <0xffc70000 0x1000>;
56 interrupt-parent = <&gic>;
57 interrupts = <0 79 0x4>;
58 };
59
60 i2c1: i2c@0xffc71000 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 compatible = "renesas,rmobile-iic";
64 reg = <0xffc71000 0x1000>;
65 interrupt-parent = <&gic>;
66 interrupts = <0 82 0x4>;
67 };
68
69 i2c2: i2c@0xffc72000 {
70 #address-cells = <1>;
71 #size-cells = <0>;
72 compatible = "renesas,rmobile-iic";
73 reg = <0xffc72000 0x1000>;
74 interrupt-parent = <&gic>;
75 interrupts = <0 80 0x4>;
76 };
77
78 i2c3: i2c@0xffc73000 {
79 #address-cells = <1>;
80 #size-cells = <0>;
81 compatible = "renesas,rmobile-iic";
82 reg = <0xffc73000 0x1000>;
83 interrupt-parent = <&gic>;
84 interrupts = <0 81 0x4>;
85 };
86
87 lan0: lan0@18000000 {
88 compatible = "smsc,lan9220", "smsc,lan9115";
89 reg = <0x18000000 0x100>;
90 phy-mode = "mii";
91 interrupt-parent = <&gic>;
92 interrupts = <0 28 0x4>;
93 reg-io-width = <4>;
94 };
50}; 95};
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 3f067100bb05..c72d301a8d98 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -63,7 +63,9 @@ extern void r8a7779_init_irq_dt(void);
63extern void r8a7779_map_io(void); 63extern void r8a7779_map_io(void);
64extern void r8a7779_earlytimer_init(void); 64extern void r8a7779_earlytimer_init(void);
65extern void r8a7779_add_early_devices(void); 65extern void r8a7779_add_early_devices(void);
66extern void r8a7779_add_early_devices_dt(void);
66extern void r8a7779_add_standard_devices(void); 67extern void r8a7779_add_standard_devices(void);
68extern void r8a7779_add_standard_devices_dt(void);
67extern void r8a7779_clock_init(void); 69extern void r8a7779_clock_init(void);
68extern void r8a7779_pinmux_init(void); 70extern void r8a7779_pinmux_init(void);
69extern void r8a7779_pm_init(void); 71extern void r8a7779_pm_init(void);
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 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/of_platform.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/input.h> 27#include <linux/input.h>
@@ -321,7 +322,7 @@ static struct platform_device i2c3_device = {
321 .num_resources = ARRAY_SIZE(rcar_i2c3_res), 322 .num_resources = ARRAY_SIZE(rcar_i2c3_res),
322}; 323};
323 324
324static struct platform_device *r8a7779_early_devices[] __initdata = { 325static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
325 &scif0_device, 326 &scif0_device,
326 &scif1_device, 327 &scif1_device,
327 &scif2_device, 328 &scif2_device,
@@ -330,15 +331,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
330 &scif5_device, 331 &scif5_device,
331 &tmu00_device, 332 &tmu00_device,
332 &tmu01_device, 333 &tmu01_device,
334};
335
336static struct platform_device *r8a7779_early_devices[] __initdata = {
333 &i2c0_device, 337 &i2c0_device,
334 &i2c1_device, 338 &i2c1_device,
335 &i2c2_device, 339 &i2c2_device,
336 &i2c3_device, 340 &i2c3_device,
337}; 341};
338 342
339static struct platform_device *r8a7779_late_devices[] __initdata = {
340};
341
342void __init r8a7779_add_standard_devices(void) 343void __init r8a7779_add_standard_devices(void)
343{ 344{
344#ifdef CONFIG_CACHE_L2X0 345#ifdef CONFIG_CACHE_L2X0
@@ -349,10 +350,10 @@ void __init r8a7779_add_standard_devices(void)
349 350
350 r8a7779_init_pm_domains(); 351 r8a7779_init_pm_domains();
351 352
353 platform_add_devices(r8a7779_early_devices_dt,
354 ARRAY_SIZE(r8a7779_early_devices_dt));
352 platform_add_devices(r8a7779_early_devices, 355 platform_add_devices(r8a7779_early_devices,
353 ARRAY_SIZE(r8a7779_early_devices)); 356 ARRAY_SIZE(r8a7779_early_devices));
354 platform_add_devices(r8a7779_late_devices,
355 ARRAY_SIZE(r8a7779_late_devices));
356} 357}
357 358
358/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 359/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -367,6 +368,8 @@ void __init r8a7779_earlytimer_init(void)
367 368
368void __init r8a7779_add_early_devices(void) 369void __init r8a7779_add_early_devices(void)
369{ 370{
371 early_platform_add_devices(r8a7779_early_devices_dt,
372 ARRAY_SIZE(r8a7779_early_devices_dt));
370 early_platform_add_devices(r8a7779_early_devices, 373 early_platform_add_devices(r8a7779_early_devices,
371 ARRAY_SIZE(r8a7779_early_devices)); 374 ARRAY_SIZE(r8a7779_early_devices));
372 375
@@ -386,3 +389,47 @@ void __init r8a7779_add_early_devices(void)
386 * command line in case of the marzen board. 389 * command line in case of the marzen board.
387 */ 390 */
388} 391}
392
393#ifdef CONFIG_USE_OF
394void __init r8a7779_add_early_devices_dt(void)
395{
396 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
397
398 early_platform_add_devices(r8a7779_early_devices_dt,
399 ARRAY_SIZE(r8a7779_early_devices_dt));
400
401 /* Early serial console setup is not included here.
402 * See comment in r8a7779_add_early_devices().
403 */
404}
405
406static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
407 {},
408};
409
410void __init r8a7779_add_standard_devices_dt(void)
411{
412 /* clocks are setup late during boot in the case of DT */
413 r8a7779_clock_init();
414
415 platform_add_devices(r8a7779_early_devices_dt,
416 ARRAY_SIZE(r8a7779_early_devices_dt));
417 of_platform_populate(NULL, of_default_bus_match_table,
418 r8a7779_auxdata_lookup, NULL);
419}
420
421static const char *r8a7779_compat_dt[] __initdata = {
422 "renesas,r8a7779",
423 NULL,
424};
425
426DT_MACHINE_START(SH73A0_DT, "Generic R8A7779 (Flattened Device Tree)")
427 .map_io = r8a7779_map_io,
428 .init_early = r8a7779_add_early_devices_dt,
429 .nr_irqs = NR_IRQS_LEGACY,
430 .init_irq = r8a7779_init_irq_dt,
431 .init_machine = r8a7779_add_standard_devices_dt,
432 .init_time = shmobile_timer_init,
433 .dt_compat = r8a7779_compat_dt,
434MACHINE_END
435#endif /* CONFIG_USE_OF */