From: Hosung Kim Date: Wed, 24 Jan 2018 13:31:54 +0000 (+0900) Subject: [COMMON] clocksource: arm_arch_timer: clocksource only flag for exynos X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=786fb9eabaaf82b0e39277ef7d990da3dc5224ec;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] clocksource: arm_arch_timer: clocksource only flag for exynos 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 --- diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 14e2419063e9..fa4956aa7005 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -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 */