From 7312da3cf92748bb44bb78a104271c88897151fd Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 21 Feb 2017 16:46:34 +0100
Subject: [PATCH] minic: assert tx fifo is not full

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 dev/minic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dev/minic.c b/dev/minic.c
index b0cf57a6e..a5b289536 100644
--- a/dev/minic.c
+++ b/dev/minic.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <wrc.h>
 #include <wrpc.h>
+#include <assert.h>
 
 #include "types.h"
 #include "board.h"
@@ -269,8 +270,9 @@ int minic_tx_frame(struct wr_ethhdr_vlan *hdr, uint8_t *payload, uint32_t size,
 		minic_txword(WRF_OOB, WRPC_FID);
 	}
 
-	/* Start sending the frame */
+	/* Start sending the frame, and while we read mcr check for fifo full */
 	mcr = minic_readl(MINIC_REG_MCR);
+	assert((mcr & MINIC_MCR_TX_FULL) == 0, "Minic tx fifo full");
 	minic_writel(MINIC_REG_MCR, mcr | MINIC_MCR_TX_START);
 
 	/* wait for the DMA to finish */
-- 
GitLab