ARM: dts: Configure system timers for am437x
authorTony Lindgren <tony@atomide.com>
Thu, 7 May 2020 16:59:31 +0000 (09:59 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 19 May 2020 16:38:03 +0000 (09:38 -0700)
We can now init system timers using the dmtimer and 32k counter
based on only devicetree data and drivers/clocksource timers.
Let's configure the clocksource and clockevent, and drop the old
unused platform data.

As we're just dropping platform data, and the early platform data
init is based on the custom ti,hwmods property, we want to drop
both the platform data and ti,hwmods property in a single patch.

Since the dmtimer can use both 32k clock and system clock as the
source, let's also configure the SoC specific default values. The
board specific dts files can reconfigure these with assigned-clocks
and assigned-clock-parents as needed.

Cc: devicetree@vger.kernel.org
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Keerthy <j-keerthy@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/boot/dts/am4372.dtsi
arch/arm/boot/dts/am437x-l4.dtsi
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_common_data.h
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_43xx_data.c

index dba87bfaf33e6828d20348ae1c10ad714a73bb8c..b4861f70f1786dfa49370f1fe0bda16938a08c2e 100644 (file)
                #reset-cells = <1>;
        };
 };
+
+/* Preferred always-on timer for clocksource */
+&timer1_target {
+       ti,no-reset-on-init;
+       ti,no-idle;
+       timer@0 {
+               assigned-clocks = <&timer1_fck>;
+               assigned-clock-parents = <&sys_clkin_ck>;
+       };
+};
+
+/* Preferred timer for clockevent */
+&timer2_target {
+       ti,no-reset-on-init;
+       ti,no-idle;
+       timer@0 {
+               assigned-clocks = <&timer2_fck>;
+               assigned-clock-parents = <&sys_clkin_ck>;
+       };
+};
index 49c6a872052e4e37c9a8f8e65254dcf5e9f33459..0d0f9fe4a882afdb24416c6036a2db93c46ca63f 100644 (file)
                        };
                };
 
