mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 09:31:26 +00:00
can: mcp251xfd: fix detection of mcp251863
In commitc6f2a617a0
("can: mcp251xfd: add support for mcp251863") support for the mcp251863 was added. However it was not taken into account that the auto detection of the chip model cannot distinguish between mcp2518fd and mcp251863 and would lead to a warning message if the firmware specifies a mcp251863. Fix auto detection: If a mcp2518fd compatible chip is found, keep the mcp251863 if specified by firmware, use mcp2518fd instead. Link: https://lore.kernel.org/all/20220706064835.1848864-1-mkl@pengutronix.de Fixes:c6f2a617a0
("can: mcp251xfd: add support for mcp251863") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
48ea8ea32d
commit
db87c005b9
@ -1690,8 +1690,8 @@ static int mcp251xfd_register_chip_detect(struct mcp251xfd_priv *priv)
|
||||
u32 osc;
|
||||
int err;
|
||||
|
||||
/* The OSC_LPMEN is only supported on MCP2518FD, so use it to
|
||||
* autodetect the model.
|
||||
/* The OSC_LPMEN is only supported on MCP2518FD and MCP251863,
|
||||
* so use it to autodetect the model.
|
||||
*/
|
||||
err = regmap_update_bits(priv->map_reg, MCP251XFD_REG_OSC,
|
||||
MCP251XFD_REG_OSC_LPMEN,
|
||||
@ -1703,10 +1703,18 @@ static int mcp251xfd_register_chip_detect(struct mcp251xfd_priv *priv)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (osc & MCP251XFD_REG_OSC_LPMEN)
|
||||
devtype_data = &mcp251xfd_devtype_data_mcp2518fd;
|
||||
else
|
||||
if (osc & MCP251XFD_REG_OSC_LPMEN) {
|
||||
/* We cannot distinguish between MCP2518FD and
|
||||
* MCP251863. If firmware specifies MCP251863, keep
|
||||
* it, otherwise set to MCP2518FD.
|
||||
*/
|
||||
if (mcp251xfd_is_251863(priv))
|
||||
devtype_data = &mcp251xfd_devtype_data_mcp251863;
|
||||
else
|
||||
devtype_data = &mcp251xfd_devtype_data_mcp2518fd;
|
||||
} else {
|
||||
devtype_data = &mcp251xfd_devtype_data_mcp2517fd;
|
||||
}
|
||||
|
||||
if (!mcp251xfd_is_251XFD(priv) &&
|
||||
priv->devtype_data.model != devtype_data->model) {
|
||||
|
Loading…
Reference in New Issue
Block a user