[U-Boot] [PATCH 2/3] net/designware: invalidate entire descriptor in dw_eth_send

Ian Campbell ijc at hellion.org.uk
Sat Apr 19 15:52:21 CEST 2014


Some platforms cannot invalidate the cache at four byte intervals, so
invalidate the entire descriptor.

Signed-off-by: Ian Campbell <ijc at hellion.org.uk>
---
 drivers/net/designware.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 1120f70..7d14cec 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -280,10 +280,13 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length)
 	u32 desc_num = priv->tx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
 
-	/* Invalidate only "status" field for the following check */
-	invalidate_dcache_range((unsigned long)&desc_p->txrx_status,
-				(unsigned long)&desc_p->txrx_status +
-				sizeof(desc_p->txrx_status));
+	/* Strictly we only need to invalidate the "status" field for
+	 * the following check, but on some platforms we cannot
+	 * invalidate only 4 bytes, so invalidate the the whole thing
+	 * which is known to be DMA aligned. */
+	invalidate_dcache_range((unsigned long)desc_p,
+				(unsigned long)desc_p +
+				sizeof(struct dmamacdescr));
 
 	/* Check if the descriptor is owned by CPU */
 	if (desc_p->txrx_status & DESC_TXSTS_OWNBYDMA) {
-- 
1.9.0



More information about the U-Boot mailing list