diff options
author | Rafael Beims <rafael.beims@toradex.com> | 2022-01-18 13:38:37 -0300 |
---|---|---|
committer | Rafael Beims <rafael.beims@toradex.com> | 2022-01-26 09:53:11 -0300 |
commit | c890f227a02983865d985211e5498791287d7d8d (patch) | |
tree | 946c0beb2a595ad1ca53f26bbc3eb4697c2ff231 /drivers/net/can | |
parent | 6e2e2f8c90a5bc5bc98676936584b5bb4fe8d973 (diff) |
can: mcp25xxfd: Always reset TEF index when going out of configuration mode
This patch fixes an issue that prevents the mcp25xxfd driver from
correctly handling interface down / up cycles.
When the mcp2518fd goes into configuration mode it automatically resets
all the FIFO pointers. Reset the internal representation of the current
index by the driver when leaving configuration mode so that we don't get
failures when trying to bring up an interface that was previously
brought down.
Co-authored-by: Edward Karpicz <e.karpic@ekspla.com>
Signed-off-by: Edward Karpicz <e.karpic@ekspla.com>
Signed-off-by: Rafael Beims <rafael.beims@toradex.com>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/spi/mcp25xxfd/mcp25xxfd_can.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_can.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_can.c index 91de7ac3ec73..e8b0fe79309d 100644 --- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_can.c +++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_can.c @@ -230,6 +230,10 @@ int mcp25xxfd_can_switch_mode_no_wait(struct mcp25xxfd_priv *priv, reg = &dummy; } + /* going out of configuration mode always reset tef.index */ + if( ((*reg & MCP25XXFD_CAN_CON_OPMOD_MASK) >> MCP25XXFD_CAN_CON_OPMOD_SHIFT) == 4 ) + priv->cpriv->fifos.tef.index = 0; + /* compute the effective mode in osc*/ *reg &= ~(MCP25XXFD_CAN_CON_REQOP_MASK | MCP25XXFD_CAN_CON_OPMOD_MASK); |