[PATCH v3 5/8] can: rcar_canfd: Do not set registers selecting the CAN mode

From: Claudiu Beznea

Date: Tue Jul 14 2026 - 13:34:55 EST


From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

The bits 30 (classical CAN-only mode) and 28 (FD-only enable) of the
Channel n CAN-FD Configuration Register of the Renesas RZ/G3S SoC are not
available. The IP supports only CAN-FD mode. RZ/G3S HW manual (revision
1.30) specify the bits are read as zero and the write value should always
be zero.

Add the mode_select_na flag in struct rcar_canfd_hw_info to cover RZ/G3S
and avoid writing to unavailable bits.

The existing struct rcar_canfd_hw_info instances were updated to address
the request in the Link discussion.

Commit prepares for the addition of the Renesas RZ/G3S SoC.

Link: https://lore.kernel.org/all/1d9719e3-10ff-4cd8-b729-55fea93c37ce@xxxxxxxxxx
Reviewed-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---

Changes in v3:
- none

Changes in v2:
- collected the tags
- updated patch description to reflect this is a preparatory commit

drivers/net/can/rcar/rcar_canfd.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 7fa9cbbf8dde..8ba8905c965a 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -445,6 +445,7 @@ struct rcar_canfd_hw_info {
unsigned shared_can_regs:1; /* Has shared classical can registers */
unsigned external_clk:1; /* Has external clock */
unsigned fcan_pclk:1; /* Has fcan sourced from pclk. */
+ unsigned mode_select_na:1; /* Has no bits for selecting the mode. */
};

/* Channel priv data */
@@ -619,6 +620,7 @@ static const struct rcar_canfd_hw_info rcar_gen3_hw_info = {
.shared_can_regs = 0,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};

static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
@@ -637,6 +639,7 @@ static const struct rcar_canfd_hw_info rcar_gen4_hw_info = {
.shared_can_regs = 1,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};

static const struct rcar_canfd_hw_info rzg2l_hw_info = {
@@ -655,6 +658,7 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
.shared_can_regs = 0,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};

static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
@@ -673,6 +677,7 @@ static const struct rcar_canfd_hw_info r9a09g047_hw_info = {
.shared_can_regs = 1,
.external_clk = 0,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};

static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
@@ -691,6 +696,7 @@ static const struct rcar_canfd_hw_info r9a09g077_hw_info = {
.shared_can_regs = 1,
.external_clk = 1,
.fcan_pclk = 0,
+ .mode_select_na = 0,
};

/* Helper functions */
@@ -846,6 +852,9 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
}

/* Set the controller into appropriate mode */
+ if (gpriv->info->mode_select_na)
+ continue;
+
if (gpriv->info->ch_interface_mode) {
/* Do not set CLOE and FDOE simultaneously */
if (!gpriv->fdmode) {
--
2.43.0