[COMMON] clocksource: arm_arch_timer: clocksource only flag for exynos
authorHosung Kim <hosung0.kim@samsung.com>
Wed, 24 Jan 2018 13:31:54 +0000 (22:31 +0900)
committerJaehyoung Choi <jkkkkk.choi@samsung.com>
Wed, 2 May 2018 02:14:39 +0000 (11:14 +0900)
This commit adds the specific flag for using clocksource only in exynos.
It is so specific flag for exynos because exynos uses special power
feature for cpu on/off in the short time we called it c2 mode.

In exynos SoC, clocksource is used as arm_arch_timer and clockevent
is used as exynos_mct.

Change-Id: I411ea46d0f8997e3507adc7e60cb8996507e025b
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
drivers/clocksource/arm_arch_timer.c

index 14e2419063e93aed0c95532e763f87220b0eaedf..fa4956aa7005c624817843207eff345096a55b28 100644 (file)
@@ -76,6 +76,7 @@ static bool arch_timer_c3stop;
 static bool arch_timer_mem_use_virtual;
 static bool arch_counter_suspend_stop;
 static bool vdso_default = true;
+static bool arch_timer_use_clocksource_only;
 
 static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
 
@@ -804,6 +805,14 @@ static int arch_timer_starting_cpu(unsigned int cpu)
        struct clock_event_device *clk = this_cpu_ptr(arch_timer_evt);
        u32 flags;
 
+       /*
+        * if arch_timer is used to clocksource only,
+        * it doesn't need to setup clockevent configuration.
+        * this is only for exynos soc
+        */
+       if (arch_timer_use_clocksource_only)
+               goto skip_clockevent_setup;
+
        __arch_timer_setup(ARCH_TIMER_TYPE_CP15, clk);
 
        flags = check_ppi_trigger(arch_timer_ppi[arch_timer_uses_ppi]);
@@ -815,6 +824,7 @@ static int arch_timer_starting_cpu(unsigned int cpu)
                                  flags);
        }
 
+skip_clockevent_setup:
        arch_counter_set_user_access();
        if (evtstrm_enable)
                arch_timer_configure_evtstream();
@@ -929,7 +939,17 @@ static int arch_timer_dying_cpu(unsigned int cpu)
 {
        struct clock_event_device *clk = this_cpu_ptr(arch_timer_evt);
 
+       /*
+        * If arch_timer is used to clocksource only,
+        * it doesn't need to setup clockevent configuration.
+        * This is only for Exynos SoC
+        */
+       if (arch_timer_use_clocksource_only)
+               goto skip_clockevent_setup;
+
        arch_timer_stop(clk);
+
+skip_clockevent_setup:
        return 0;
 }
 
@@ -1165,6 +1185,12 @@ static int __init arch_timer_of_init(struct device_node *np)
        rate = arch_timer_get_cntfrq();
        arch_timer_of_configure_rate(rate, np);
 
+       /* Exynos Specific Device Tree Information */
+       if (of_property_read_bool(np, "use-clocksource-only")) {
+               pr_info("%s: arch_timer is used only clocksource\n", __func__);
+               arch_timer_use_clocksource_only = true;
+       }
+
        arch_timer_c3stop = !of_property_read_bool(np, "always-on");
 
        /* Check for globally applicable workarounds */