All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/5] can: flexcan: mark TX mailbox as TX_INACTIVE
@ 2014-09-16 14:20 Marc Kleine-Budde
  2014-09-16 14:20 ` [PATCH v4 2/5] can: flexcan: correctly initialize mailboxes Marc Kleine-Budde
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-09-16 14:20 UTC (permalink / raw)
  To: linux-can; +Cc: david, Marc Kleine-Budde

This patch fixes the initialization of the TX mailbox. It is now correctly
initialized as TX_INACTIVE not RX_EMPTY.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes since v3:
- new

 drivers/net/can/flexcan.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 630c7bf..76dcbca 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -136,6 +136,17 @@
 
 /* FLEXCAN message buffers */
 #define FLEXCAN_MB_CNT_CODE(x)		(((x) & 0xf) << 24)
+#define FLEXCAN_MB_CODE_RX_INACTIVE	(0x0 << 24)
+#define FLEXCAN_MB_CODE_RX_EMPTY	(0x4 << 24)
+#define FLEXCAN_MB_CODE_RX_FULL		(0x2 << 24)
+#define FLEXCAN_MB_CODE_RX_OVERRRUN	(0x6 << 24)
+#define FLEXCAN_MB_CODE_RX_RANSWER	(0xa << 24)
+
+#define FLEXCAN_MB_CODE_TX_INACTIVE	(0x8 << 24)
+#define FLEXCAN_MB_CODE_TX_ABORT	(0x9 << 24)
+#define FLEXCAN_MB_CODE_TX_DATA		(0xc << 24)
+#define FLEXCAN_MB_CODE_TX_TANSWER	(0xe << 24)
+
 #define FLEXCAN_MB_CNT_SRR		BIT(22)
 #define FLEXCAN_MB_CNT_IDE		BIT(21)
 #define FLEXCAN_MB_CNT_RTR		BIT(20)
@@ -867,8 +878,8 @@ static int flexcan_chip_start(struct net_device *dev)
 	netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
 	flexcan_write(reg_ctrl, &regs->ctrl);
 
-	/* Abort any pending TX, mark Mailbox as INACTIVE */
-	flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
+	/* mark TX mailbox as INACTIVE */
+	flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
 		      &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
 
 	/* acceptance mask/acceptance code (accept everything) */
-- 
2.1.0


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

end of thread, other threads:[~2014-09-16 15:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 14:20 [PATCH v4 1/5] can: flexcan: mark TX mailbox as TX_INACTIVE Marc Kleine-Budde
2014-09-16 14:20 ` [PATCH v4 2/5] can: flexcan: correctly initialize mailboxes Marc Kleine-Budde
2014-09-16 14:20 ` [PATCH v4 3/5] can: flexcan: implement workaround for errata ERR005829 Marc Kleine-Budde
2014-09-16 14:20 ` [PATCH v4 4/5] can: flexcan: put TX mailbox into TX_INACTIVE mode after tx-complete Marc Kleine-Budde
2014-09-16 15:18   ` David Jander
2014-09-16 15:28     ` Marc Kleine-Budde
2014-09-16 14:20 ` [PATCH v4 5/5] can: flexcan: increase FLEXCAN_MCR_MAXMB() macro to 7 bits Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.