linux-can-fixes-for-5.12-20210406
-----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmBsOJcTHG1rbEBwZW5n dXRyb25peC5kZQAKCRCpyVqK+u3vqWR9B/4zU7gK2vJ1HfN8zk4pHrCde5KGuqyJ 8Neh73b6p6u/4fssUtKigmMmdcEDbjAM7fWxrIA13RVbUXgpye98ikZAQPQRlwLY WWAEY9RZ97uEWUKAx5J4TKxSbq81c649t7NHvnhJqLWdHZ9WPhTIqo3AuLhrSqP8 ezszCZbiiu+AJIJzpcMeWFWowYo7/uFbrc/F5nz+2Xb9jp83n2yUYcp6S6XYIsZw I1lZqlQX6PQ6cRJKugxX5DkXy8VO2Xi+sm+YwE5Bj3NLTC70DgEIEpNDPch3g6mu uKChSuyjCj2emCCBbnkGK3azdnW4wbtbhF913puw/crb38DNlCi/XlTi =JN6W -----END PGP SIGNATURE----- Merge tag 'linux-can-fixes-for-5.12-20210406' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can Marc Kleine-Budde says: ==================== pull-request: can 2021-04-06 this is a pull request of 1 patch for net/master. The patch is by me and fixes the SPI half duplex support in the mcp251x CAN driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
f57796a4b8
@ -314,6 +314,18 @@ static int mcp251x_spi_trans(struct spi_device *spi, int len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mcp251x_spi_write(struct spi_device *spi, int len)
|
||||
{
|
||||
struct mcp251x_priv *priv = spi_get_drvdata(spi);
|
||||
int ret;
|
||||
|
||||
ret = spi_write(spi, priv->spi_tx_buf, len);
|
||||
if (ret)
|
||||
dev_err(&spi->dev, "spi write failed: ret = %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u8 mcp251x_read_reg(struct spi_device *spi, u8 reg)
|
||||
{
|
||||
struct mcp251x_priv *priv = spi_get_drvdata(spi);
|
||||
@ -361,7 +373,7 @@ static void mcp251x_write_reg(struct spi_device *spi, u8 reg, u8 val)
|
||||
priv->spi_tx_buf[1] = reg;
|
||||
priv->spi_tx_buf[2] = val;
|
||||
|
||||
mcp251x_spi_trans(spi, 3);
|
||||
mcp251x_spi_write(spi, 3);
|
||||
}
|
||||
|
||||
static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2)
|
||||
@ -373,7 +385,7 @@ static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2)
|
||||
priv->spi_tx_buf[2] = v1;
|
||||
priv->spi_tx_buf[3] = v2;
|
||||
|
||||
mcp251x_spi_trans(spi, 4);
|
||||
mcp251x_spi_write(spi, 4);
|
||||
}
|
||||
|
||||
static void mcp251x_write_bits(struct spi_device *spi, u8 reg,
|
||||
@ -386,7 +398,7 @@ static void mcp251x_write_bits(struct spi_device *spi, u8 reg,
|
||||
priv->spi_tx_buf[2] = mask;
|
||||
priv->spi_tx_buf[3] = val;
|
||||
|
||||
mcp251x_spi_trans(spi, 4);
|
||||
mcp251x_spi_write(spi, 4);
|
||||
}
|
||||
|
||||
static u8 mcp251x_read_stat(struct spi_device *spi)
|
||||
@ -618,7 +630,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf,
|
||||
buf[i]);
|
||||
} else {
|
||||
memcpy(priv->spi_tx_buf, buf, TXBDAT_OFF + len);
|
||||
mcp251x_spi_trans(spi, TXBDAT_OFF + len);
|
||||
mcp251x_spi_write(spi, TXBDAT_OFF + len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -650,7 +662,7 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame,
|
||||
|
||||
/* use INSTRUCTION_RTS, to avoid "repeated frame problem" */
|
||||
priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx);
|
||||
mcp251x_spi_trans(priv->spi, 1);
|
||||
mcp251x_spi_write(priv->spi, 1);
|
||||
}
|
||||
|
||||
static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
|
||||
@ -888,7 +900,7 @@ static int mcp251x_hw_reset(struct spi_device *spi)
|
||||
mdelay(MCP251X_OST_DELAY_MS);
|
||||
|
||||
priv->spi_tx_buf[0] = INSTRUCTION_RESET;
|
||||
ret = mcp251x_spi_trans(spi, 1);
|
||||
ret = mcp251x_spi_write(spi, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user