All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pedro Kopper <pedro.kopper@microchip.com>
To: <linux-kernel@vger.kernel.org>
Cc: <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>, <pedro.kopper@microchip.com>
Subject: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
Date: Fri, 14 Aug 2026 10:22:13 +0100	[thread overview]
Message-ID: <20260814092211.2158337-3-pedro.kopper@microchip.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Pedro Kopper <pedro.kopper@microchip.com>
To: <linux-kernel@vger.kernel.org>
Cc: <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>, <pedro.kopper@microchip.com>
Subject: [PATCH] clk: microchip: mpfs: fix regmap_update_bits() mask/val order
Date: Fri, 14 Aug 2026 10:22:13 +0100	[thread overview]
Message-ID: <20260814092211.2158337-3-pedro.kopper@microchip.com> (raw)

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

             reply	other threads:[~2026-08-14  9:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  9:22 Pedro Kopper [this message]
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
2026-08-14 15:22   ` Conor Dooley

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=20260814092211.2158337-3-pedro.kopper@microchip.com \
    --to=pedro.kopper@microchip.com \
    --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=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 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.