diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-29 16:46:22 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-29 16:46:22 -0600 |
commit | ccd12aef64fd11e46b002923f55a419c352ff0ae (patch) | |
tree | 731e297727a103ace9acce8692df75d3acc1ecce /nuttx | |
parent | 9fe1933481093de4758501196a45dada6c266992 (diff) | |
download | px4-nuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.tar.gz px4-nuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.tar.bz2 px4-nuttx-ccd12aef64fd11e46b002923f55a419c352ff0ae.zip |
Work around a start-up error in the GMAC that I still do not understand
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_emac.c | 26 | ||||
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_gmac.c | 27 |
2 files changed, 48 insertions, 5 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 */ diff --git a/nuttx/arch/arm/src/sama5/sam_gmac.c b/nuttx/arch/arm/src/sama5/sam_gmac.c index 721e467ec..3fd27156f 100644 --- a/nuttx/arch/arm/src/sama5/sam_gmac.c +++ b/nuttx/arch/arm/src/sama5/sam_gmac.c @@ -637,7 +637,8 @@ static int sam_transmit(struct sam_gmac_s *priv) uint32_t regval; uint32_t status; - nllvdbg("d_len: %d txhead: %d\n", dev->d_len, priv->txhead); + nllvdbg("d_len: %d txhead: %d txtail: %d\n", + dev->d_len, priv->txhead, priv->txtail); sam_dumppacket("Transmit packet", dev->d_buf, dev->d_len); /* Check parameter */ @@ -1184,9 +1185,29 @@ static void sam_txdone(struct sam_gmac_s *priv) if ((txdesc->status & GMACTXD_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; +#warning REVISIT + if (priv->txtail == 0 && + sam_physramaddr(txdesc) != sam_getreg(priv, SAM_GMAC_TBQB)) + { + txdesc->status = (uint32_t)GMACTXD_STA_USED; + cp15_clean_dcache((uintptr_t)txdesc, + (uintptr_t)txdesc + sizeof(struct gmac_txdesc_s)); + } + else + { + /* Otherwise, the descriptor is truly in use. Break out of the + * loop now. + */ + + break; + } } /* Increment the tail index */ |