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

Signed-off-by: Ian Campbell <i...@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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to