diff options
author | Simon Horman <horms+renesas@verge.net.au> | 2012-11-21 08:00:15 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-01-24 22:43:49 -0500 |
commit | 486095331af0ab4582879aa1421757f51a92d4e7 (patch) | |
tree | 058c02405d9f8d50bdba65f34f3f1af9dd7b71d9 /arch/arm/mach-shmobile | |
parent | a3f22db5102238197d5f6bbcad2f720ec7f09e10 (diff) |
ARM: mach-shmobile: sh73a0: Minimal setup using DT
Allow a minimal setup of the sh73a0 SoC using a flattened device tree.
In particular, Configure the i2c controllers using a flattened device tree.
SCI serial controller and CMT 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.
*** Please note that the clock initialisation scheme used in
this patch does not currently work with SMP as there
is a yet to be resolved lock-up in workqueue initialisation.
CONFIG_SMP must be disabled when using this code. ***
Includes update from Thierry Reding to no longer use gic_handle_irq()
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
fix
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-sh73a0.c | 62 |
3 files changed, 75 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 5f57701da16e..eab26675c852 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -525,6 +525,13 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
525 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 525 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
526 | }; | 526 | }; |
527 | 527 | ||
528 | /* The lookups structure below includes duplicate entries for some clocks | ||
529 | * with alternate names. | ||
530 | * - The traditional name used when a device is initialised with platform data | ||
531 | * - The name used when a device is initialised using device tree | ||
532 | * The longer-term aim is to remove these duplicates, and indeed the | ||
533 | * lookups table entirely, by describing clocks using device tree. | ||
534 | */ | ||
528 | static struct clk_lookup lookups[] = { | 535 | static struct clk_lookup lookups[] = { |
529 | /* main clocks */ | 536 | /* main clocks */ |
530 | CLKDEV_CON_ID("r_clk", &r_clk), | 537 | CLKDEV_CON_ID("r_clk", &r_clk), |
@@ -545,6 +552,7 @@ static struct clk_lookup lookups[] = { | |||
545 | 552 | ||
546 | /* MSTP32 clocks */ | 553 | /* MSTP32 clocks */ |
547 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ | 554 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ |
555 | CLKDEV_DEV_ID("e6824000.i2c", &mstp_clks[MSTP001]), /* I2C2 */ | ||
548 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */ | 556 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */ |
549 | CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */ | 557 | CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */ |
550 | CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */ | 558 | CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */ |
@@ -553,6 +561,7 @@ static struct clk_lookup lookups[] = { | |||
553 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ | 561 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ |
554 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ | 562 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ |
555 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ | 563 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ |
564 | CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */ | ||
556 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | 565 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ |
557 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ | 566 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ |
558 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */ | 567 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */ |
@@ -569,6 +578,7 @@ static struct clk_lookup lookups[] = { | |||
569 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ | 578 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ |
570 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ | 579 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ |
571 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ | 580 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ |
581 | CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ | ||
572 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ | 582 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ |
573 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ | 583 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ |
574 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | 584 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ |
@@ -579,7 +589,9 @@ static struct clk_lookup lookups[] = { | |||
579 | CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ | 589 | CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ |
580 | CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */ | 590 | CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */ |
581 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ | 591 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ |
592 | CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */ | ||
582 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ | 593 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ |
594 | CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */ | ||
583 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 595 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
584 | }; | 596 | }; |
585 | 597 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index e2ba16b6ae8e..64c0622ae7d6 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -38,7 +38,9 @@ extern void sh73a0_init_irq_dt(void); | |||
38 | extern void sh73a0_map_io(void); | 38 | extern void sh73a0_map_io(void); |
39 | extern void sh73a0_earlytimer_init(void); | 39 | extern void sh73a0_earlytimer_init(void); |
40 | extern void sh73a0_add_early_devices(void); | 40 | extern void sh73a0_add_early_devices(void); |
41 | extern void sh73a0_add_early_devices_dt(void); | ||
41 | extern void sh73a0_add_standard_devices(void); | 42 | extern void sh73a0_add_standard_devices(void); |
43 | extern void sh73a0_add_standard_devices_dt(void); | ||
42 | extern void sh73a0_clock_init(void); | 44 | extern void sh73a0_clock_init(void); |
43 | extern void sh73a0_pinmux_init(void); | 45 | extern void sh73a0_pinmux_init(void); |
44 | extern void sh73a0_pm_init(void); | 46 | extern void sh73a0_pm_init(void); |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 8c2d6424f470..f7ecb0bc1bec 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/of_platform.h> | ||
26 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
28 | #include <linux/io.h> | 29 | #include <linux/io.h> |
@@ -754,7 +755,7 @@ static struct platform_device pmu_device = { | |||
754 | .resource = pmu_resources, | 755 | .resource = pmu_resources, |
755 | }; | 756 | }; |
756 | 757 | ||
757 | static struct platform_device *sh73a0_early_devices[] __initdata = { | 758 | static struct platform_device *sh73a0_early_devices_dt[] __initdata = { |
758 | &scif0_device, | 759 | &scif0_device, |
759 | &scif1_device, | 760 | &scif1_device, |
760 | &scif2_device, | 761 | &scif2_device, |
@@ -765,6 +766,9 @@ static struct platform_device *sh73a0_early_devices[] __initdata = { | |||
765 | &scif7_device, | 766 | &scif7_device, |
766 | &scif8_device, | 767 | &scif8_device, |
767 | &cmt10_device, | 768 | &cmt10_device, |
769 | }; | ||
770 | |||
771 | static struct platform_device *sh73a0_early_devices[] __initdata = { | ||
768 | &tmu00_device, | 772 | &tmu00_device, |
769 | &tmu01_device, | 773 | &tmu01_device, |
770 | }; | 774 | }; |
@@ -787,6 +791,8 @@ void __init sh73a0_add_standard_devices(void) | |||
787 | /* Clear software reset bit on SY-DMAC module */ | 791 | /* Clear software reset bit on SY-DMAC module */ |
788 | __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); | 792 | __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); |
789 | 793 | ||
794 | platform_add_devices(sh73a0_early_devices_dt, | ||
795 | ARRAY_SIZE(sh73a0_early_devices_dt)); | ||
790 | platform_add_devices(sh73a0_early_devices, | 796 | platform_add_devices(sh73a0_early_devices, |
791 | ARRAY_SIZE(sh73a0_early_devices)); | 797 | ARRAY_SIZE(sh73a0_early_devices)); |
792 | platform_add_devices(sh73a0_late_devices, | 798 | platform_add_devices(sh73a0_late_devices, |
@@ -805,9 +811,63 @@ void __init sh73a0_earlytimer_init(void) | |||
805 | 811 | ||
806 | void __init sh73a0_add_early_devices(void) | 812 | void __init sh73a0_add_early_devices(void) |
807 | { | 813 | { |
814 | early_platform_add_devices(sh73a0_early_devices_dt, | ||
815 | ARRAY_SIZE(sh73a0_early_devices_dt)); | ||
808 | early_platform_add_devices(sh73a0_early_devices, | 816 | early_platform_add_devices(sh73a0_early_devices, |
809 | ARRAY_SIZE(sh73a0_early_devices)); | 817 | ARRAY_SIZE(sh73a0_early_devices)); |
810 | 818 | ||
811 | /* setup early console here as well */ | 819 | /* setup early console here as well */ |
812 | shmobile_setup_console(); | 820 | shmobile_setup_console(); |
813 | } | 821 | } |
822 | |||
823 | #ifdef CONFIG_USE_OF | ||
824 | |||
825 | /* Please note that the clock initialisation shcheme used in | ||
826 | * sh73a0_add_early_devices_dt() and sh73a0_add_standard_devices_dt() | ||
827 | * does not work with SMP as there is a yet to be resolved lock-up in | ||
828 | * workqueue initialisation. | ||
829 | * | ||
830 | * CONFIG_SMP should be disabled when using this code. | ||
831 | */ | ||
832 | |||
833 | void __init sh73a0_add_early_devices_dt(void) | ||
834 | { | ||
835 | shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ | ||
836 | |||
837 | early_platform_add_devices(sh73a0_early_devices_dt, | ||
838 | ARRAY_SIZE(sh73a0_early_devices_dt)); | ||
839 | |||
840 | /* setup early console here as well */ | ||
841 | shmobile_setup_console(); | ||
842 | } | ||
843 | |||
844 | static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { | ||
845 | {}, | ||
846 | }; | ||
847 | |||
848 | void __init sh73a0_add_standard_devices_dt(void) | ||
849 | { | ||
850 | /* clocks are setup late during boot in the case of DT */ | ||
851 | sh73a0_clock_init(); | ||
852 | |||
853 | platform_add_devices(sh73a0_early_devices_dt, | ||
854 | ARRAY_SIZE(sh73a0_early_devices_dt)); | ||
855 | of_platform_populate(NULL, of_default_bus_match_table, | ||
856 | sh73a0_auxdata_lookup, NULL); | ||
857 | } | ||
858 | |||
859 | static const char *sh73a0_boards_compat_dt[] __initdata = { | ||
860 | "renesas,sh73a0", | ||
861 | NULL, | ||
862 | }; | ||
863 | |||
864 | DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") | ||
865 | .map_io = sh73a0_map_io, | ||
866 | .init_early = sh73a0_add_early_devices_dt, | ||
867 | .nr_irqs = NR_IRQS_LEGACY, | ||
868 | .init_irq = sh73a0_init_irq_dt, | ||
869 | .init_machine = sh73a0_add_standard_devices_dt, | ||
870 | .init_time = shmobile_timer_init, | ||
871 | .dt_compat = sh73a0_boards_compat_dt, | ||
872 | MACHINE_END | ||
873 | #endif /* CONFIG_USE_OF */ | ||