Netdev List
 help / color / mirror / Atom feed
* [PATCH net] can: ctucanfd: handle bus error interrupts
@ 2026-07-23  7:44 Avi Weiss
  2026-07-23  9:23 ` Pavel Pisa
  2026-07-23 10:23 ` Pavel Pisa
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Weiss @ 2026-07-23  7:44 UTC (permalink / raw)
  To: linux-can
  Cc: Pavel Pisa, Ondrej Ille, Marc Kleine-Budde, Vincent Mailhol,
	Martin Jerabek, netdev, linux-kernel, Avi Weiss

Include REG_INT_STAT_BEI in the top-level error interrupt condition.

BEI is enabled when CAN_CTRLMODE_BERR_REPORTING is requested and
ctucan_err_interrupt() already handles it. Without checking and
clearing BEI in the top-level handler, bus error interrupts are not
handled or acknowledged.

Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source IP core - bus independent part.")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 drivers/net/can/ctucanfd/ctucanfd_base.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/ctucanfd/ctucanfd_base.c b/drivers/net/can/ctucanfd/ctucanfd_base.c
index 0ea1ff28dfce..0cd2d428c1f1 100644
--- a/drivers/net/can/ctucanfd/ctucanfd_base.c
+++ b/drivers/net/can/ctucanfd/ctucanfd_base.c
@@ -1136,8 +1136,12 @@ static irqreturn_t ctucan_interrupt(int irq, void *dev_id)
 		/* Error interrupts */
 		if (FIELD_GET(REG_INT_STAT_EWLI, isr) ||
 		    FIELD_GET(REG_INT_STAT_FCSI, isr) ||
-		    FIELD_GET(REG_INT_STAT_ALI, isr)) {
-			icr = isr & (REG_INT_STAT_EWLI | REG_INT_STAT_FCSI | REG_INT_STAT_ALI);
+		    FIELD_GET(REG_INT_STAT_ALI, isr) ||
+		    FIELD_GET(REG_INT_STAT_BEI, isr)) {
+			icr = isr & (REG_INT_STAT_EWLI |
+				     REG_INT_STAT_FCSI |
+				     REG_INT_STAT_ALI |
+				     REG_INT_STAT_BEI);
 
 			ctucan_netdev_dbg(ndev, "some ERR interrupt: clearing 0x%08x\n", icr);
 			ctucan_write32(priv, CTUCANFD_INT_STAT, icr);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] can: ctucanfd: handle bus error interrupts
  2026-07-23  7:44 [PATCH net] can: ctucanfd: handle bus error interrupts Avi Weiss
@ 2026-07-23  9:23 ` Pavel Pisa
  2026-07-23 10:23 ` Pavel Pisa
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Pisa @ 2026-07-23  9:23 UTC (permalink / raw)
  To: Avi Weiss
  Cc: linux-can, Ondrej Ille, Marc Kleine-Budde, Vincent Mailhol,
	Martin Jerabek, netdev, linux-kernel, Jiri Novak

Hello Avi,

thanks for correction.

On Thursday 23 of July 2026 09:44:03 Avi Weiss wrote:
> Include REG_INT_STAT_BEI in the top-level error interrupt condition.
>
> BEI is enabled when CAN_CTRLMODE_BERR_REPORTING is requested and
> ctucan_err_interrupt() already handles it. Without checking and
> clearing BEI in the top-level handler, bus error interrupts are not
> handled or acknowledged.
>
> Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source
> IP core - bus independent part.") Signed-off-by: Avi Weiss
> <thnkslprpt@gmail.com>
> ---
>  drivers/net/can/ctucanfd/ctucanfd_base.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/ctucanfd/ctucanfd_base.c
> b/drivers/net/can/ctucanfd/ctucanfd_base.c index 0ea1ff28dfce..0cd2d428c1f1
> 100644
> --- a/drivers/net/can/ctucanfd/ctucanfd_base.c
> +++ b/drivers/net/can/ctucanfd/ctucanfd_base.c
> @@ -1136,8 +1136,12 @@ static irqreturn_t ctucan_interrupt(int irq, void
> *dev_id) /* Error interrupts */
>  		if (FIELD_GET(REG_INT_STAT_EWLI, isr) ||
>  		    FIELD_GET(REG_INT_STAT_FCSI, isr) ||
> -		    FIELD_GET(REG_INT_STAT_ALI, isr)) {
> -			icr = isr & (REG_INT_STAT_EWLI | REG_INT_STAT_FCSI | REG_INT_STAT_ALI);
> +		    FIELD_GET(REG_INT_STAT_ALI, isr) ||
> +		    FIELD_GET(REG_INT_STAT_BEI, isr)) {
> +			icr = isr & (REG_INT_STAT_EWLI |
> +				     REG_INT_STAT_FCSI |
> +				     REG_INT_STAT_ALI |
> +				     REG_INT_STAT_BEI);
>
>  			ctucan_netdev_dbg(ndev, "some ERR interrupt: clearing 0x%08x\n", icr);
>  			ctucan_write32(priv, CTUCANFD_INT_STAT, icr);

Acked-by: Pavel Pisa <pisa@fel.cvut.cz>


                Pavel Pisa
    phone:      +420 603531357
    e-mail:     pisa@cmp.felk.cvut.cz
    Department of Control Engineering FEE CVUT
    Karlovo namesti 13, 121 35, Prague 2
    university: http://control.fel.cvut.cz/
    personal:   http://cmp.felk.cvut.cz/~pisa
    social:     https://social.kernel.org/ppisa
    projects:   https://www.openhub.net/accounts/ppisa
    CAN related:http://canbus.pages.fel.cvut.cz/
    RISC-V education: https://comparch.edu.cvut.cz/
    Open Technologies Research Education and Exchange Services
    https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] can: ctucanfd: handle bus error interrupts
  2026-07-23  7:44 [PATCH net] can: ctucanfd: handle bus error interrupts Avi Weiss
  2026-07-23  9:23 ` Pavel Pisa
@ 2026-07-23 10:23 ` Pavel Pisa
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Pisa @ 2026-07-23 10:23 UTC (permalink / raw)
  To: Avi Weiss
  Cc: linux-can, Ondrej Ille, Marc Kleine-Budde, Vincent Mailhol,
	Martin Jerabek, netdev, linux-kernel, Jiri Novak