-               target-module@31000 {                   /* 0x44e31000, ap 24 40.0 */
+               timer1_target: target-module@31000 {    /* 0x44e31000, ap 24 40.0 */
                        compatible = "ti,sysc-omap2-timer", "ti,sysc";
-                       ti,hwmods = "timer1";
                        reg = <0x31000 0x4>,
                              <0x31010 0x4>,
                              <0x31014 0x4>;
 
                target-module@86000 {                   /* 0x44e86000, ap 40 70.0 */
                        compatible = "ti,sysc-omap2", "ti,sysc";
-                       ti,hwmods = "counter_32k";
                        reg = <0x86000 0x4>,
                              <0x86004 0x4>;
                        reg-names = "rev", "sysc";
                        };
                };
 
-               target-module@40000 {                   /* 0x48040000, ap 18 1e.0 */
+               timer2_target: target-module@40000 {    /* 0x48040000, ap 18 1e.0 */
                        compatible = "ti,sysc-omap4-timer", "ti,sysc";
-                       ti,hwmods = "timer2";
                        reg = <0x40000 0x4>,
                              <0x40010 0x4>,
                              <0x40014 0x4>;
index cce9523eaa779b897d6ead8ec5ae42786e8b28c8..fa299e09730d84de7d220700ca3745dde8b8c52c 100644 (file)
@@ -308,7 +308,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
        .init_late      = am43xx_init_late,
        .init_irq       = omap_gic_of_init,
        .init_machine   = omap_generic_init,
-       .init_time      = omap3_gptimer_timer_init,
+       .init_time      = omap_init_time_of,
        .dt_compat      = am43_boards_compat,
        .restart        = omap44xx_restart,
 MACHINE_END
index fa2ff41f84b9d440e5a5d7c080cd9c25dcc67a22..5f4ab24dd60d8b82b3949eda7f174f48a33bead5 100644 (file)
@@ -44,8 +44,6 @@ extern struct omap_hwmod am33xx_smartreflex0_hwmod;
 extern struct omap_hwmod am33xx_smartreflex1_hwmod;
 extern struct omap_hwmod am33xx_gpmc_hwmod;
 extern struct omap_hwmod am33xx_rtc_hwmod;
-extern struct omap_hwmod am33xx_timer1_hwmod;
-extern struct omap_hwmod am33xx_timer2_hwmod;
 
 extern struct omap_hwmod_class am33xx_emif_hwmod_class;
 extern struct omap_hwmod_class am33xx_l4_hwmod_class;
index 0ebbfbb4fb1c151ab0f0bc8624aaba0ea25b92dc..b389d6589c32f53ffc584938b27b21920c2c86dd 100644 (file)
@@ -106,14 +106,6 @@ struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
        .user           = OCP_USER_MPU,
 };
 
-/* l4 per -> timer2 */
-struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = {
-       .master         = &am33xx_l4_ls_hwmod,
-       .slave          = &am33xx_timer2_hwmod,
-       .clk            = "l4ls_gclk",
-       .user           = OCP_USER_MPU,
-};
-
 /* l3 main -> ocmc */
 struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = {
        .master         = &am33xx_l3_main_hwmod,
index 99c63333848827f0de5aa6caebb83bcf23e6097e..4b3cd590fb5225b46fcf8edb26b5ab722c105c5c 100644 (file)
@@ -307,64 +307,6 @@ struct omap_hwmod am33xx_rtc_hwmod = {
        },
 };
 
-/* 'timer 2-7' class */
-static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0014,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-                         SYSC_HAS_RESET_STATUS,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
-                         SIDLE_SMART_WKUP),
-       .sysc_fields    = &omap_hwmod_sysc_type2,
-};
-
-struct omap_hwmod_class am33xx_timer_hwmod_class = {
-       .name           = "timer",
-       .sysc           = &am33xx_timer_sysc,
-};
-
-/* timer1 1ms */
-static struct omap_hwmod_class_sysconfig am33xx_timer1ms_sysc = {
-       .rev_offs       = 0x0000,
-       .sysc_offs      = 0x0010,
-       .syss_offs      = 0x0014,
-       .sysc_flags     = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
-                       SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
-                       SYSS_HAS_RESET_STATUS),
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class am33xx_timer1ms_hwmod_class = {
-       .name           = "timer",
-       .sysc           = &am33xx_timer1ms_sysc,
-};
-
-struct omap_hwmod am33xx_timer1_hwmod = {
-       .name           = "timer1",
-       .class          = &am33xx_timer1ms_hwmod_class,
-       .clkdm_name     = "l4_wkup_clkdm",
-       .main_clk       = "timer1_fck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-struct omap_hwmod am33xx_timer2_hwmod = {
-       .name           = "timer2",
-       .class          = &am33xx_timer_hwmod_class,
-       .clkdm_name     = "l4ls_clkdm",
-       .main_clk       = "timer2_fck",
-       .prcm           = {
-               .omap4  = {
-                       .modulemode     = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
 static void omap_hwmod_am33xx_clkctrl(void)
 {
        CLKCTRL(am33xx_smartreflex0_hwmod,
@@ -397,12 +339,10 @@ void omap_hwmod_am33xx_reg(void)
 
 static void omap_hwmod_am43xx_clkctrl(void)
 {
-       CLKCTRL(am33xx_timer2_hwmod, AM43XX_CM_PER_TIMER2_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex0_hwmod,
                AM43XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_smartreflex1_hwmod,
                AM43XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET);
-       CLKCTRL(am33xx_timer1_hwmod, AM43XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_rtc_hwmod, AM43XX_CM_RTC_RTC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_gpmc_hwmod, AM43XX_CM_PER_GPMC_CLKCTRL_OFFSET);
        CLKCTRL(am33xx_l4_ls_hwmod, AM43XX_CM_PER_L4LS_CLKCTRL_OFFSET);
index d2203f44af88a66eeee66a6a3d51e9840e249098..3f338732ee6c58820d9a76e26a9b59de91ec727b 100644 (file)
@@ -85,34 +85,6 @@ static struct omap_hwmod am43xx_control_hwmod = {
        },
 };
 
-static struct omap_hwmod_class_sysconfig am43xx_synctimer_sysc = {
-       .rev_offs       = 0x0,
-       .sysc_offs      = 0x4,
-       .sysc_flags     = SYSC_HAS_SIDLEMODE,
-       .idlemodes      = (SIDLE_FORCE | SIDLE_NO),
-       .sysc_fields    = &omap_hwmod_sysc_type1,
-};
-
-static struct omap_hwmod_class am43xx_synctimer_hwmod_class = {
-       .name   = "synctimer",
-       .sysc   = &am43xx_synctimer_sysc,
-};
-
-static struct omap_hwmod am43xx_synctimer_hwmod = {
-       .name           = "counter_32k",
-       .class          = &am43xx_synctimer_hwmod_class,
-       .clkdm_name     = "l4_wkup_aon_clkdm",
-       .flags          = HWMOD_SWSUP_SIDLE,
-       .main_clk       = "synctimer_32kclk",
-       .prcm = {
-               .omap4 = {
-                       .clkctrl_offs = AM43XX_CM_WKUP_SYNCTIMER_CLKCTRL_OFFSET,
-                       .modulemode   = MODULEMODE_SWCTRL,
-               },
-       },
-};
-
-
 static struct omap_hwmod_class_sysconfig am43xx_usb_otg_ss_sysc = {
        .rev_offs       = 0x0000,
        .sysc_offs      = 0x0010,
@@ -206,20 +178,6 @@ static struct omap_hwmod_ocp_if am43xx_l4_wkup__control = {
        .user           = OCP_USER_MPU,
 };
 
-static struct omap_hwmod_ocp_if am43xx_l4_wkup__timer1 = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am33xx_timer1_hwmod,
-       .clk            = "sys_clkin_ck",
-       .user           = OCP_USER_MPU,
-};
-
-static struct omap_hwmod_ocp_if am33xx_l4_wkup__synctimer = {
-       .master         = &am33xx_l4_wkup_hwmod,
-       .slave          = &am43xx_synctimer_hwmod,
-       .clk            = "sys_clkin_ck",
-       .user           = OCP_USER_MPU,
-};
-
 static struct omap_hwmod_ocp_if am43xx_l3_s__usbotgss0 = {
        .master         = &am33xx_l3_s_hwmod,
        .slave          = &am43xx_usb_otg_ss0_hwmod,
@@ -235,7 +193,6 @@ static struct omap_hwmod_ocp_if am43xx_l3_s__usbotgss1 = {
 };
 
 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
-       &am33xx_l4_wkup__synctimer,
        &am33xx_mpu__l3_main,
        &am33xx_mpu__prcm,
        &am33xx_l3_s__l4_ls,
@@ -252,8 +209,6 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
        &am43xx_l4_wkup__control,
        &am43xx_l4_wkup__smartreflex0,
        &am43xx_l4_wkup__smartreflex1,
-       &am43xx_l4_wkup__timer1,
-       &am33xx_l4_ls__timer2,
        &am33xx_l3_s__gpmc,
        &am33xx_l3_main__ocmc,
        &am43xx_l3_s__usbotgss0,