All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
@ 2026-08-14  9:22 ` Pedro Kopper
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Kopper @ 2026-08-14  9:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, linux-clk, daire.mcnamara, mturquette, sboyd,
	bmasney, valentina.fernandezalanis, conor.dooley, pedro.kopper

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
@ 2026-08-14  9:22 ` Pedro Kopper
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Kopper @ 2026-08-14  9:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-riscv, linux-clk, daire.mcnamara, mturquette, sboyd,
	bmasney, valentina.fernandezalanis, conor.dooley, pedro.kopper

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>
---
 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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
  2026-08-14  9:22 ` Pedro Kopper
@ 2026-08-14 15:22   ` Conor Dooley
  -1 siblings, 0 replies; 4+ messages in thread
From: Conor Dooley @ 2026-08-14 15:22 UTC (permalink / raw)
  To: Pedro Kopper
  Cc: linux-kernel, linux-riscv, linux-clk, daire.mcnamara, mturquette,
	sboyd, bmasney, valentina.fernandezalanis, conor.dooley

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
@ 2026-08-14 15:22   ` Conor Dooley
  0 siblings, 0 replies; 4+ messages in thread
From: Conor Dooley @ 2026-08-14 15:22 UTC (permalink / raw)
  To: Pedro Kopper
  Cc: linux-kernel, linux-riscv, linux-clk, daire.mcnamara, mturquette,
	sboyd, bmasney, valentina.fernandezalanis, conor.dooley


[-- Attachment #1.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-14 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  9:22 [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order Pedro Kopper
2026-08-14  9:22 ` Pedro Kopper
2026-08-14 15:22 ` Conor Dooley
2026-08-14 15:22   ` Conor Dooley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.