From: Ian Campbell Date: Sat, 19 Apr 2014 14:52:21 +0100 Subject: [U-Boot] [PATCH 2/3] net/designware: invalidate entire descriptor in dw_eth_send In-Reply-To: <1397914214.19277.50.camel@hastur.hellion.org.uk> References: <1397914214.19277.50.camel@hastur.hellion.org.uk> Message-ID: <1397915542-987-2-git-send-email-ijc@hellion.org.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Some platforms cannot invalidate the cache at four byte intervals, so invalidate the entire descriptor. Signed-off-by: Ian Campbell --- 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