RE: [PATCH 0/3] Add support for Renesas CAN-FD Bus-Off recovery mode selection

From: Biju Das

Date: Tue Apr 07 2026 - 07:29:07 EST


Hi Marc Kleine-Budde,

Thanks for the feedback.

> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 03 April 2026 22:45
> Subject: Re: [PATCH 0/3] Add support for Renesas CAN-FD Bus-Off recovery mode selection
>
> On 03.04.2026 10:49:57, Biju wrote:
> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > The CAN-FD IP supports the below Bus-Off recovery modes:
> > 1) ISO11898-1 compliant
> > 2) Entry to Channel Halt mode automatically at bus-off entry
> > 3) Entry to Channel Halt mode automatically at bus-off end
> > 4) Entry to Channel Halt mode (in bus-off state) by program request
> >
> > Add support for Bus-Off recovery mode selection via the
> > renesas,bus-off-recovery-mode device tree property. If the property is
> > absent, it defaults to RCANFD_CCTR_BOM_BENTRY (entry to Channel Halt
> > mode automatically at bus-off entry) for backward compatibility.
>
> Using DT properties for configuration is not the best way to go.

From a product perspective, how can we satisfy the below requirements,
given that this is to be done statically?

Some customers want Bus-Off recovery to be compliant with ISO 11898-1,
compared to the existing behavior of switching to halt mode automatically
after entering the bus-off state.

In Channel Halt mode, all channel CAN communication is suspended, but all
status and flag registers remain unchanged during Channel Halt mode entry.

>
> Can you explain a bit more what the controller does in the different modes?

● CFDCnCTR.BOM[1:0] = 00b:
Bus-Off recovery is compliant to ISO 11898-1, namely the CAN channel re-enters
CAN communication (error activestate) after 11 consecutive recessive bits are
detected 128 times. TEC and REC counters are initialized to 0. The Bus-
Off Recovery Flag CFDCnERFL.BORF is set in this case.

● CFDCnCTR.BOM[1:0] = 01b: Existing case
The CAN channel changes the value of the CFDCnCTR.CHMDC[1:0] bits within the
CAN Channel Control Register to 10b and switches immediately to Channel Halt
mode automatically after entering bus-off state. TEC and REC counters are
initialized to 0 and the Bus-Off Recovery Flag CFDCnERFL.BORF is not set
in this case.

● CFDCnCTR.BOM[1:0] = 10b:
The CAN channel changes the value of the CFDCnCTR.CHMDC[1:0] bits within the
CAN Channel Control Register to 10b as soon as it reaches bus-off state and
enters Channel Halt mode automatically after the CAN channel has completed
the bus-off recovery sequence (after 11 consecutive recessive bits are
detected 128 times). TEC and REC counters are initialized to 0 and the Bus-Off
Recovery Flag CFDCnERFL.BORF is set in this case.

● CFDCnCTR.BOM[1:0] = 11b:
Bus-off recovery is initiated but CAN channel can immediately enter Channel
Halt mode when still in bus-off state if a request is made to enter Channel
Halt mode. TEC and REC counters are initialized to 0 and the Bus-Off Recovery
Flag CFDCnERFL.BORF is not set. Without setting CFDCnCTR.CHMDC[1:0] = 10b and
when 11 recessive bits is detected 128 times continuously, transition
conditions become the same as CFDCnCTR.BOM[1:0] = 00b.

>
> In the current driver when the bus off IRQ (RCANFD_CERFL_BOEF) fires, the driver calls can_bus_off(),
> which triggers the configured bus off handling.

Agreed.

>
> What the Linux driver should do is once the HW is in bus off mode, switch off the HW and let
> the .do_set_mode(CAN_MODE_START) callback restart the hardware.

We do have .do_set_mode, which restarts the hardware if restart_ms is set.

BOM case 00b:
After entering the bus-off state, when 11 successive recessive bits are detected 128 times, and
if we start the transmission, it enters the transmit state.

BOM cases {01b, 10b}: It automatically enters halt mode.

BOM case 11b:
The CAN channel transitions to Channel Halt mode as soon as Channel Halt mode is requested by
the CPU (without waiting for the completion of the bus-off recovery).

If the CPU does not set Channel Halt mode, then it behaves the same as BOM case 00b.

Cheers,
Biju