* pull-request: can 2012-09-04 @ 2012-09-04 20:55 Marc Kleine-Budde 2012-09-04 20:55 ` [PATCH] can: mcp251x: avoid repeated frame bug Marc Kleine-Budde 2012-09-05 19:12 ` pull-request: can 2012-09-04 David Miller 0 siblings, 2 replies; 3+ messages in thread From: Marc Kleine-Budde @ 2012-09-04 20:55 UTC (permalink / raw) To: davem; +Cc: netdev, linux-can Hello David, this patch is for the v3.6 release cycle. Benoît Locher fixed a repeated frame bug in the mcp251x driver. He implemented the workaround suggested by the errata sheet. regards, Marc -- The following changes since commit 5002200599429e83fc13e0d9a2d4788b79515b0c: net: qmi_wwan: add several new Gobi devices (2012-09-01 22:49:34 -0400) are available in the git repository at: git://gitorious.org/linux-can/linux-can.git fixes-for-3.6 for you to fetch changes up to cab32f39dcc5b35db96497dc0a026b5dea76e4e7: can: mcp251x: avoid repeated frame bug (2012-09-03 20:12:06 +0200) ---------------------------------------------------------------- Benoît Locher (1): can: mcp251x: avoid repeated frame bug drivers/net/can/mcp251x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] can: mcp251x: avoid repeated frame bug 2012-09-04 20:55 pull-request: can 2012-09-04 Marc Kleine-Budde @ 2012-09-04 20:55 ` Marc Kleine-Budde 2012-09-05 19:12 ` pull-request: can 2012-09-04 David Miller 1 sibling, 0 replies; 3+ messages in thread From: Marc Kleine-Budde @ 2012-09-04 20:55 UTC (permalink / raw) To: davem; +Cc: netdev, linux-can, Benoît Locher, stable, Marc Kleine-Budde From: Benoît Locher <Benoit.Locher@skf.com> The MCP2515 has a silicon bug causing repeated frame transmission, see section 5 of MCP2515 Rev. B Silicon Errata Revision G (March 2007). Basically, setting TXBnCTRL.TXREQ in either SPI mode (00 or 11) will eventually cause the bug. The workaround proposed by Microchip is to use mode 00 and send a RTS command on the SPI bus to initiate the transmission. Cc: <stable@vger.kernel.org> Signed-off-by: Benoît Locher <Benoit.Locher@skf.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/mcp251x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index a580db2..26e7129 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c @@ -83,6 +83,11 @@ #define INSTRUCTION_LOAD_TXB(n) (0x40 + 2 * (n)) #define INSTRUCTION_READ_RXB(n) (((n) == 0) ? 0x90 : 0x94) #define INSTRUCTION_RESET 0xC0 +#define RTS_TXB0 0x01 +#define RTS_TXB1 0x02 +#define RTS_TXB2 0x04 +#define INSTRUCTION_RTS(n) (0x80 | ((n) & 0x07)) + /* MPC251x registers */ #define CANSTAT 0x0e @@ -397,6 +402,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, int tx_buf_idx) { + struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); u32 sid, eid, exide, rtr; u8 buf[SPI_TRANSFER_BUF_LEN]; @@ -418,7 +424,10 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, buf[TXBDLC_OFF] = (rtr << DLC_RTR_SHIFT) | frame->can_dlc; memcpy(buf + TXBDAT_OFF, frame->data, frame->can_dlc); mcp251x_hw_tx_frame(spi, buf, frame->can_dlc, tx_buf_idx); - mcp251x_write_reg(spi, TXBCTRL(tx_buf_idx), TXBCTRL_TXREQ); + + /* 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); } static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, -- 1.7.10 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: pull-request: can 2012-09-04 2012-09-04 20:55 pull-request: can 2012-09-04 Marc Kleine-Budde 2012-09-04 20:55 ` [PATCH] can: mcp251x: avoid repeated frame bug Marc Kleine-Budde @ 2012-09-05 19:12 ` David Miller 1 sibling, 0 replies; 3+ messages in thread From: David Miller @ 2012-09-05 19:12 UTC (permalink / raw) To: mkl; +Cc: netdev, linux-can From: Marc Kleine-Budde <mkl@pengutronix.de> Date: Tue, 4 Sep 2012 22:55:41 +0200 > this patch is for the v3.6 release cycle. Benoît Locher fixed a repeated frame > bug in the mcp251x driver. He implemented the workaround suggested by the > errata sheet. ... > git://gitorious.org/linux-can/linux-can.git fixes-for-3.6 Pulled, thanks Marc. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-05 19:12 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-09-04 20:55 pull-request: can 2012-09-04 Marc Kleine-Budde 2012-09-04 20:55 ` [PATCH] can: mcp251x: avoid repeated frame bug Marc Kleine-Budde 2012-09-05 19:12 ` pull-request: can 2012-09-04 David Miller
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).