summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/sama5/sam_emac.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-29 16:46:22 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-29 16:46:22 -0600
commitccd12aef64fd11e46b002923f55a419c352ff0ae (patch)
tree731e297727a103ace9acce8692df75d3acc1ecce /nuttx/arch/arm/src/sama5/sam_emac.c
parent9fe1933481093de4758501196a45dada6c266992 (diff)
downloadnuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.tar.gz
nuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.tar.bz2
nuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.zip
Work around a start-up error in the GMAC that I still do not understand
Diffstat (limited to 'nuttx/arch/arm/src/sama5/sam_emac.c')
-rw-r--r--nuttx/arch/arm/src/sama5/sam_emac.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_emac.c b/nuttx/arch/arm/src/sama5/sam_emac.c
index 878e43ca2..c169bacb6 100644
--- a/nuttx/arch/arm/src/sama5/sam_emac.c
+++ b/nuttx/arch/arm/src/sama5/sam_emac.c
@@ -1247,9 +1247,31 @@ static void sam_txdone(struct sam_emac_s *priv)
if ((txdesc->status & EMACTXD_STA_USED) == 0)
{
- /* Yes ... break out of the loop now */
+ /* Yes.. the descriptor is still in use. However, I have seen a
+ * case (only repeatable on start-up) where the USED bit is never
+ * set. Yikes! If we have encountered the first still busy
+ * descriptor, then we should also have TQBD equal to the descriptor
+ * address. If it is not, then treat is as used anyway.
+ */
- break;
+#if 0 /* The issue does not exist in the current configuration, but may return */
+#warning REVISIT
+ if (priv->txtail == 0 &&
+ sam_physramaddr((uintprt_t)txdesc) != sam_getreg(priv, SAM_EMAC_TBQP))
+ {
+ txdesc->status = (uint32_t)EMACTXD_STA_USED;
+ cp15_clean_dcache((uintptr_t)txdesc,
+ (uintptr_t)txdesc + sizeof(struct emac_txdesc_s));
+ }
+ else
+#endif
+ {
+ /* Otherwise, the descriptor is truly in use. Break out of the
+ * loop now.
+ */
+
+ break;
+ }
}
/* Increment the tail index */