Skip to content

Commit

Permalink
drivers/can/sja1000: fix Rx buffer pointer issue
Browse files Browse the repository at this point in the history
When initialising the SJA1000 peripheral on some implementations
(SJA1000_FDTOL), "releasing" the buffer when the Rx buffer is empty
causes a buffer pointer misalignment.

On peripheral initialise, remove the flag to "release" the buffer.
This should be safe for all systems using the SJA1000 CAN controller
as a "reset" to the peripheral clears the Rx FIFO.
  • Loading branch information
rtucker85 authored and xiaoxiang781216 committed Jun 17, 2024
1 parent 8e30c13 commit 6953814
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/can/sja1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,11 @@ static void sja1000_reset(struct can_dev_s *dev)
sja1000_putreg(priv, SJA1000_MODE_REG, 0);
}

/* Abort transmission, release RX buffer and clear overrun.
/* Abort transmission and clear overrun.
* Command register can only be modified when in Operation Mode.
*/

sja1000_putreg(priv, SJA1000_CMD_REG, SJA1000_ABORT_TX_M
| SJA1000_RELEASE_BUF_M
| SJA1000_CLR_OVERRUN_M);
sja1000_write_cmdreg(priv, SJA1000_ABORT_TX_M | SJA1000_CLR_OVERRUN_M);

#ifdef CONFIG_ARCH_HAVE_MULTICPU
spin_unlock_irqrestore(&priv->lock, flags);
Expand Down

0 comments on commit 6953814

Please sign in to comment.