From: David Jander <david@protonic.nl>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org, David Jander <david@protonic.nl>
Subject: RFC: [PATCH v2] can: flexcan: Implement errata ERR005829
Date: Wed, 3 Sep 2014 16:47:22 +0200 [thread overview]
Message-ID: <1409755642-28233-1-git-send-email-david@protonic.nl> (raw)
Signed-off-by: David Jander <david@protonic.nl>
---
changed from v1:
- Implemented complete workaround and based on linux-can/testing
drivers/net/can/flexcan.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 0bcbb96..d9d0ecb 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -125,7 +125,9 @@
FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)
/* FLEXCAN interrupt flag register (IFLAG) bits */
-#define FLEXCAN_TX_BUF_ID 8
+/* Errata ERR005829 step7: Reserve first valid MB */
+#define FLEXCAN_FIRST_VALID_MB 8
+#define FLEXCAN_TX_BUF_ID 9
#define FLEXCAN_IFLAG_BUF(x) BIT(x)
#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7)
#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6)
@@ -428,6 +430,12 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
+ /* Errata ERR005829 step8: Write twice INACTIVE(0x8) code to first MB */
+ flexcan_write(FLEXCAN_MB_CNT_CODE(0x8),
+ ®s->cantxfg[FLEXCAN_FIRST_VALID_MB].can_ctrl);
+ flexcan_write(FLEXCAN_MB_CNT_CODE(0x8),
+ ®s->cantxfg[FLEXCAN_FIRST_VALID_MB].can_ctrl);
+
return NETDEV_TX_OK;
}
--
1.9.1
next reply other threads:[~2014-09-03 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 14:47 David Jander [this message]
[not found] ` <54081940.6060402@pengutronix.de>
[not found] ` <20140904104440.5766d764@archvile>
2014-09-16 11:48 ` RFC: [PATCH v2] can: flexcan: Implement errata ERR005829 Marc Kleine-Budde
2014-09-16 12:28 ` David Jander
2014-09-16 12:58 ` Marc Kleine-Budde
2014-09-16 14:29 ` Marc Kleine-Budde
2014-09-18 13:50 ` David Jander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409755642-28233-1-git-send-email-david@protonic.nl \
--to=david@protonic.nl \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).