From patchwork Mon Jan 8 13:28:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 10149621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C528B602CA for ; Mon, 8 Jan 2018 13:35:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8D7521BED for ; Mon, 8 Jan 2018 13:35:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ACEC2841E; Mon, 8 Jan 2018 13:35:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 198F521BED for ; Mon, 8 Jan 2018 13:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=u8dpC/yXDVI0ogCYTln1AzyjGbYv4oZNqhTw6wRiUi8=; b=DUK7UZG3tV3mrU7FovnnnFgW8v 8BevX5EpCmpzcyV8Jr5ED90VAKLc7bVyUcr6LfpHR2uVPNWhzYkGkeKW6Nhh/sd+ZHjfDizG1y7T9 0ZFwQbKIWFkJQBE8TnS9F66qw42uPI+R8bGT2Hf9yZfre853r9T4FShZVJQY93bWM7UVynLGtZKCZ Y+o59h2U1bKs/VXz3wqAQElFTBXe6hNZugMtsKKgoNl3+F/yUF9q2P+6ERVuI9p8twu7vziDzUmKO 6OfKKyaitFHI4mTDCtE8zydj8sVQtih/VhspayCqgucTnXtZfmo7XlgSXaTNK852wV+sHfQBp0wev nYCcUojw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYXZr-0007fX-Qt; Mon, 08 Jan 2018 13:34:59 +0000 Received: from mail-wm0-f66.google.com ([74.125.82.66]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYXVB-0003S9-At for linux-arm-kernel@lists.infradead.org; Mon, 08 Jan 2018 13:30:52 +0000 Received: by mail-wm0-f66.google.com with SMTP id b141so14214632wme.1 for ; Mon, 08 Jan 2018 05:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=li+kAXda59gUq6am3TC/ClLS6dgrh+RZG4z+TgzncBc=; b=SjDyX058YqfvNhbGuC80VM0WEgfK0M7hgKS8uN26SjQT6ZhNrLs06JJC2/iTNWJQJz Iz6MWd1jDOIJUNVDto98wl7EIA9uBdduP14kYe16OrbQJD/NO+4V2846hllqSbsbMXXx 3mD8fz6WLdPPTBO30rzE6UBOgxlgOnCLtDmcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=li+kAXda59gUq6am3TC/ClLS6dgrh+RZG4z+TgzncBc=; b=d9Botqcs4OjXCZ+q1/tPiGYH87sDhliIyx4/ix8la8cqcINkSQmCO/5R6HgCgFZUpP iQ0dzvzD7t/m9JEEUWQwz3sbQ48B2ub3llmynIRDUkkVhJd3UvEQrT/lmGQoDA+bOUYz Fjf7rkPem8vrY2YfyGNG03ba3zIzJCAl7Fro3z9gSWWtij+i6+X/vBoq56AxTsvZTW/B bYc2ff7BwIa8DoQn/u/G3N1DI5NOBgLbpeWMQIz5IymTDdIc7dLvXJVo9kh94y2AjCSu TpWM281BkR67zof1QDGEVo3eIerU7nqH4RvLp8qlWhF2C4JUPfkEZ9M/eggUfkvARtza Ab0Q== X-Gm-Message-State: AKGB3mLNKoggWzRXzPFbNilAqWK7vMFtITZO7cJKmqKWGQx+5L40UJY4 HucE8m0kJlGUZMkaSa6viS9mR2XPAkw= X-Google-Smtp-Source: ACJfBov77XzmGmfgsCPegbctdGtVhdzRZTmjStCbwm2KfRTbwa3Upr8HCaRlX50KI8Qpb0i985JvTw== X-Received: by 10.28.51.70 with SMTP id z67mr9624694wmz.78.1515418197047; Mon, 08 Jan 2018 05:29:57 -0800 (PST) Received: from mai.lan ([2001:41d0:fe90:b800:312a:53a5:1bef:6622]) by smtp.gmail.com with ESMTPSA id q196sm14354222wmb.22.2018.01.08.05.29.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 05:29:56 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 19/20] clocksource/drivers/stm32: Add the timer delay Date: Mon, 8 Jan 2018 14:28:58 +0100 Message-Id: <1515418139-23276-19-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515418139-23276-1-git-send-email-daniel.lezcano@linaro.org> References: <1bbaef2e-4080-3f54-7db3-a8989acfd691@free.fr> <1515418139-23276-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180108_053010_187547_4A9C66DE X-CRM114-Status: GOOD ( 10.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "moderated list:ARM/STM32 ARCHITECTURE" , Alexandre Torgue , linux-kernel@vger.kernel.org, Maxime Coquelin , Benjamin Gaignard MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add the timer delay, that saves us ~90ms of boot time. Signed-off-by: Daniel Lezcano Tested-by: Benjamin Gaignard Acked-by: Benjamin Gaignard --- 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 4634f4d..dcf8445 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,