diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-09-16 15:31:27 +0200 |
---|---|---|
committer | Zefan Li <lizefan@huawei.com> | 2014-12-01 18:02:36 +0800 |
commit | a125f73de40225692d7f0e722d452aad65467b8f (patch) | |
tree | 2e215716930b42a3f6c8b0c349ce4132425e57f5 /drivers | |
parent | a6cdbaecaa2575bd2f0dd290ff83cfe2dae06959 (diff) |
can: flexcan: put TX mailbox into TX_INACTIVE mode after tx-complete
commit de5944883ebbedbf5adc8497659772f5da7b7d72 upstream.
After sending a RTR frame the TX mailbox becomes a RX_EMPTY mailbox. To avoid
side effects when the RX-FIFO is full, this patch puts the TX mailbox into
TX_INACTIVE mode in the transmission complete interrupt handler. This, of
course, leaves a race window between the actual completion of the transmission
and the handling of tx-complete interrupt. However this is the best we can do
without busy polling the tx complete interrupt.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/can/flexcan.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 681fb9c8c959..b523e656dc0b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -633,6 +633,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) { stats->tx_bytes += can_get_echo_skb(dev, 0); stats->tx_packets++; + /* after sending a RTR frame mailbox is in RX mode */ + flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, + ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); netif_wake_queue(dev); } |