Linux clock framework development
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Pedro Kopper <pedro.kopper@microchip.com>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-clk@vger.kernel.org, daire.mcnamara@microchip.com,
	mturquette@baylibre.com, sboyd@kernel.org, bmasney@redhat.com,
	valentina.fernandezalanis@microchip.com,
	conor.dooley@microchip.com
Subject: Re: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
Date: Fri, 14 Aug 2026 16:22:32 +0100	[thread overview]
Message-ID: <20260814-boggle-derby-3f55c6c14bc8@spud> (raw)
In-Reply-To: <20260814092211.2158337-3-pedro.kopper@microchip.com>

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

On Fri, Aug 14, 2026 at 10:22:13AM +0100, Pedro Kopper wrote:
> mpfs_cfg_clk_set_rate() passes the mask and value arguments to
> regmap_update_bits() in the wrong order. The resulting write becomes
> reg = orig_reg | val, causing bits to not be cleared if the clock
> divider changes.
> 
> Pass the arguments in the correct order so the divider field is updated
> as intended.
> 
> Fixes: c6f2dddfa7f9 ("clk: microchip: mpfs: use regmap for clocks")
> Signed-off-by: Pedro Kopper <pedro.kopper@microchip.com>

CC: stable@vger.kernel.org
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.

> ---
>  drivers/clk/microchip/clk-mpfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk-mpfs.c
> index ee58304913ef..7f044775aea8 100644
> --- a/drivers/clk/microchip/clk-mpfs.c
> +++ b/drivers/clk/microchip/clk-mpfs.c
> @@ -285,7 +285,7 @@ static int mpfs_cfg_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned
>  
>  	mask = clk_div_mask(cfg->width) << cfg->shift;
>  	val = divider_setting << cfg->shift;
> -	regmap_update_bits(cfg->map, cfg->map_offset, val, mask);
> +	regmap_update_bits(cfg->map, cfg->map_offset, mask, val);
>  
>  	return 0;
>  }
> -- 
> 2.43.0
> 

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

      reply	other threads:[~2026-08-14 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  9:22 [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order Pedro Kopper
2026-08-14 15:22 ` Conor Dooley [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=20260814-boggle-derby-3f55c6c14bc8@spud \
    --to=conor@kernel.org \
    --cc=bmasney@redhat.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=pedro.kopper@microchip.com \
    --cc=sboyd@kernel.org \
    --cc=valentina.fernandezalanis@microchip.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