LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Phong Hoang <phong.hoang.wz@renesas.com>
Subject: Re: [PATCH] clocksource: sh_cmt: Fix wrong setting if don't request IRQ for clock source channel
Date: Wed, 11 Aug 2021 16:06:06 +0200	[thread overview]
Message-ID: <YRPZTnptOXrKl4Tz@shikoro> (raw)
In-Reply-To: <YMMXJz4IwFJU4vEF@oden.dyn.berto.se>

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

Hi Daniel,

> > > If CMT instance has at least two channels, one channel will be used
> > > as a clock source and another one used as a clock event device.
> > > In that case, IRQ is not requested for clock source channel so
> > > sh_cmt_clock_event_program_verify() might work incorrectly.
> > > Besides, when a channel is only used for clock source, don't need to
> > > re-set the next match_value since it should be maximum timeout as
> > > it still is.
> > > 
> > > On the other hand, due to no IRQ, total_cycles is not counted up
> > > when reaches compare match time (timer counter resets to zero),
> > > so sh_cmt_clocksource_read() returns unexpected value.
> > > Therefore, use 64-bit clocksoure's mask for 32-bit or 16-bit variants
> > > will also lead to wrong delta calculation. Hence, this mask should
> > > correspond to timer counter width, and above function just returns
> > > the raw value of timer counter register.
> > 
> > I'm not getting the 'ch->cmt->num_channels == 1' change, can you explain?
> 
> My understanding is that if more then one channel is available the 
> channel used as clocksource is used without an interrupt. This was not 
> addressed in the patches listed as fixes. This patch fixes this multi 
> channel use-case while still retaining the old behavior for for the case 
> where only one channel is available (ch->cmt->num_channels == 
> 1).

Did Niklas answer help you?

Happy hacking,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-08-11 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 12:34 Niklas Söderlund
2021-06-10 12:45 ` Daniel Lezcano
2021-06-11  7:56   ` Niklas Söderlund
2021-08-11 14:06     ` Wolfram Sang [this message]
2021-08-26 16:25 ` [tip: timers/core] clocksource/drivers/sh_cmt: " tip-bot2 for Phong Hoang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRPZTnptOXrKl4Tz@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=phong.hoang.wz@renesas.com \
    --subject='Re: [PATCH] clocksource: sh_cmt: Fix wrong setting if don'\''t request IRQ for clock source channel' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).