From patchwork Tue Nov 14 08:52:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10057203 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 F1CD8601D3 for ; Tue, 14 Nov 2017 08:55:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 085D529083 for ; Tue, 14 Nov 2017 08:55:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F11ED29084; Tue, 14 Nov 2017 08:55:17 +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=unavailable 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 86D7C29081 for ; Tue, 14 Nov 2017 08:55:17 +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=RadCOHfOVjt7ZQMKTjRElWgIpmmNJTtJ30JMJrvAnT4=; b=DbcAIiBHKHpqQvMPOEV/fFEUZh 7DA84vXX0kJ//24HUiuOni5yQoYMKEuJTHekBD+l53Pb60hAgFxPeAgUOCHOsuHq4hERTB/dpeZ9W AbkvUgnfrNMNdXXsgq1AB0RFcHUBONdTgt67Nz5NbwHEdwHQRgyQnvZloTi2jZHjpsX84Bm6Ug2xm c+7EtAL8nF/bdqAH3VE6eYdENMs4d2AZo/aNytn6vHc51eGHVQ02FSFpsXmcmIc8T4eUYNbWeNofB ZmT0SF5GJWInVJ5gugYda2dYztg9609bEGmDK++mVcX4HdrfMRW1uoyNVpyBPpnEuLNaAY4EHdf81 cb8K7dQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eEWzu-0001kH-0z; Tue, 14 Nov 2017 08:55:10 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEWya-0000C5-5n for linux-arm-kernel@lists.infradead.org; Tue, 14 Nov 2017 08:53:57 +0000 Received: by mail-wm0-x244.google.com with SMTP id v186so11166922wma.2 for ; Tue, 14 Nov 2017 00:53:29 -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=IPOdwj6QrGu1gx7nMpbAZwlPQlpdDW1hnIoGbpw7W9E=; b=Tfv2qya1pZ9agEG1lzIv1k7eyIacKP1fsh2qwCI6QUOkaTFUxFLkos0b+rDbV/8WLB tc1whMfAEaYCOztSkR7ulrLonbxmUBALAw+/1HCszfZdaK4eiZ1xYxy6AotCXBRUyVq4 iXZlABLUE947Ckrzd2xwNaxt4sLJZNLkAVnUw= 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=IPOdwj6QrGu1gx7nMpbAZwlPQlpdDW1hnIoGbpw7W9E=; b=i8vRQor6l2LUeDwOwfnzmR7OJH+ZXnIiD96AXYOxnWkWkJ/VP34AZefzD7r9wF2u68 g9L41Mq3RXDYeiZXmwtx5BYMP+zcidctG+c2X0TSuu3x2QcvnfhUE7apw92gOX1t79Gh nKhBB75N7+XH0hQlCn+MijSsGs43hPG2yKNRJCLUsw3mE64n9e0vZKYbY2w1DGAyaBR/ JMXH1rcY0YAulbk7hftgwLccdyI4f98ZcuvWPcJM84VJQWhbnupaNxcVQQ3bRK32pUNM HJE2gyu+T/1br1sfa+SMDbP2sJU60YAYldIJFUHfHq9MfgDuCU64ubBNn1NNczQFmOCW 1FJg== X-Gm-Message-State: AJaThX6rKjKHkOm50O/7ZT8IYGDB90SlNp12bhG7HsTgooPXeF3WNhpW NBnXhVaFqo42dfAFtgM/Su9igw== X-Google-Smtp-Source: AGs4zMaqb8JJwQ96V2WfiX+VBE+Vg8jT4E9ouuLkQxAgSBgOxAZFWRmOc+VChNB+dZqmZDX9WWbJ4g== X-Received: by 10.28.30.2 with SMTP id e2mr8195102wme.36.1510649607832; Tue, 14 Nov 2017 00:53:27 -0800 (PST) Received: from lmecxl0911.lme.st.com ([80.215.205.30]) by smtp.gmail.com with ESMTPSA id g28sm22894551wra.31.2017.11.14.00.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Nov 2017 00:53:27 -0800 (PST) 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, julien.thierry@arm.com, sudeep.holla@arm.com, arnd@arndb.de Subject: [PATCH v8 4/6] clocksource: stm32: only use 32 bits timers Date: Tue, 14 Nov 2017 09:52:41 +0100 Message-Id: <1510649563-22975-5-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510649563-22975-1-git-send-email-benjamin.gaignard@linaro.org> References: <1510649563-22975-1-git-send-email-benjamin.gaignard@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171114_005348_887684_E51B3008 X-CRM114-Status: GOOD ( 13.14 ) 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: devicetree@vger.kernel.org, Benjamin Gaignard , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 The clock driving counters is at 90MHz so the maximum period for 16 bis counters is around 750 ms which is a short period for a clocksource. For 32 bits counters this period is close 47 secondes which is more acceptable. This patch remove 16 bits counters support and makes sure that they won't be probed anymore. Signed-off-by: Benjamin Gaignard --- drivers/clocksource/timer-stm32.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index ae41a19..8173bcf 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -83,9 +83,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) @@ -115,29 +115,27 @@ 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"); + ret = -EINVAL; + goto deinit; } + 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), MIN_DELTA, max_delta); - - pr_info("%pOF: STM32 clockevent driver initialized (%d bits)\n", - node, bits); + timer_of_period(to), MIN_DELTA, ~0U); return 0; +deinit: + timer_of_exit(to); err: kfree(to); return ret;