diff options
author | Martin Sperl <kernel@martin.sperl.org> | 2019-05-09 16:45:10 +0000 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2020-02-09 22:38:56 +0100 |
commit | 5f3d80daf5681f34ec0f05299a5a2c7ec4f38005 (patch) | |
tree | 6012e55828045fc92889af4deaf38b99c1f35f2b | |
parent | 839efde1d3bdd59cb53a2a424c8cf3c6fc540da5 (diff) |
can: mcp25xxfd: use CRC to probe the clock for more reliable detection
To more reliably detect if the controller is connected use
crc spi commands and fail when the CRC does not match.
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
(cherry picked from commit 974eff55c1aff4c83de955fc12cb9cc5776a219c)
-rw-r--r-- | drivers/net/can/spi/mcp25xxfd/mcp25xxfd_clock.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_clock.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_clock.c index a2935b784edd..03ba25276aa4 100644 --- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_clock.c +++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_clock.c @@ -290,8 +290,13 @@ static int _mcp25xxfd_clock_probe(struct mcp25xxfd_priv *priv) mdelay(MCP25XXFD_OST_DELAY_MS); /* check clock register that the clock is ready or disabled */ - ret = mcp25xxfd_cmd_read(priv->spi, MCP25XXFD_OSC, - &priv->regs.osc); + ret = mcp25xxfd_cmd_read_regs(priv->spi, MCP25XXFD_OSC | + MCP25XXFD_ADDRESS_WITH_CRC, + &priv->regs.osc,4); + if (ret == -EILSEQ) + dev_err(&priv->spi->dev, + "CRC read of clock register resulted in a bad CRC mismatch - hw not found\n"); + if (ret) return ret; |