* [PATCH] mfd: rz-mtu3: Fix MTU5 timer start register offset
@ 2026-11-26 6:23 Nhat Tran
0 siblings, 0 replies; only message in thread
From: Nhat Tran @ 2026-11-26 6:23 UTC (permalink / raw)
To: Lee Jones
Cc: Biju Das, Cosmin Tanislav, mfd, linux-renesas-soc, linux-kernel,
Nhat Tran
rz_mtu3_get_tstr_offset() returns RZ_MTU3_TSTR for MTU5, which is the
index of TSTR in rz_mtu3_8bit_ch_reg_offs[], not a register offset.
rz_mtu3_start_stop_ch() and rz_mtu3_is_enabled() pass the result to the
shared register helpers, which add it to the MMIO base directly. For
MTU5 they therefore access offset 0x002, which is TMDR1 of MTU3, instead
of TSTR at offset 0xab4.
Reproduced on RZ/G2L SMARC with MTU3 in PWM mode 1 on MTIOC3A and a
temporary debugfs hook calling rz_mtu3_enable()/rz_mtu3_disable() on
MTU5:
TMDR1 (MTU3) TSTR (MTU5)
initial 0x02 0x00
MTU5 start, before fix 0x06 0x00
MTU5 start, after fix 0x02 0x04
Before the fix, starting MTU5 switches MTU3 out of PWM mode 1 while
MTU5 itself never starts, and rz_mtu3_is_enabled() still reports MTU5
as running.
Look up the real offset in rz_mtu3_8bit_ch_reg_offs[].
No in-tree user starts or stops MTU5 today.
Fixes: 654c293e1687 ("mfd: Add Renesas RZ/G2L MTU3a core driver")
Signed-off-by: Nhat Tran <nhat.tranminhk2@gmail.com>
---
drivers/mfd/rz-mtu3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c
index 7e1313a57abc..b7872ee0ba97 100644
--- a/drivers/mfd/rz-mtu3.c
+++ b/drivers/mfd/rz-mtu3.c
@@ -196,7 +196,7 @@ static u16 rz_mtu3_get_tstr_offset(struct rz_mtu3_channel *ch)
offset = RZ_MTU3_TSTRA;
break;
case RZ_MTU3_CHAN_5:
- offset = RZ_MTU3_TSTR;
+ offset = rz_mtu3_8bit_ch_reg_offs[RZ_MTU3_CHAN_5][RZ_MTU3_TSTR];
break;
case RZ_MTU3_CHAN_6:
case RZ_MTU3_CHAN_7:
base-commit: ebb7a8dc1e74c705daffe11c2faf38ec2628f838
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 6:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 6:23 [PATCH] mfd: rz-mtu3: Fix MTU5 timer start register offset Nhat Tran
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®