Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2573218ybi; Mon, 17 Jun 2019 07:06:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKkzDkJXFuZ2GooPBNQu8fINHaSAz9gUVdzVyvAPxBS90qYvQ5GjcPPc0K4MKWS2sqfI1M X-Received: by 2002:a17:90a:9f0b:: with SMTP id n11mr25762763pjp.98.1560780381336; Mon, 17 Jun 2019 07:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560780381; cv=none; d=google.com; s=arc-20160816; b=b/Rl+P/1aAyPNON6DapPsxYNPvx8mSLWUacbsDVXC86IG9WUtL7hWItl/7d6BNpcA2 DbWzxpM6lxkUnHGgXfs4IT5spwd91DHbDRwh9fGFNFtdflNiiGj5OMHHIPpQLuhiTW6f Mig0RlFMsPDOUJIfRn5Krn31QD+8WjAQwo8a2PjQUURZ9+XsrKJxLE58scj5F+gT/N3J BcGsxd8tr+12rOxjfMYdy80/L416wXyP+mdWTkfU/rnHIKnhywK6hxhqEdxSZNUDCdTb GmUJkDnJL5dPOsc9yRhTpo9frk1i0a9ezYAuAMXhCpFq4yOmD6jok35r9uIqvrU4YTI5 dZPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=BuqClaap0w5GHctpIDrpMGvsw7n1c6lqu80Oeh7+HF4=; b=qy6G6nATENJREjTWbWetTlLhb+9ezPrVSC0pJJmN2TL/R57BdBEqgKPyNAR/uE/Y+K NlYrIwUgNnevaz74A067HUDIfiGfPBdsmshuLNgPrmAEFe+/K+ff7i8jqZoOjlCFPjpw 6R2UO5mNryGfZ0vyKjBV/ISIV2vKL8lBdSZoPIHN1SdJ4xJ1snZFv9lrM4WGL2NZLUep H1yt5e/or3QzhG+amGBmQtp+yfr+Y7Qb7smMBsAliW35dS27R29IkGeqg43EcM1FHSox e4xkzak+gQMdgsFqcfSgKt+JWnSCDGMS2C9ku8is5laUlNFpCZItiLaXm7uvncHzJy5x vqjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LTfnykgv; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k137si11365568pga.59.2019.06.17.07.06.04; Mon, 17 Jun 2019 07:06:21 -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=@gmail.com header.s=20161025 header.b=LTfnykgv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbfFQOE0 (ORCPT + 99 others); Mon, 17 Jun 2019 10:04:26 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33302 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfFQOE0 (ORCPT ); Mon, 17 Jun 2019 10:04:26 -0400 Received: by mail-wm1-f67.google.com with SMTP id h19so55832wme.0; Mon, 17 Jun 2019 07:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BuqClaap0w5GHctpIDrpMGvsw7n1c6lqu80Oeh7+HF4=; b=LTfnykgvaXHiqXM050U7gKRlj3j8cKCyF4O+eKf+23gaHgsXH96Ha2qmlkHDQul9eK L3lZXvdIrwiwr0SVuAmxVmr0vFvnv1GxCItel0zmvH9uUr/QXXeqGiqyCafyOd7vsfo5 yZ85msUx+Qmwmhz1KJuerPVq3h5ucE0IbLVL0k5sEApEiaFSOHetWqvbcBVIJcz1cww5 MCtF0TDQ6AtM83Pieg6VeqQbAPa6Xiwa4BrXcGQOGhGXirebkQaz8EL4vOZjEgsZZ6B8 C6yakwuJFTRWZPiGPU8yOk8qKhxBLG3cT6gIoYP9cvGVuWvclGHqZAU6xM8p8G34h5m1 rJyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BuqClaap0w5GHctpIDrpMGvsw7n1c6lqu80Oeh7+HF4=; b=ty8zGFUgZEtnfKKiaQe5cBYiv0M6LVVrrUWD/JWKODTGhds24kZ05uDyeS6Y69DtXb UrtFDAMCcL/Xh8h2w6VPUsd+CtM7aeHShFRS4FTkQP9282zPY5j9lkr34n+qtFguAKKq XyoRPyhu3AI8SkeEA89F08i595XHxyXZgfaMTSzoL0W8IOFreHT2kTkY/ailLI3XTrqi iEi1TaZOEQLa4LuxMqW2zEGSuUOWNGIWTVVVEcu0UbcI0+TDfvhq0MGvgps02HDmy/Nz eQDWcvdN8zdN2xz87fpp2A+kkYpqm3UdEvEWcgD0wWWrVEX7n1SpiJe590G9EZ/IT+oI rvGw== X-Gm-Message-State: APjAAAXEVdznCJBgCu3xT3IXsHbKqGfzpE30bLGrjF6zhlBDPlmr1oIo MT1yW5ZB8aodK4nFV3+taR8TUCQF X-Received: by 2002:a1c:ef0c:: with SMTP id n12mr18157057wmh.132.1560780263321; Mon, 17 Jun 2019 07:04:23 -0700 (PDT) Received: from [192.168.2.145] (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.googlemail.com with ESMTPSA id e11sm11378596wrc.9.2019.06.17.07.04.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 07:04:22 -0700 (PDT) Subject: Re: [PATCH v2 3/6] clocksource/drivers/tegra: Set and use timer's period To: Jon Hunter , Daniel Lezcano , Joseph Lo , Thierry Reding , Peter De Schrijver Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190610164400.11830-1-digetx@gmail.com> <20190610164400.11830-4-digetx@gmail.com> <3e941c50-ac62-719e-aac1-7072e9a3bcd0@gmail.com> <660f3645-3fa6-175c-75a6-3fcc79e972ad@nvidia.com> From: Dmitry Osipenko Message-ID: Date: Mon, 17 Jun 2019 17:04:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <660f3645-3fa6-175c-75a6-3fcc79e972ad@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 17.06.2019 13:51, Jon Hunter пишет: > > On 14/06/2019 17:45, Dmitry Osipenko wrote: >> 14.06.2019 18:48, Jon Hunter пишет: >>> >>> On 10/06/2019 17:43, Dmitry Osipenko wrote: >>>> The of_clk structure has a period field that is set up initially by >>>> timer_of_clk_init(), that period value need to be adjusted for a case of >>>> TIMER1-9 that are running at a fixed rate that doesn't match the clock's >>>> rate. Note that the period value is currently used only by some of the >>>> clocksource drivers internally and hence this is just a minor cleanup >>>> change that doesn't fix anything. >>>> >>>> Signed-off-by: Dmitry Osipenko >>>> --- >>>> drivers/clocksource/timer-tegra.c | 5 +++-- >>>> 1 file changed, 3 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c >>>> index 810b4e7435cf..646b3530c2d2 100644 >>>> --- a/drivers/clocksource/timer-tegra.c >>>> +++ b/drivers/clocksource/timer-tegra.c >>>> @@ -71,9 +71,9 @@ static int tegra_timer_shutdown(struct clock_event_device *evt) >>>> static int tegra_timer_set_periodic(struct clock_event_device *evt) >>>> { >>>> void __iomem *reg_base = timer_of_base(to_timer_of(evt)); >>>> + unsigned long period = timer_of_period(to_timer_of(evt)); >>>> >>>> - writel_relaxed(TIMER_PTV_EN | TIMER_PTV_PER | >>>> - ((timer_of_rate(to_timer_of(evt)) / HZ) - 1), >>>> + writel_relaxed(TIMER_PTV_EN | TIMER_PTV_PER | (period - 1), >>>> reg_base + TIMER_PTV); >>>> >>>> return 0; >>>> @@ -297,6 +297,7 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20, >>>> cpu_to->clkevt.rating = rating; >>>> cpu_to->clkevt.cpumask = cpumask_of(cpu); >>>> cpu_to->of_base.base = timer_reg_base + base; >>>> + cpu_to->of_clk.period = DIV_ROUND_UP(rate, HZ); >>> >>> Any reason you made this a round-up? >> >> That's what timer_of_clk_init() does, I assume it should be a more correct variant. > > Sounds to me like this should be 2 patches, because you are changing the > value. This is not just purely cleanup IMO. Indeed, that could be at least mentioned in the commit message. Probably I just assumed that this is such a minor change that not worth anything. A hundred of microseconds is hardly noticeable. I'm not really sure if this really worth a re-spin at this point. Jon, are you insisting? Also, I now see that some drivers use DIV_ROUND_CLOSEST(), maybe it will be even better? Not sure.. given that this is still a microseconds difference.