diff options
author | Jeppe Ledet-Pedersen <jlp@gomspace.com> | 2015-04-29 11:05:01 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-05-01 04:11:46 -0400 |
commit | 5793affe8c723ece8114b898ab9003c7d97f86d1 (patch) | |
tree | f800108f026f376b55899845adff6f56080787c7 | |
parent | e813bb2b955d9f72c94be7d592746b49929a499b (diff) |
net: can: xilinx_can: fix extended frame handling
Using IDR_SRR in RXFIFO_ID to test for the presence of data is only
valid for standard frames. For extended frames the bit is always 1 and
IDR_RTR should be used instead. This patch switches the check to use
CAN_RTR_FLAG which is correctly set when reading the ID.
The patch also changes the DW1/DW2 to be read unconditionally, since
this is necessary to remove the frame from the RXFIFO.
Signed-off-by: Jeppe Ledet-Pedersen <jlp@gomspace.com>
Acked-by: Kedareswara rao Appana <appanad@xilinx.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r-- | drivers/net/can/xilinx_can.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 6bddfe062b51..fc55e8e0351d 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c | |||
@@ -509,10 +509,11 @@ static int xcan_rx(struct net_device *ndev) | |||
509 | cf->can_id |= CAN_RTR_FLAG; | 509 | cf->can_id |= CAN_RTR_FLAG; |
510 | } | 510 | } |
511 | 511 | ||
512 | if (!(id_xcan & XCAN_IDR_SRR_MASK)) { | 512 | /* DW1/DW2 must always be read to remove message from RXFIFO */ |
513 | data[0] = priv->read_reg(priv, XCAN_RXFIFO_DW1_OFFSET); | 513 | data[0] = priv->read_reg(priv, XCAN_RXFIFO_DW1_OFFSET); |
514 | data[1] = priv->read_reg(priv, XCAN_RXFIFO_DW2_OFFSET); | 514 | data[1] = priv->read_reg(priv, XCAN_RXFIFO_DW2_OFFSET); |
515 | 515 | ||
516 | if (!(cf->can_id & CAN_RTR_FLAG)) { | ||
516 | /* Change Xilinx CAN data format to socketCAN data format */ | 517 | /* Change Xilinx CAN data format to socketCAN data format */ |
517 | if (cf->can_dlc > 0) | 518 | if (cf->can_dlc > 0) |
518 | *(__be32 *)(cf->data) = cpu_to_be32(data[0]); | 519 | *(__be32 *)(cf->data) = cpu_to_be32(data[0]); |