Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757AbeAHRiT (ORCPT + 1 other); Mon, 8 Jan 2018 12:38:19 -0500 Received: from terminus.zytor.com ([65.50.211.136]:41675 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753108AbeAHRiQ (ORCPT ); Mon, 8 Jan 2018 12:38:16 -0500 Date: Mon, 8 Jan 2018 09:33:53 -0800 From: tip-bot for Daniel Lezcano Message-ID: Cc: alexandre.torgue@st.com, daniel.lezcano@linaro.org, peterz@infradead.org, mcoquelin.stm32@gmail.com, hpa@zytor.com, torvalds@linux-foundation.org, tglx@linutronix.de, benjamin.gaignard@st.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: benjamin.gaignard@st.com, tglx@linutronix.de, torvalds@linux-foundation.org, mcoquelin.stm32@gmail.com, hpa@zytor.com, peterz@infradead.org, daniel.lezcano@linaro.org, alexandre.torgue@st.com, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <1515418139-23276-19-git-send-email-daniel.lezcano@linaro.org> References: <1515418139-23276-19-git-send-email-daniel.lezcano@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] clocksource/drivers/stm32: Add the timer delay callback Git-Commit-ID: 81abdbbffd69fecdac37fe1d2b44a21227ee23d4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Commit-ID: 81abdbbffd69fecdac37fe1d2b44a21227ee23d4 Gitweb: https://git.kernel.org/tip/81abdbbffd69fecdac37fe1d2b44a21227ee23d4 Author: Daniel Lezcano AuthorDate: Mon, 8 Jan 2018 14:28:58 +0100 Committer: Ingo Molnar CommitDate: Mon, 8 Jan 2018 17:57:26 +0100 clocksource/drivers/stm32: Add the timer delay callback Add the timer delay callback, that saves us ~90ms of boot time. Tested-by: Benjamin Gaignard Signed-off-by: Daniel Lezcano Acked-by: Benjamin Gaignard Cc: Alexandre Torgue Cc: Linus Torvalds Cc: Maxime Coquelin Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1515418139-23276-19-git-send-email-daniel.lezcano@linaro.org Signed-off-by: Ingo Molnar --- drivers/clocksource/timer-stm32.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index 21b7492..c7d1dae 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,13 @@ static u64 notrace stm32_read_sched_clock(void) return readl_relaxed(stm32_timer_cnt); } +static struct delay_timer stm32_timer_delay; + +static unsigned long stm32_read_delay(void) +{ + return readl_relaxed(stm32_timer_cnt); +} + static void stm32_clock_event_disable(struct timer_of *to) { writel_relaxed(0, timer_of_base(to) + TIM_DIER); @@ -230,6 +238,11 @@ static int __init stm32_clocksource_init(struct timer_of *to) stm32_timer_cnt = timer_of_base(to) + TIM_CNT; sched_clock_register(stm32_read_sched_clock, bits, timer_of_rate(to)); pr_info("%s: STM32 sched_clock registered\n", name); + + stm32_timer_delay.read_current_timer = stm32_read_delay; + stm32_timer_delay.freq = timer_of_rate(to); + register_current_timer_delay(&stm32_timer_delay); + pr_info("%s: STM32 delay timer registered\n", name); } return clocksource_mmio_init(timer_of_base(to) + TIM_CNT, name,