Hello Avi,

thanks for correction.

On Thursday 23 of July 2026 09:44:03 Avi Weiss wrote:
> Include REG_INT_STAT_BEI in the top-level error interrupt condition.
>
> BEI is enabled when CAN_CTRLMODE_BERR_REPORTING is requested and
> ctucan_err_interrupt() already handles it. Without checking and
> clearing BEI in the top-level handler, bus error interrupts are not
> handled or acknowledged.
>
> Fixes: 2dcb8e8782d8 ("can: ctucanfd: add support for CTU CAN FD open-source
> IP core - bus independent part.") Signed-off-by: Avi Weiss
> <thnkslprpt@gmail.com>
> ---
>  drivers/net/can/ctucanfd/ctucanfd_base.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/ctucanfd/ctucanfd_base.c
> b/drivers/net/can/ctucanfd/ctucanfd_base.c index 0ea1ff28dfce..0cd2d428c1f1
> 100644
> --- a/drivers/net/can/ctucanfd/ctucanfd_base.c
> +++ b/drivers/net/can/ctucanfd/ctucanfd_base.c
> @@ -1136,8 +1136,12 @@ static irqreturn_t ctucan_interrupt(int irq, void
> *dev_id) /* Error interrupts */
>  		if (FIELD_GET(REG_INT_STAT_EWLI, isr) ||
>  		    FIELD_GET(REG_INT_STAT_FCSI, isr) ||
> -		    FIELD_GET(REG_INT_STAT_ALI, isr)) {
> -			icr = isr & (REG_INT_STAT_EWLI | REG_INT_STAT_FCSI | REG_INT_STAT_ALI);
> +		    FIELD_GET(REG_INT_STAT_ALI, isr) ||
> +		    FIELD_GET(REG_INT_STAT_BEI, isr)) {
> +			icr = isr & (REG_INT_STAT_EWLI |
> +				     REG_INT_STAT_FCSI |
> +				     REG_INT_STAT_ALI |
> +				     REG_INT_STAT_BEI);
>
>  			ctucan_netdev_dbg(ndev, "some ERR interrupt: clearing 0x%08x\n", icr);
>  			ctucan_write32(priv, CTUCANFD_INT_STAT, icr);

Acked-by: Pavel Pisa <pisa@fel.cvut.cz>


                Pavel Pisa
    phone:      +420 603531357
    e-mail:     pisa@cmp.felk.cvut.cz
    Department of Control Engineering FEE CVUT
    Karlovo namesti 13, 121 35, Prague 2
    university: http://control.fel.cvut.cz/
    personal:   http://cmp.felk.cvut.cz/~pisa
    social:     https://social.kernel.org/ppisa
    projects:   https://www.openhub.net/accounts/ppisa
    CAN related:http://canbus.pages.fel.cvut.cz/
    RISC-V education: https://comparch.edu.cvut.cz/
    Open Technologies Research Education and Exchange Services
    https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-23 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  7:44 [PATCH net] can: ctucanfd: handle bus error interrupts Avi Weiss
2026-07-23  9:23 ` Pavel Pisa
2026-07-23 10:23 ` Pavel Pisa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox