Work around a start-up error in the GMAC that I still do not understand

This commit is contained in:
Gregory Nutt
2013-09-29 16:46:22 -06:00
parent 0e5caa2ae3
commit fbf5359a39
2 changed files with 48 additions and 5 deletions
+24 -2
View File
@@ -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 */
+24 -3
View File
@@ -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 */