From patchwork Mon Oct 2 15:51:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114620 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp828303qgn; Mon, 2 Oct 2017 08:52:19 -0700 (PDT) X-Received: by 10.98.77.66 with SMTP id a63mr3733496pfb.281.1506959539289; Mon, 02 Oct 2017 08:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506959539; cv=none; d=google.com; s=arc-20160816; b=xxxahmT7aI+U4j3s0sv5vEDLDtqzIpb3AHmZsrtl3PWcwy0ycqtFD8T8/6B28cyAi2 d3mii1fvbJZCkXyTrSq9bH+kfAFNFem6+CVVtT2wveuIRwrLG2KOlUcdzK9GH/GcTiV+ uJr2LQDBDgWqoVOXj43keA9O9N3ZzqjLPrA6aO+0ePizYCmxIvTc4mB42ki9yid5Zym9 ZwptmKlaAl9RvxKEOz7j1QAB6sV4PX8ESAgn5OFsXmBxnJUssWpEKvA8hK6VSLi1jQk+ 1tzFiDBxIFO1n5q40WyoZ7bMSX6wbozL5cy5nYqHz6KmWfRqT6VuIBsFpqHbEJ7hbh9Z aBdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=mMuQ6qO1IcwKkpka3h0Rm/dj/E+uiuwXEwBkem7O6g4=; b=x1rwQPprnALv2GQfPP24jsay6B4uXbsxDonDjfLkxYLlQRL3nUaeoqwnodrSTLoEXd 0TBYzn8/HB0yhke+DEmD6xXMZtNu1cI+DXR+64QoEKlGVRB8MpWyJ+GfLgKHZw1MLiwD IYcJ5aPB0ehF/+tIdE+hB/KlZhO6Oepn2Kya0+qOZZx9a7oo7vHGSAhm4tlNbCWOnks+ 13tTVmRoW3w3mxm5trF2cFMdiLSlDpekOlFC1m6anESUY7l7IgK1zNfeQCJq9Q69s85O p8lU/8RRsXGiM38yJy9wyNGcyZJmljp51M/ae2KbxTn5W6QqbGSCiu2LdOyEILnrigod MzUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=drRWB7zc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9si4046763pgp.132.2017.10.02.08.52.19; Mon, 02 Oct 2017 08:52:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=drRWB7zc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbdJBPwQ (ORCPT + 26 others); Mon, 2 Oct 2017 11:52:16 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:53236 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbdJBPwN (ORCPT ); Mon, 2 Oct 2017 11:52:13 -0400 Received: by mail-wr0-f171.google.com with SMTP id k62so4315929wrc.9 for ; Mon, 02 Oct 2017 08:52:12 -0700 (PDT) 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=mMuQ6qO1IcwKkpka3h0Rm/dj/E+uiuwXEwBkem7O6g4=; b=drRWB7zc5brMLg3EAbuMq7HzUSOkVQkxKPxfmFco7/v0K7JCxWSo6lT8WzckZi0iM4 mEA+NXFLsf2sMHqyxZCmeucF6kUUKRZNR5aNk0N16iCvg2C0qnE48cRBS/DZaRYG13eK TmsgjuaZfUjDKFPL8tWXshgwL3ZMhsfBZkhvQ= 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=mMuQ6qO1IcwKkpka3h0Rm/dj/E+uiuwXEwBkem7O6g4=; b=WSA+7/aNvR5BKZc5bdbb6cuIy8xg2TzPGUEjWp+7Up++8To0sVVeh+soWjfdFMMVQh KAbblMLrYPc7VZpC/YWR80mxTqAMO0omTRm67uAOaRBFXhdIw0PdYS/L8U3faZ77ZQ0R jzo4SaLTTzA3MDjjYkEhRIguZrqSty09FBfswqiRAlTNbeo05laWWPkfg2Se+ZARUbvX UzRWmcKEG+8f+dlK5kzPG77vjwCehmBxhxIZQz17FurrL/NHTvH3BQrDMBjhbboeKKRW l2/EklhRE4aicdnNAZFmZYceEAFnRE/ZkgY+DxrnXCJOe2ThpJRnc+wzXoQdoj5loArS PxfQ== X-Gm-Message-State: AHPjjUgwxN1fCjdKypvjm+I8eX4YISj2aqIjpUSldl/CeSMoewc57o+Z iQlydwZAaBZc/z01zCz6vLjfcQ== X-Google-Smtp-Source: AOwi7QCUWHrUI1pIpfcESLfeddJ6bHPXC0e1ah6msOksBFgnaxBgx5nchuBBDD94xhjveLkvlEPRLQ== X-Received: by 10.223.178.83 with SMTP id y19mr14244724wra.110.1506959531887; Mon, 02 Oct 2017 08:52:11 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.74.152]) by smtp.gmail.com with ESMTPSA id w5sm6724879wrg.65.2017.10.02.08.52.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 08:52:11 -0700 (PDT) From: Benjamin Gaignard To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, daniel.lezcano@linaro.org, tglx@linutronix.de, ludovic.barre@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v4 1/4] clocksource: stm32: convert driver to timer_of Date: Mon, 2 Oct 2017 17:51:50 +0200 Message-Id: <1506959513-16851-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert driver to use timer_of helpers. This allow to remove custom proprietary structure. Signed-off-by: Benjamin Gaignard --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/timer-stm32.c | 162 +++++++++++++------------------------- 2 files changed, 57 insertions(+), 106 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index cc60620..755c0cc 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -289,6 +289,7 @@ config CLKSRC_STM32 bool "Clocksource for STM32 SoCs" if !ARCH_STM32 depends on OF && ARM && (ARCH_STM32 || COMPILE_TEST) select CLKSRC_MMIO + select TIMER_OF config CLKSRC_MPS2 bool "Clocksource for MPS2 SoCs" if COMPILE_TEST diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index 8f24237..abff21c 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -17,6 +17,8 @@ #include #include +#include "timer-of.h" + #define TIM_CR1 0x00 #define TIM_DIER 0x0c #define TIM_SR 0x10 @@ -34,117 +36,84 @@ #define TIM_EGR_UG BIT(0) -struct stm32_clock_event_ddata { - struct clock_event_device evtdev; - unsigned periodic_top; - void __iomem *base; -}; - -static int stm32_clock_event_shutdown(struct clock_event_device *evtdev) +static int stm32_clock_event_shutdown(struct clock_event_device *evt) { - struct stm32_clock_event_ddata *data = - container_of(evtdev, struct stm32_clock_event_ddata, evtdev); - void *base = data->base; + struct timer_of *to = to_timer_of(evt); - writel_relaxed(0, base + TIM_CR1); + writel_relaxed(0, timer_of_base(to) + TIM_CR1); return 0; } -static int stm32_clock_event_set_periodic(struct clock_event_device *evtdev) +static int stm32_clock_event_set_periodic(struct clock_event_device *evt) { - struct stm32_clock_event_ddata *data = - container_of(evtdev, struct stm32_clock_event_ddata, evtdev); - void *base = data->base; + struct timer_of *to = to_timer_of(evt); + + writel_relaxed(timer_of_period(to), timer_of_base(to) + TIM_ARR); + writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, timer_of_base(to) + TIM_CR1); - writel_relaxed(data->periodic_top, base + TIM_ARR); - writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, base + TIM_CR1); return 0; } static int stm32_clock_event_set_next_event(unsigned long evt, - struct clock_event_device *evtdev) + struct clock_event_device *clkevt) { - struct stm32_clock_event_ddata *data = - container_of(evtdev, struct stm32_clock_event_ddata, evtdev); + struct timer_of *to = to_timer_of(clkevt); - writel_relaxed(evt, data->base + TIM_ARR); + writel_relaxed(evt, timer_of_base(to) + TIM_ARR); writel_relaxed(TIM_CR1_ARPE | TIM_CR1_OPM | TIM_CR1_CEN, - data->base + TIM_CR1); + timer_of_base(to) + TIM_CR1); return 0; } static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id) { - struct stm32_clock_event_ddata *data = dev_id; + struct clock_event_device *evt = (struct clock_event_device *)dev_id; + struct timer_of *to = to_timer_of(evt); - writel_relaxed(0, data->base + TIM_SR); + writel_relaxed(0, timer_of_base(to) + TIM_SR); - data->evtdev.event_handler(&data->evtdev); + evt->event_handler(evt); return IRQ_HANDLED; } -static struct stm32_clock_event_ddata clock_event_ddata = { - .evtdev = { - .name = "stm32 clockevent", - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_state_shutdown = stm32_clock_event_shutdown, - .set_state_periodic = stm32_clock_event_set_periodic, - .set_state_oneshot = stm32_clock_event_shutdown, - .tick_resume = stm32_clock_event_shutdown, - .set_next_event = stm32_clock_event_set_next_event, - .rating = 200, - }, -}; - -static int __init stm32_clockevent_init(struct device_node *np) +static int __init stm32_clockevent_init(struct device_node *node) { - struct stm32_clock_event_ddata *data = &clock_event_ddata; - struct clk *clk; struct reset_control *rstc; - unsigned long rate, max_delta; - int irq, ret, bits, prescaler = 1; - - clk = of_clk_get(np, 0); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - pr_err("failed to get clock for clockevent (%d)\n", ret); - goto err_clk_get; - } - - ret = clk_prepare_enable(clk); - if (ret) { - pr_err("failed to enable timer clock for clockevent (%d)\n", - ret); - goto err_clk_enable; - } - - rate = clk_get_rate(clk); - - rstc = of_reset_control_get(np, NULL); + unsigned long max_delta; + int ret, bits, prescaler = 1; + struct timer_of *to; + + to = kzalloc(sizeof(*to), GFP_KERNEL); + if (!to) + return -ENOMEM; + + to->flags = TIMER_OF_IRQ | TIMER_OF_CLOCK | TIMER_OF_BASE; + to->clkevt.name = "stm32_clockevent"; + to->clkevt.rating = 200; + to->clkevt.features = CLOCK_EVT_FEAT_PERIODIC; + to->clkevt.set_state_shutdown = stm32_clock_event_shutdown; + to->clkevt.set_state_periodic = stm32_clock_event_set_periodic; + to->clkevt.set_state_oneshot = stm32_clock_event_shutdown; + to->clkevt.tick_resume = stm32_clock_event_shutdown; + to->clkevt.set_next_event = stm32_clock_event_set_next_event; + + to->of_irq.handler = stm32_clock_event_handler; + + ret = timer_of_init(node, to); + if (ret) + return ret; + + rstc = of_reset_control_get(node, NULL); if (!IS_ERR(rstc)) { reset_control_assert(rstc); reset_control_deassert(rstc); } - data->base = of_iomap(np, 0); - if (!data->base) { - ret = -ENXIO; - pr_err("failed to map registers for clockevent\n"); - goto err_iomap; - } - - irq = irq_of_parse_and_map(np, 0); - if (!irq) { - ret = -EINVAL; - pr_err("%pOF: failed to get irq.\n", np); - goto err_get_irq; - } - /* Detect whether the timer is 16 or 32 bits */ - writel_relaxed(~0U, data->base + TIM_ARR); - max_delta = readl_relaxed(data->base + TIM_ARR); + writel_relaxed(~0U, timer_of_base(to) + TIM_ARR); + max_delta = readl_relaxed(timer_of_base(to) + TIM_ARR); if (max_delta == ~0U) { prescaler = 1; bits = 32; @@ -152,39 +121,20 @@ static int __init stm32_clockevent_init(struct device_node *np) prescaler = 1024; bits = 16; } - writel_relaxed(0, data->base + TIM_ARR); - - writel_relaxed(prescaler - 1, data->base + TIM_PSC); - writel_relaxed(TIM_EGR_UG, data->base + TIM_EGR); - writel_relaxed(TIM_DIER_UIE, data->base + TIM_DIER); - writel_relaxed(0, data->base + TIM_SR); + writel_relaxed(0, timer_of_base(to) + TIM_ARR); - data->periodic_top = DIV_ROUND_CLOSEST(rate, prescaler * HZ); + writel_relaxed(prescaler - 1, timer_of_base(to) + TIM_PSC); + writel_relaxed(TIM_EGR_UG, timer_of_base(to) + TIM_EGR); + writel_relaxed(TIM_DIER_UIE, timer_of_base(to) + TIM_DIER); + writel_relaxed(0, timer_of_base(to) + TIM_SR); - clockevents_config_and_register(&data->evtdev, - DIV_ROUND_CLOSEST(rate, prescaler), - 0x1, max_delta); - - ret = request_irq(irq, stm32_clock_event_handler, IRQF_TIMER, - "stm32 clockevent", data); - if (ret) { - pr_err("%pOF: failed to request irq.\n", np); - goto err_get_irq; - } + clockevents_config_and_register(&to->clkevt, + timer_of_period(to), 0x60, max_delta); pr_info("%pOF: STM32 clockevent driver initialized (%d bits)\n", - np, bits); - - return ret; - -err_get_irq: - iounmap(data->base); -err_iomap: - clk_disable_unprepare(clk); -err_clk_enable: - clk_put(clk); -err_clk_get: - return ret; + node, bits); + + return 0; } TIMER_OF_DECLARE(stm32, "st,stm32-timer", stm32_clockevent_init); From patchwork Mon Oct 2 15:51:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114623 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp828900qgn; Mon, 2 Oct 2017 08:52:59 -0700 (PDT) X-Received: by 10.98.2.16 with SMTP id 16mr4487117pfc.248.1506959579691; Mon, 02 Oct 2017 08:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506959579; cv=none; d=google.com; s=arc-20160816; b=HGJ82+KhgfJBOG8euzQxY9kHxhNp7illaU1lxbg2VXDc+fwnxEvL0nOiTxv1aiBYAm +YFwKWJJ8z6mDWQnBn5ZVtGFxlmGsPkW/EtOwkpserQWmvDelcVtbdSgX66gabxHImaU bsGZU200GBByn2KlNnP1BGG8/i+IzUULzfkTnk/RjmoCKjXAu/NMV/frbkdOC2mU3JnL TqudOKSbI7YM5/jck/odN+qNYs2Bnblo1V0r2rFKrrDUnmIeMKyO9YrSTi/UDewLZUdB MEwEK+BDhbUhPwOki/luPqbVM0dqgNC26Rb4RfMt0xgf0kU5CdSnLf5k/zni78LGydFi SbNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YRMDrn0GKD9HNuTlCPy7fMgZ2opjSCTXVxBYgWeWkDc=; b=dTF5W/EA1H3FtXCcwT47EJ22fruA/xSmSyjAInAtAvrP/NpwrUmMUEgyVfBi1Md7nP V5i/pwXorhqG/Ly6uLqbM3WgDCmXVPk0GijSf8fSeRFuEoTzNIizz9s2wTkDw+ONo/p1 efBM+Dzy4JhC3pYfNjla4tHj/jD8fm1m1DJPpG4RtHllfazgGZB/NHzTjaUc8IoK/kFv AQhZ3pk9mluggQSz87hr9SfFrt82PoyAbaZ/OdaR0X2Nc2ed/I9BrvtRUcWwYncARdZ/ pQJJLK9C06GS9r3wN+VudPL7QDKZIgrHstDF6yplj+thY62qnJurhNkM7O4120RXpXPw xg7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QcBGpO18; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si4176393pfd.376.2017.10.02.08.52.59; Mon, 02 Oct 2017 08:52:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QcBGpO18; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752025AbdJBPw5 (ORCPT + 26 others); Mon, 2 Oct 2017 11:52:57 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:49994 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751916AbdJBPwP (ORCPT ); Mon, 2 Oct 2017 11:52:15 -0400 Received: by mail-wr0-f169.google.com with SMTP id p10so2513978wrc.6 for ; Mon, 02 Oct 2017 08:52:15 -0700 (PDT) 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=YRMDrn0GKD9HNuTlCPy7fMgZ2opjSCTXVxBYgWeWkDc=; b=QcBGpO18uLTrmGNxyu5R8iW7q8EQhN32jlGYOlsHTUWMHKGJAYXyMfb4RbKj6gexcn uZFnIBtREkKUOMFRouie+Q8DlydoD6aUBACIFeh+Uatjs61XlcYz5QLWM6w3MrnsudIw N2evfEXqh8jIB272B1l3Q7hExMLYQ98W1APB0= 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=YRMDrn0GKD9HNuTlCPy7fMgZ2opjSCTXVxBYgWeWkDc=; b=r1em8vQV/S4vB5r6Xkw77znvQ0f6wF7YgFfWD1uAUIpRScuaT7wuvxjBi4a11c9pyD MtbcjRQPrCpJ6pZyeQ71c7LFKbMNqjS96UXPZC1ff+yCep9O09ebWnilKnpdrz5CUhca If4bogZ8uS1z5vI+2XInyDaJwbHMVvN/1TL2BdXjuY5GuNG4QjMfjMttTCrRIi0SeHsB RdD7mh47pXJMLt3b4xzQTNlVI3/HwEFR7prV8jIszgmzCgDwXwbYv3AVEpuFDHPQM27D yitd9wJEevqbp4xWZKTmpL8P4atG9n2ew0sNg3mNhIaFzMCQLpgH8+am0EKfS0Z2eg4l NTRw== X-Gm-Message-State: AHPjjUjvaDK1tVPAHDYqWje7/72+InPiXTioUGZ7nX/vFTTTYB4mauf9 GfjmYvefPJpXZgqSMtV1MGYUQxwJbFk= X-Google-Smtp-Source: AOwi7QCtMuIvO4Og+A0zgrAj3kpg0SRD/odDDGZZDyOXt1WkRvGprW7norKltzF9v33GyX8oueZ2GQ== X-Received: by 10.223.132.101 with SMTP id 92mr14625474wrf.85.1506959534338; Mon, 02 Oct 2017 08:52:14 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.74.152]) by smtp.gmail.com with ESMTPSA id w5sm6724879wrg.65.2017.10.02.08.52.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 08:52:13 -0700 (PDT) From: Benjamin Gaignard To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, daniel.lezcano@linaro.org, tglx@linutronix.de, ludovic.barre@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v4 2/4] clocksource: stm32: only use 32 bits timers Date: Mon, 2 Oct 2017 17:51:51 +0200 Message-Id: <1506959513-16851-3-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 16 bits hardware are not enough accure to be used. Do no allow them to be probed by tested max counter value. Signed-off-by: Benjamin Gaignard --- drivers/clocksource/timer-stm32.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index abff21c..f7e4eec 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -81,9 +81,9 @@ static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id) static int __init stm32_clockevent_init(struct device_node *node) { struct reset_control *rstc; - unsigned long max_delta; - int ret, bits, prescaler = 1; + unsigned long max_arr; struct timer_of *to; + int ret; to = kzalloc(sizeof(*to), GFP_KERNEL); if (!to) @@ -113,26 +113,21 @@ static int __init stm32_clockevent_init(struct device_node *node) /* Detect whether the timer is 16 or 32 bits */ writel_relaxed(~0U, timer_of_base(to) + TIM_ARR); - max_delta = readl_relaxed(timer_of_base(to) + TIM_ARR); - if (max_delta == ~0U) { - prescaler = 1; - bits = 32; - } else { - prescaler = 1024; - bits = 16; + max_arr = readl_relaxed(timer_of_base(to) + TIM_ARR); + if (max_arr != ~0U) { + pr_err("32 bits timer is needed\n"); + return -EINVAL; } + writel_relaxed(0, timer_of_base(to) + TIM_ARR); - writel_relaxed(prescaler - 1, timer_of_base(to) + TIM_PSC); + writel_relaxed(0, timer_of_base(to) + TIM_PSC); writel_relaxed(TIM_EGR_UG, timer_of_base(to) + TIM_EGR); writel_relaxed(TIM_DIER_UIE, timer_of_base(to) + TIM_DIER); writel_relaxed(0, timer_of_base(to) + TIM_SR); clockevents_config_and_register(&to->clkevt, - timer_of_period(to), 0x60, max_delta); - - pr_info("%pOF: STM32 clockevent driver initialized (%d bits)\n", - node, bits); + timer_of_period(to), 0x60, ~0U); return 0; } From patchwork Mon Oct 2 15:51:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114621 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp828393qgn; Mon, 2 Oct 2017 08:52:25 -0700 (PDT) X-Received: by 10.84.230.134 with SMTP id e6mr14610632plk.46.1506959544997; Mon, 02 Oct 2017 08:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506959544; cv=none; d=google.com; s=arc-20160816; b=0UwxFzBBNmdNpa8TyotB/k3WdVpNLcXjHfnhOHGmbD4ZvDrD2wgzV0W0/p902+Sqp9 pSXubgz//gOSTYPCfRxk9baHhpevTf3ZyrgYI1BdoxXUjmcC8u6WtzDt0TeSZ0DWOgVO Cskutsh9IxAZYDugtx5mLjLYsjuC7GgJmXYhu7PGjQw/4H4OSMtqLv3S0+7Cu/Ibe7BT qGu9/ajETwR+YUxzgkw6uSKsRlItw/uUH3YTTszeTrp2MMQuDeOG/wctFkZDHHYSnMaZ Evl3s+3wJlwTaj7OuE80QHnH3DXXKqgxK0jGB95f0djsmHEm1vJTSzPjJUGXtoV9d2iO HmBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6JH4Hn7ZCjUX0f12s9LItjzS3ACqz7dGI7sGncsOL7o=; b=bodSXUKEXnwGeh/894UZBJ5TGTzNlZnyIiiSWERAWIIseJkpLzh4xxQ6RqdFZpyGCO R0pe0Uj2mbgEr7VZeIuBsaI1zaCUQwZvczuGiy4NysPUpCCtTgudMUCprTkMgBOHjV5p 6kWSLNsBIYcRMWqeUQBid6ssI0WAIjpEC1e8DT0IZOrYl7z+KE/J9lkvbHiTZrsp98jL CgmMyy5RCSX9gp96KiwJP+kPYfHWQOpYNqjxjDFeFcfRxTOnjeJeTwWxPoOjNmGHJj0F ABrJuDzfwcf76mucSbJsTkwKbXzzo38Y1tnTQElcSHPdA2ycXhPzxOoMQJOFo5478+pm QbkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ADuRWyMG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si2977129pgc.595.2017.10.02.08.52.24; Mon, 02 Oct 2017 08:52:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ADuRWyMG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751986AbdJBPwV (ORCPT + 26 others); Mon, 2 Oct 2017 11:52:21 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:48355 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdJBPwS (ORCPT ); Mon, 2 Oct 2017 11:52:18 -0400 Received: by mail-wm0-f45.google.com with SMTP id i82so9325120wmd.3 for ; Mon, 02 Oct 2017 08:52:17 -0700 (PDT) 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=6JH4Hn7ZCjUX0f12s9LItjzS3ACqz7dGI7sGncsOL7o=; b=ADuRWyMG7N2FJYUExchivn9fPQsNUrPQ2lkd2LV7at6UhhYPxmEf/MDRV4q2a/JTVo EQCoiN986wZYpDducMXZ6fYzl1CTIwhFBOxFURzB7irDcBXF9sDl+CTPX+G2ki6512lb FXdgez/SJ9udFY+b55kCyAejmq0g077jqtH3E= 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=6JH4Hn7ZCjUX0f12s9LItjzS3ACqz7dGI7sGncsOL7o=; b=X3oicHbFCJcy8oYg38UeFTPMhmsmG8hogE0c1vI258lQT51Gip/7676GGZRlAUglJu h8hrtpjlUwvruBjSOZ+RJqYti+6eI/1fMs17ugW+JJZVD7JPjZHr0h0hzv8S3E5crGbo kDIKyUQqtPsXkgXw7vjjDskhU48LTsWjWEWmV7X/n2CdLwq54poTttCxSeKFrijxIhMF a9SyO//+8WcEOq6apZPUBkELrD5//3hL2K0joN0Om+m1sgEj/cRd/ej/qfNbxuSohUjO Pc0ttI1fel32hxzMQsn81bYQ0cAw1Bvgc9Td4dtUWfb0xlbEnMlUx7lGMe/QqRUGtDIi Ktcw== X-Gm-Message-State: AHPjjUj2sa2pz+MkfdHS0iyXCdmrDmG2WwESe0jVwtofbHFkV9BmWlz2 +3m3aP9GZOk2QPle6urD7Rcpkw== X-Google-Smtp-Source: AOwi7QDft/dpo5QueLRvazv4jTm9FMMs5dqXisX7yVAVReKTGtD2UU8LJnRWBB4U9EMvzGEYYV7gNw== X-Received: by 10.28.144.206 with SMTP id s197mr12212595wmd.142.1506959537042; Mon, 02 Oct 2017 08:52:17 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.74.152]) by smtp.gmail.com with ESMTPSA id w5sm6724879wrg.65.2017.10.02.08.52.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 08:52:16 -0700 (PDT) From: Benjamin Gaignard To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, daniel.lezcano@linaro.org, tglx@linutronix.de, ludovic.barre@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v4 3/4] clocksource: stm32: add clocksource support Date: Mon, 2 Oct 2017 17:51:52 +0200 Message-Id: <1506959513-16851-4-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rework driver code to be able to implement clocksource and clockevent on the same hardware block. Before this patch only the counter of the hardware block was used to generate clock events. Now counter will be used to provide a 32 bits clock source and a comparator will provide clock events. Signed-off-by: Benjamin Gaignard --- drivers/clocksource/timer-stm32.c | 104 ++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 28 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index f7e4eec..fb84252 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "timer-of.h" @@ -23,16 +25,16 @@ #define TIM_DIER 0x0c #define TIM_SR 0x10 #define TIM_EGR 0x14 +#define TIM_CNT 0x24 #define TIM_PSC 0x28 #define TIM_ARR 0x2c +#define TIM_CCR1 0x34 #define TIM_CR1_CEN BIT(0) -#define TIM_CR1_OPM BIT(3) +#define TIM_CR1_UDIS BIT(1) #define TIM_CR1_ARPE BIT(7) -#define TIM_DIER_UIE BIT(0) - -#define TIM_SR_UIF BIT(0) +#define TIM_DIER_CC1IE BIT(1) #define TIM_EGR_UG BIT(0) @@ -40,30 +42,34 @@ static int stm32_clock_event_shutdown(struct clock_event_device *evt) { struct timer_of *to = to_timer_of(evt); - writel_relaxed(0, timer_of_base(to) + TIM_CR1); + writel_relaxed(0, timer_of_base(to) + TIM_DIER); + return 0; } -static int stm32_clock_event_set_periodic(struct clock_event_device *evt) +static int stm32_clock_event_set_next_event(unsigned long evt, + struct clock_event_device *clkevt) { - struct timer_of *to = to_timer_of(evt); + struct timer_of *to = to_timer_of(clkevt); + unsigned long cnt; - writel_relaxed(timer_of_period(to), timer_of_base(to) + TIM_ARR); - writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, timer_of_base(to) + TIM_CR1); + cnt = readl_relaxed(timer_of_base(to) + TIM_CNT); + writel_relaxed(cnt + evt, timer_of_base(to) + TIM_CCR1); + writel_relaxed(TIM_DIER_CC1IE, timer_of_base(to) + TIM_DIER); return 0; } -static int stm32_clock_event_set_next_event(unsigned long evt, - struct clock_event_device *clkevt) +static int stm32_clock_event_set_periodic(struct clock_event_device *evt) { - struct timer_of *to = to_timer_of(clkevt); + struct timer_of *to = to_timer_of(evt); - writel_relaxed(evt, timer_of_base(to) + TIM_ARR); - writel_relaxed(TIM_CR1_ARPE | TIM_CR1_OPM | TIM_CR1_CEN, - timer_of_base(to) + TIM_CR1); + return stm32_clock_event_set_next_event(timer_of_period(to), evt); +} - return 0; +static int stm32_clock_event_set_oneshot(struct clock_event_device *evt) +{ + return stm32_clock_event_set_next_event(0, evt); } static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id) @@ -73,12 +79,57 @@ static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id) writel_relaxed(0, timer_of_base(to) + TIM_SR); + if (clockevent_state_periodic(evt)) + stm32_clock_event_set_periodic(evt); + else + stm32_clock_event_shutdown(evt); + evt->event_handler(evt); return IRQ_HANDLED; } -static int __init stm32_clockevent_init(struct device_node *node) +static void __init stm32_clockevent_init(struct timer_of *to) +{ + writel_relaxed(0, timer_of_base(to) + TIM_DIER); + writel_relaxed(0, timer_of_base(to) + TIM_SR); + + clockevents_config_and_register(&to->clkevt, + timer_of_rate(to), 0x60, ~0U); +} + +static void __iomem *stm32_timer_cnt __read_mostly; +static u64 notrace stm32_read_sched_clock(void) +{ + return readl_relaxed(stm32_timer_cnt); +} + +static int __init stm32_clocksource_init(struct timer_of *to) +{ + writel_relaxed(~0U, timer_of_base(to) + TIM_ARR); + writel_relaxed(0, timer_of_base(to) + TIM_PSC); + writel_relaxed(0, timer_of_base(to) + TIM_SR); + writel_relaxed(0, timer_of_base(to) + TIM_DIER); + writel_relaxed(0, timer_of_base(to) + TIM_SR); + writel_relaxed(TIM_CR1_ARPE | TIM_CR1_UDIS, + timer_of_base(to) + TIM_CR1); + + /* Make sure that registers are updated */ + writel_relaxed(TIM_EGR_UG, timer_of_base(to) + TIM_EGR); + + /* Enable controller */ + writel_relaxed(TIM_CR1_ARPE | TIM_CR1_UDIS | TIM_CR1_CEN, + timer_of_base(to) + TIM_CR1); + + stm32_timer_cnt = timer_of_base(to) + TIM_CNT; + sched_clock_register(stm32_read_sched_clock, 32, timer_of_rate(to)); + + return clocksource_mmio_init(stm32_timer_cnt, "stm32_timer", + timer_of_rate(to), 250, 32, + clocksource_mmio_readl_up); +} + +static int __init stm32_timer_init(struct device_node *node) { struct reset_control *rstc; unsigned long max_arr; @@ -90,12 +141,13 @@ static int __init stm32_clockevent_init(struct device_node *node) return -ENOMEM; to->flags = TIMER_OF_IRQ | TIMER_OF_CLOCK | TIMER_OF_BASE; + to->clkevt.name = "stm32_clockevent"; to->clkevt.rating = 200; - to->clkevt.features = CLOCK_EVT_FEAT_PERIODIC; + to->clkevt.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC; to->clkevt.set_state_shutdown = stm32_clock_event_shutdown; to->clkevt.set_state_periodic = stm32_clock_event_set_periodic; - to->clkevt.set_state_oneshot = stm32_clock_event_shutdown; + to->clkevt.set_state_oneshot = stm32_clock_event_set_oneshot; to->clkevt.tick_resume = stm32_clock_event_shutdown; to->clkevt.set_next_event = stm32_clock_event_set_next_event; @@ -119,17 +171,13 @@ static int __init stm32_clockevent_init(struct device_node *node) return -EINVAL; } - writel_relaxed(0, timer_of_base(to) + TIM_ARR); - - writel_relaxed(0, timer_of_base(to) + TIM_PSC); - writel_relaxed(TIM_EGR_UG, timer_of_base(to) + TIM_EGR); - writel_relaxed(TIM_DIER_UIE, timer_of_base(to) + TIM_DIER); - writel_relaxed(0, timer_of_base(to) + TIM_SR); + ret = stm32_clocksource_init(to); + if (ret) + return ret; - clockevents_config_and_register(&to->clkevt, - timer_of_period(to), 0x60, ~0U); + stm32_clockevent_init(to); return 0; } -TIMER_OF_DECLARE(stm32, "st,stm32-timer", stm32_clockevent_init); +TIMER_OF_DECLARE(stm32, "st,stm32-timer", stm32_timer_init); From patchwork Mon Oct 2 15:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114622 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp828455qgn; Mon, 2 Oct 2017 08:52:30 -0700 (PDT) X-Received: by 10.99.105.130 with SMTP id e124mr13007854pgc.420.1506959550200; Mon, 02 Oct 2017 08:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506959550; cv=none; d=google.com; s=arc-20160816; b=AQwue+aYiNv1kTHeIzTT6QZ2Ou7yjlmmd9fC1r0ZD9KUwLDSrnlLBKtn5Y3PV/RRQy OZGS4MN2OyYcY1SudCfQtf1wgCxPAsEr8Xoq0WwzK40iL2PTqsUq+tfy2tSyLtVynVyj /1Tq+i/yIn/bY4utZTM2MGYeCbS0vkz4cCrqTq54nBkJ81uwRaR4GvkAT7Qxa3EKuAPk DP8nZywHpEIeDrfww8SbCOwt/I2U/fp+La0poIe3v6TV8wCHkq9NYmSlOXjuXm1xGih8 zSXA4vbljLXzc1ljkQMLDG1MEenl1G5v6RslN/9HRBihiGoN6mAihocC/aKBfxzEtEue Z7ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2xZrvZ3e33zZlEvHpmSdoaik8mhBtquzrft5bq99r4U=; b=PUwFkkZDY4AgSSkrUyyHW48zOaqF0B/lcvEG2/ymGl/qnxo4ps2PkApuZPGRZHAp1Z R+3/ou0CGGrT2bcVMSoF52xRpA1U1nG2uA4bdK9KYcyjIa7mBX7y1e8XpcMEOoc6Ly7R 7orJQpD9vj8CIQq6d0i3KgnMKkKe7UWyXOaj24uDDjbHUAtac4kg5uVk36KI5W850073 WirRA4JgOtu9Zw4fnK1/85DBdKw5UM3yZFOjmfpRs2qHWgWpBDzYkY9LpEbJAsdYUo/B EWSWAXljq4V827XaYtJwUVS35oqZXHSJdchGejHfeYA+NORWQLo5GtvUpDbmAecWgXZA BsWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVd17/mE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b126si2977129pgc.595.2017.10.02.08.52.29; Mon, 02 Oct 2017 08:52:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVd17/mE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751997AbdJBPw1 (ORCPT + 26 others); Mon, 2 Oct 2017 11:52:27 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:43301 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbdJBPwV (ORCPT ); Mon, 2 Oct 2017 11:52:21 -0400 Received: by mail-wm0-f50.google.com with SMTP id m72so7984063wmc.0 for ; Mon, 02 Oct 2017 08:52:20 -0700 (PDT) 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=2xZrvZ3e33zZlEvHpmSdoaik8mhBtquzrft5bq99r4U=; b=FVd17/mESK+6TheJhouEb17Qr/hyjeMFxx1zI4d9Ca7KYbCzz1g39BXe87d2L0V4Fh 3Te/WkykuspfZRh/UbHZglxVFtEMISmgZYGR/dKsVSaKNusq2bMx97pJmP6o1aSKPD5y fsfzXmY/RCYeGFH/0Omtymk7YpyAF9oaxioik= 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=2xZrvZ3e33zZlEvHpmSdoaik8mhBtquzrft5bq99r4U=; b=aFCZJf0qorGQhVrypkxdLbhjZHJYF7AudqXza4/3NQbpudkb/l4MegN5jbQX3HIcN9 +Ckulq8NdP+eJbkTNFbFDhxiXRvnaImF8jS25hrEIn1+4G1SQ7zcgCFL5F/J8gfiqc+n 1e1HczBLj+zJG/GRtQZfyC4F2WUBLSUwgVrmu5L3Kl7OPy+fyEqXDmopDf0CzyRZGr2+ f2xo54uha/xTJuUrJjvSjEePIsmf7z/wfq8n+SMd+qQqIhoUpSt9OeOH7/8lADElJDij GeQAC7rrFUUGTNK27ax6B0sUruzBF/811S7HO2hPSi7XRtfAcaAhx0+f75Qo93J+lJ0/ SVtw== X-Gm-Message-State: AHPjjUgxhX3lACroVQAAijR2nfHaU90sSqBHNtuRCZUdJKvPGVbDyR+W fgEuE5ZzGWVc1E5FrmU0cvNRxw== X-Google-Smtp-Source: AOwi7QB8TZcsYJmGTM5TMZsO4ITvdhndlwqg4XWBiuBhiwEbrEY5XzxoutC8rOHu6BnrtJK0g0W2Tw== X-Received: by 10.28.50.200 with SMTP id y191mr10672940wmy.74.1506959539770; Mon, 02 Oct 2017 08:52:19 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.74.152]) by smtp.gmail.com with ESMTPSA id w5sm6724879wrg.65.2017.10.02.08.52.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 08:52:19 -0700 (PDT) From: Benjamin Gaignard To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, daniel.lezcano@linaro.org, tglx@linutronix.de, ludovic.barre@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH v4 4/4] arm: dts: stm32: remove useless clocksource nodes Date: Mon, 2 Oct 2017 17:51:53 +0200 Message-Id: <1506959513-16851-5-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506959513-16851-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 16 bits timers aren't accurate enough to be used as clocksource, remove them from stm32f4 and stm32f7 devicetree. Signed-off-by: Benjamin Gaignard --- arch/arm/boot/dts/stm32f429.dtsi | 32 -------------------------------- arch/arm/boot/dts/stm32f746.dtsi | 32 -------------------------------- 2 files changed, 64 deletions(-) -- 2.7.4 diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index dd7e99b..ac9a3e6 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -108,14 +108,6 @@ }; }; - timer3: timer@40000400 { - compatible = "st,stm32-timer"; - reg = <0x40000400 0x400>; - interrupts = <29>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM3)>; - status = "disabled"; - }; - timers3: timers@40000400 { #address-cells = <1>; #size-cells = <0>; @@ -137,14 +129,6 @@ }; }; - timer4: timer@40000800 { - compatible = "st,stm32-timer"; - reg = <0x40000800 0x400>; - interrupts = <30>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM4)>; - status = "disabled"; - }; - timers4: timers@40000800 { #address-cells = <1>; #size-cells = <0>; @@ -194,14 +178,6 @@ }; }; - timer6: timer@40001000 { - compatible = "st,stm32-timer"; - reg = <0x40001000 0x400>; - interrupts = <54>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM6)>; - status = "disabled"; - }; - timers6: timers@40001000 { #address-cells = <1>; #size-cells = <0>; @@ -218,14 +194,6 @@ }; }; - timer7: timer@40001400 { - compatible = "st,stm32-timer"; - reg = <0x40001400 0x400>; - interrupts = <55>; - clocks = <&rcc 0 STM32F4_APB1_CLOCK(TIM7)>; - status = "disabled"; - }; - timers7: timers@40001400 { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi index 5633860..a9077e6 100644 --- a/arch/arm/boot/dts/stm32f746.dtsi +++ b/arch/arm/boot/dts/stm32f746.dtsi @@ -82,22 +82,6 @@ status = "disabled"; }; - timer3: timer@40000400 { - compatible = "st,stm32-timer"; - reg = <0x40000400 0x400>; - interrupts = <29>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM3)>; - status = "disabled"; - }; - - timer4: timer@40000800 { - compatible = "st,stm32-timer"; - reg = <0x40000800 0x400>; - interrupts = <30>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM4)>; - status = "disabled"; - }; - timer5: timer@40000c00 { compatible = "st,stm32-timer"; reg = <0x40000c00 0x400>; @@ -105,22 +89,6 @@ clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM5)>; }; - timer6: timer@40001000 { - compatible = "st,stm32-timer"; - reg = <0x40001000 0x400>; - interrupts = <54>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM6)>; - status = "disabled"; - }; - - timer7: timer@40001400 { - compatible = "st,stm32-timer"; - reg = <0x40001400 0x400>; - interrupts = <55>; - clocks = <&rcc 0 STM32F7_APB1_CLOCK(TIM7)>; - status = "disabled"; - }; - rtc: rtc@40002800 { compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>;