mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Phong Hoang <phong.hoang.wz@renesas.com>
Subject: Re: [PATCH] clocksource: sh_cmt: use CMTOUT_IE only when supported
Date: Mon, 8 Mar 2021 13:04:41 +0100	[thread overview]
Message-ID: <YEYS2YZF3xcyzQpf@oden.dyn.berto.se> (raw)
In-Reply-To: <20210305132859.8208-1-wsa+renesas@sang-engineering.com>

Hi Wolfram,

Thanks for your patch.

On 2021-03-05 14:28:59 +0100, Wolfram Sang wrote:
> CMTOUT_IE is only supported for older SoCs. Newer SoCs shall not set
> this bit. So, add a version check.
> 
> Reported-by: Phong Hoang <phong.hoang.wz@renesas.com>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> 
> Confirmed with datasheets and could successfully repeat Niklas' CMT
> tests on an R-Car M3N based Salvator-XS.
> 
>  drivers/clocksource/sh_cmt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
> index c98f8851fd68..3b53c6cb1da9 100644
> --- a/drivers/clocksource/sh_cmt.c
> +++ b/drivers/clocksource/sh_cmt.c
> @@ -143,6 +143,7 @@ struct sh_cmt_device {
>  #define SH_CMT32_CMCSR_SSIE		(1 << 10)
>  #define SH_CMT32_CMCSR_CMS		(1 << 9)
>  #define SH_CMT32_CMCSR_CMM		(1 << 8)
> +/* CMTOUT_IE only for SH_CMT_32BIT and SH_CMT_48BIT */
>  #define SH_CMT32_CMCSR_CMTOUT_IE	(1 << 7)
>  #define SH_CMT32_CMCSR_CMR_NONE		(0 << 4)
>  #define SH_CMT32_CMCSR_CMR_DMA		(1 << 4)
> @@ -339,8 +340,9 @@ static int sh_cmt_enable(struct sh_cmt_channel *ch)
>  		sh_cmt_write_cmcsr(ch, SH_CMT16_CMCSR_CMIE |
>  				   SH_CMT16_CMCSR_CKS512);
>  	} else {
> -		sh_cmt_write_cmcsr(ch, SH_CMT32_CMCSR_CMM |
> -				   SH_CMT32_CMCSR_CMTOUT_IE |
> +		u32 cmtout = ch->cmt->info->model <= SH_CMT_48BIT ?
> +			      SH_CMT32_CMCSR_CMTOUT_IE : 0;
> +		sh_cmt_write_cmcsr(ch, cmtout | SH_CMT32_CMCSR_CMM |
>  				   SH_CMT32_CMCSR_CMR_IRQ |
>  				   SH_CMT32_CMCSR_CKS_RCLK8);
>  	}
> -- 
> 2.29.2
> 

-- 
Regards,
Niklas Söderlund

      parent reply	other threads:[~2021-03-08 12:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 13:28 Wolfram Sang
2021-03-08  8:35 ` Geert Uytterhoeven
2021-03-09  9:35   ` Wolfram Sang
2021-03-08 12:04 ` Niklas Söderlund [this message]

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=YEYS2YZF3xcyzQpf@oden.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=phong.hoang.wz@renesas.com \
    --cc=wsa+renesas@sang-engineering.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®