Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] can: xilinx_can: Fix missing Rx can packets on CANFD2.0
@ 2019-12-03 11:12 Srinivas Neeli
  2019-12-03 11:16 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Neeli @ 2019-12-03 11:12 UTC (permalink / raw)
  To: wg, mkl, davem, michal.simek, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, git, nagasure,
	Srinivas Neeli

CANFD2.0 core uses BRAM for storing acceptance filter ID(AFID) and MASK
(AFMASK)registers. So by default AFID and AFMASK registers contain random
data. Due to random data, not able to receive all CAN ids.

Initializing AFID and AFMASK registers with Zero before enabling
acceptance filter to receive all packets irrespective of ID and Mask.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 464af939cd8a..c1dbab8c896d 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -60,6 +60,8 @@ enum xcan_reg {
 	XCAN_TXMSG_BASE_OFFSET	= 0x0100, /* TX Message Space */
 	XCAN_RXMSG_BASE_OFFSET	= 0x1100, /* RX Message Space */
 	XCAN_RXMSG_2_BASE_OFFSET	= 0x2100, /* RX Message Space */
+	XCAN_AFR_2_MASK_OFFSET	= 0x0A00, /* Acceptance Filter MASK */
+	XCAN_AFR_2_ID_OFFSET	= 0x0A04, /* Acceptance Filter ID */
 };
 
 #define XCAN_FRAME_ID_OFFSET(frame_base)	((frame_base) + 0x00)
@@ -1809,6 +1811,11 @@ static int xcan_probe(struct platform_device *pdev)
 
 	pm_runtime_put(&pdev->dev);
 
+	if (priv->devtype.flags & XCAN_FLAG_CANFD_2) {
+		priv->write_reg(priv, XCAN_AFR_2_ID_OFFSET, 0x00000000);
+		priv->write_reg(priv, XCAN_AFR_2_MASK_OFFSET, 0x00000000);
+	}
+
 	netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n",
 		   priv->reg_base, ndev->irq, priv->can.clock.freq,
 		   hw_tx_max, priv->tx_max);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: xilinx_can: Fix missing Rx can packets on CANFD2.0
  2019-12-03 11:12 [PATCH] can: xilinx_can: Fix missing Rx can packets on CANFD2.0 Srinivas Neeli
@ 2019-12-03 11:16 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2019-12-03 11:16 UTC (permalink / raw)
  To: Srinivas Neeli, wg, davem, michal.simek, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, git, nagasure

[-- Attachment #1.1: Type: text/plain, Size: 1060 bytes --]

On 12/3/19 12:12 PM, Srinivas Neeli wrote:
> CANFD2.0 core uses BRAM for storing acceptance filter ID(AFID) and MASK
> (AFMASK)registers. So by default AFID and AFMASK registers contain random
> data. Due to random data, not able to receive all CAN ids.
> 
> Initializing AFID and AFMASK registers with Zero before enabling
> acceptance filter to receive all packets irrespective of ID and Mask.
> 
> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
> Reviewed-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Please add a "Fixes:" tag.

Some nitpicks: Please add your S-o-B as the last one. Further I'd be
happier, if Naga Sureshkumar Relli adds the Reviewed-by in a seperate mail.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 11:12 [PATCH] can: xilinx_can: Fix missing Rx can packets on CANFD2.0 Srinivas Neeli
2019-12-03 11:16 ` Marc Kleine-Budde

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git