mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nhat Tran <nhat.tranminhk2@gmail.com>
To: Lee Jones <lee@kernel.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>,
	mfd@lists.linux.dev, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nhat Tran <nhat.tranminhk2@gmail.com>
Subject: [PATCH] mfd: rz-mtu3: Fix MTU5 timer start register offset
Date: Thu, 26 Nov 2026 13:23:07 +0700	[thread overview]
Message-ID: <20261126062307.53943-1-nhat.tranminhk2@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-26  6:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261126062307.53943-1-nhat.tranminhk2@gmail.com \
    --to=nhat.tranminhk2@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cosmin-gabriel.tanislav.xa@renesas.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    /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®