From patchwork Wed Jun 26 14:46:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 167822 Delivered-To: patch@linaro.org Received: by 2002:ac9:6410:0:0:0:0:0 with SMTP id r16csp871339ock; Wed, 26 Jun 2019 07:48:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkPQwxcxOSm5gTwNCVpv4CF8CAcHxmkrJbgfSJS8OTG4AOPIw0A+XJ3zyhfS+0Cjz+RVny X-Received: by 2002:a17:902:b284:: with SMTP id u4mr6159317plr.36.1561560484763; Wed, 26 Jun 2019 07:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561560484; cv=none; d=google.com; s=arc-20160816; b=wtQfmPLT7psXsVHvCrta9Nmlw9kX92LJ4Si8hlswfygQKaFmf0HmKQyLi4EwJ9E/v1 /ZnQf1RqItA/WVhE35jB74n0T9/puv7YiwurRuZyNPsbDeXWayNgEp9NVunzPnMRY9Oc QwtNFqxv3kZ4Rh8STkmug95yptI+EaEw8ie07OU0DrhSoxWOAC6H564y9XVp95qeNbhH GXix72zRTe6zPDURw7RTxKtm5gx3MnJSubyhCWVLQHGSgvF+HTsHKNZJyR3I/td6bVSu ZN5wDLaaOft5LCyIrNF+JbI7RWWwW1n71GjUNNDj4PXtlrQ62KyklF+HMiCjLLyjKsIv IZGg== 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; bh=nq1XbTkt1vTkv4HhT7D+cz8CUmDBD84eY2DPwK+R49I=; b=Bw2+7v/SCckjqPIfFFvxL3U5hGyUSR/K0eS6N3+vZIkN2fNe2qhg7zgasLX1Af3jPR GBVuQvcwckZhBswDAa1mL8AuDFd/cxY3WTZwuXwfopJUdJR+m9fGgccgt6jsQZVRgv+C uljeDysjs6t2mhDSAziYeMDWVttFYUQup34yDDC2cMDczIM70GdwV/g0oJgs4K9k/kP5 /kLEEuy3GBzto7ebqodyBtLwrzYD3f3WmlpzQf8Ci1zm5vDpU5DZFtYzBUMJwXNvQLRy qpsGsxEuq6P7HKJYyTQ0lW8Zg6M3SZf6NIvXtTAXjq+NccBHdIfMAx0Jk5suZ7U8pUKi 2QGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hjvzg9a9; 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 u9si16056282pfm.27.2019.06.26.07.48.04; Wed, 26 Jun 2019 07:48:04 -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=hjvzg9a9; 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 S1728421AbfFZOsA (ORCPT + 30 others); Wed, 26 Jun 2019 10:48:00 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55375 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728382AbfFZOrw (ORCPT ); Wed, 26 Jun 2019 10:47:52 -0400 Received: by mail-wm1-f66.google.com with SMTP id a15so2401664wmj.5 for ; Wed, 26 Jun 2019 07:47:51 -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=nq1XbTkt1vTkv4HhT7D+cz8CUmDBD84eY2DPwK+R49I=; b=hjvzg9a9a0GenL06gSEprpW5hS+B+44Q/gkHp+AUPMnoLW1Bd05iBosXOcZ1GGfuxp WPTDCKLDCOMesFSuks/dgz8jra2jLk7kiD4Vqen8neczpsp4q6FrKNyFeEp0C+uTAe6j 2Zi52MITdf4b6wUq2zeEwfI7dzy4PAlW9qpYa15Wi9tH5qfIyIukx8f2t/+fJhmAPMsM 6wT5N8qDxTetD43SLjJFvuWQsIjygRQ/9UJw6v/8UKz8lWKvxNj4F3/h1nckZ4BKKSAj W3JEHme142is+z+CQzKpOiD25ypNIxDrQI5UPw5rjI3dNkDUzuK0SixBohvRtoeffTm8 yYnw== 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=nq1XbTkt1vTkv4HhT7D+cz8CUmDBD84eY2DPwK+R49I=; b=PttfiAluONSSHeIZOVvEwyCvedSPFkIah/junF4DHI+IPBVX+LCb2GnolEC1PC7/pb SW4tD1QLZ9hAiD2+SaNdPv6n6E1rUlO+8b4OaH1pwisfOCUPNmGzRRkCEHMgoD0m7pml TGGz5MZNw3lVdwnJ6gSGdmLOMYqhzOBfcCS1CL9LLhcT3zVwzHJxcK0x2aQHRvT2NtM9 7G3ZniLgIKj8v31rcgks/RYnyEocPlLG+56DEZ4VJEuwmZyBpvmuqSPiqw+hPbyKCPYW olMfwyHoj6BrRDSWIh4s62HpkoB32KtDIzkJGdRu66U12dRCmI9nOB/J79AJq+gEyBNs kC9w== X-Gm-Message-State: APjAAAWyu1gNmsls7zDgGcopVtF21pn50oXPQNpeTAMzGVcTAxzTvm6w oLsei1VgzunouAOFb9g80TCg/GfiqjI= X-Received: by 2002:a1c:1d83:: with SMTP id d125mr2999871wmd.63.1561560470791; Wed, 26 Jun 2019 07:47:50 -0700 (PDT) Received: from mai.imgcgcw.net (26.92.130.77.rev.sfr.net. [77.130.92.26]) by smtp.gmail.com with ESMTPSA id h84sm2718557wmf.43.2019.06.26.07.47.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 07:47:50 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Dmitry Osipenko , Jon Hunter , Thierry Reding , Thierry Reding , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH 23/25] clocksource/drivers/tegra: Set up maximum-ticks limit properly Date: Wed, 26 Jun 2019 16:46:49 +0200 Message-Id: <20190626144651.16742-23-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190626144651.16742-1-daniel.lezcano@linaro.org> References: <20190626144651.16742-1-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko Tegra's timer has 29 bits for the counter and for the "load" register which sets counter to a load-value. The counter's value is lower than the actual value by 1 because it starts to decrement after one tick, hence the maximum number of ticks that hardware can handle equals to 29 bits + 1. Signed-off-by: Dmitry Osipenko Acked-by: Jon Hunter Acked-by: Thierry Reding Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-tegra.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c index a907e71065bd..e9635c25eef4 100644 --- a/drivers/clocksource/timer-tegra.c +++ b/drivers/clocksource/timer-tegra.c @@ -139,9 +139,17 @@ static int tegra_timer_setup(unsigned int cpu) irq_force_affinity(to->clkevt.irq, cpumask_of(cpu)); enable_irq(to->clkevt.irq); + /* + * Tegra's timer uses n+1 scheme for the counter, i.e. timer will + * fire after one tick if 0 is loaded and thus minimum number of + * ticks is 1. In result both of the clocksource's tick limits are + * higher than a minimum and maximum that hardware register can + * take by 1, this is then taken into account by set_next_event + * callback. + */ clockevents_config_and_register(&to->clkevt, timer_of_rate(to), 1, /* min */ - 0x1fffffff); /* 29 bits */ + 0x1fffffff + 1); /* max 29 bits + 1 */ return 0; }