Skip to contentSkip to conversation

New: flexcan-core.c

Bug 220168 Stephen Hemminger 2 participants 3 messages May 28, 2025 – May 29, 2025 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Begin forwarded message:

Date: Wed, 28 May 2025 15:19:21 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 220168] New: flexcan-core.c

https://bugzilla.kernel.org/show_bug.cgi?id=220168

            Bug ID: 220168
           Summary: flexcan-core.c
           Product: Networking
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Bit15 (TDCEN) should not be enabled according to the spec if dbrp > 2 and in the driver it gets enabled when i set dbrp = 10. Resulting in RX Error Frames.

spec:
ISO11898-1:2015(E), section 11.3.3 (Transmtiter delay compensation) (page 52):
It shall be programmable whether the mechanism is used at all. When this mechanism is used, the value of the prescaler for the data time quantum m(D) shall be one or two.

The "prescaler for the data time quantim m(D)" is commonly referred to as "dbrp" by implementations.

Kind regards,

Robbin

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.
#1 lore raw

+To: Robbin

Hi Stephen and Robbin,

Thanks for forwarding us this bug report.

Quoted 28 lines · Stephen Hemminger

Begin forwarded message:

Date: Wed, 28 May 2025 15:19:21 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 220168] New: flexcan-core.c

https://bugzilla.kernel.org/show_bug.cgi?id=220168

            Bug ID: 220168
           Summary: flexcan-core.c
           Product: Networking
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Bit15 (TDCEN) should not be enabled according to the spec if dbrp > 2 and in the driver it gets enabled when i set dbrp = 10. Resulting in RX Error Frames.

Quoted 8 lines

spec:
ISO11898-1:2015(E), section 11.3.3 (Transmtiter delay compensation) (page 52):
It shall be programmable whether the mechanism is used at all. When this mechanism is used, the value of the prescaler for the data time quantum m(D) shall be one or two.

The "prescaler for the data time quantim m(D)" is commonly referred to as "dbrp" by implementations.

The issue which you describe here as well as the issue in bug 220170
[1] share roughly the same root cause: the driver is setting the TDC parameters manually without doing any proper checking. The reason is that, at the time of writing, the CAN subsystem did not have a framework to handle the TDC logic. This has changed since.

We had a very similar issue on the mcp251xfd driver recently which was fixed in [2]. Other relevant background information can be found in [3]. The flexcan needs to be modified in a similar fashion.

I do not have the hardware so it would be hard to fix on my side.

@Robbin: I assume you have access to the hardware. Would you like to try to write the patch for this? I can provide guidance.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=220170

[2] commit 5e1663810e11 ("can: mcp251xfd: fix TDC setting for low data bit rates")

[3] Re: mcp251xfd: forced TDC

#2 lore raw
In reply to Stephen Hemminger

+To: Robbin

Hi Stephen and Robbin,

Thanks for forwarding us this bug report.

Quoted 28 lines · Stephen Hemminger

Begin forwarded message:

Date: Wed, 28 May 2025 15:19:21 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 220168] New: flexcan-core.c

https://bugzilla.kernel.org/show_bug.cgi?id=220168

            Bug ID: 220168
           Summary: flexcan-core.c
           Product: Networking
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Bit15 (TDCEN) should not be enabled according to the spec if dbrp > 2 and in the driver it gets enabled when i set dbrp = 10. Resulting in RX Error Frames.

Quoted 8 lines

spec:
ISO11898-1:2015(E), section 11.3.3 (Transmtiter delay compensation) (page 52):
It shall be programmable whether the mechanism is used at all. When this mechanism is used, the value of the prescaler for the data time quantum m(D) shall be one or two.

The "prescaler for the data time quantim m(D)" is commonly referred to as "dbrp" by implementations.

The issue which you describe here as well as the issue in bug 220170
[1] share roughly the same root cause: the driver is setting the TDC parameters manually without doing any proper checking. The reason is that, at the time of writing, the CAN subsystem did not have a framework to handle the TDC logic. This has changed since.

We had a very similar issue on the mcp251xfd driver recently which was fixed in [2]. Other relevant background information can be found in [3]. The flexcan needs to be modified in a similar fashion.

I do not have the hardware so it would be hard to fix on my side.

@Robbin: I assume you have access to the hardware. Would you like to try to write the patch for this? I can provide guidance.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=220170

[2] commit 5e1663810e11 ("can: mcp251xfd: fix TDC setting for low data bit rates")

[3] Re: mcp251xfd: forced TDC
Link:
https://lore.kernel.org/all/CAMZ6RqKdyFPRwMbCZY5HwzLTeT9jcbxFiOfcuHbo+VgFF3ZViw@mail.gmail.com/

Yours sincerely,
Vincent Mailhol