* pull-request: can 2021-04-06
@ 2021-04-06 10:36 Marc Kleine-Budde
2021-04-06 10:36 ` [net] can: mcp251x: fix support for half duplex SPI host controllers Marc Kleine-Budde
2021-04-06 23:40 ` pull-request: can 2021-04-06 patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-04-06 10:36 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel
Hello Jakub, hello David,
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.
regards,
Marc
---
The following changes since commit 08c27f3322fec11950b8f1384aa0f3b11d028528:
batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field (2021-04-05 15:06:03 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.12-20210406
for you to fetch changes up to 617085fca6375e2c1667d1fbfc6adc4034c85f04:
can: mcp251x: fix support for half duplex SPI host controllers (2021-04-06 12:31:21 +0200)
----------------------------------------------------------------
linux-can-fixes-for-5.12-20210406
----------------------------------------------------------------
Marc Kleine-Budde (1):
can: mcp251x: fix support for half duplex SPI host controllers
drivers/net/can/spi/mcp251x.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread* [net] can: mcp251x: fix support for half duplex SPI host controllers 2021-04-06 10:36 pull-request: can 2021-04-06 Marc Kleine-Budde @ 2021-04-06 10:36 ` Marc Kleine-Budde 2021-04-06 23:40 ` patchwork-bot+netdevbpf 2021-04-06 23:40 ` pull-request: can 2021-04-06 patchwork-bot+netdevbpf 1 sibling, 1 reply; 4+ messages in thread From: Marc Kleine-Budde @ 2021-04-06 10:36 UTC (permalink / raw) To: netdev Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, Tim Harvey, Gerhard Bertelsmann Some SPI host controllers do not support full-duplex SPI transfers. The function mcp251x_spi_trans() does a full duplex transfer. It is used in several places in the driver, where a TX half duplex transfer is sufficient. To fix support for half duplex SPI host controllers, this patch introduces a new function mcp251x_spi_write() and changes all callers that do a TX half duplex transfer to use mcp251x_spi_write(). Fixes: e0e25001d088 ("can: mcp251x: add support for half duplex controllers") Link: https://lore.kernel.org/r/20210330100246.1074375-1-mkl@pengutronix.de Cc: Tim Harvey <tharvey@gateworks.com> Tested-By: Tim Harvey <tharvey@gateworks.com> Reported-by: Gerhard Bertelsmann <info@gerhard-bertelsmann.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/spi/mcp251x.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index f69fb4238a65..a57da43680d8 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -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; base-commit: 08c27f3322fec11950b8f1384aa0f3b11d028528 -- 2.30.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net] can: mcp251x: fix support for half duplex SPI host controllers 2021-04-06 10:36 ` [net] can: mcp251x: fix support for half duplex SPI host controllers Marc Kleine-Budde @ 2021-04-06 23:40 ` patchwork-bot+netdevbpf 0 siblings, 0 replies; 4+ messages in thread From: patchwork-bot+netdevbpf @ 2021-04-06 23:40 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel, tharvey, info Hello: This patch was applied to netdev/net.git (refs/heads/master): On Tue, 6 Apr 2021 12:36:06 +0200 you wrote: > Some SPI host controllers do not support full-duplex SPI transfers. > > The function mcp251x_spi_trans() does a full duplex transfer. It is > used in several places in the driver, where a TX half duplex transfer > is sufficient. > > To fix support for half duplex SPI host controllers, this patch > introduces a new function mcp251x_spi_write() and changes all callers > that do a TX half duplex transfer to use mcp251x_spi_write(). > > [...] Here is the summary with links: - [net] can: mcp251x: fix support for half duplex SPI host controllers https://git.kernel.org/netdev/net/c/617085fca637 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pull-request: can 2021-04-06 2021-04-06 10:36 pull-request: can 2021-04-06 Marc Kleine-Budde 2021-04-06 10:36 ` [net] can: mcp251x: fix support for half duplex SPI host controllers Marc Kleine-Budde @ 2021-04-06 23:40 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 4+ messages in thread From: patchwork-bot+netdevbpf @ 2021-04-06 23:40 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel Hello: This pull request was applied to netdev/net.git (refs/heads/master): On Tue, 6 Apr 2021 12:36:05 +0200 you wrote: > Hello Jakub, hello David, > > 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. > > [...] Here is the summary with links: - pull-request: can 2021-04-06 https://git.kernel.org/netdev/net/c/f57796a4b80b You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-06 23:40 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-06 10:36 pull-request: can 2021-04-06 Marc Kleine-Budde 2021-04-06 10:36 ` [net] can: mcp251x: fix support for half duplex SPI host controllers Marc Kleine-Budde 2021-04-06 23:40 ` patchwork-bot+netdevbpf 2021-04-06 23:40 ` pull-request: can 2021-04-06 patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).