public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] net/designware: invalidate entire descriptor in dw_eth_send
Date: Sat, 19 Apr 2014 14:52:21 +0100	[thread overview]
Message-ID: <1397915542-987-2-git-send-email-ijc@hellion.org.uk> (raw)
In-Reply-To: <1397914214.19277.50.camel@hastur.hellion.org.uk>

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

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

  parent reply	other threads:[~2014-04-19 13:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOay_bwoK_U8aNJuu0CSMhvUAzkVHvN=VzPiK=2cB2+bcah0FA@mail.gmail.com>
2014-04-19 13:30 ` [U-Boot] [linux-sunxi] Uboot error: address not aligned in v7_dcache_inval_range Ian Campbell
2014-04-19 13:52   ` [U-Boot] [PATCH 1/3] net/designware: ensure device private data is DMA aligned Ian Campbell
2014-04-24 17:22     ` Alexey Brodkin
2014-04-26 18:27     ` Marek Vasut
2014-04-19 13:52   ` Ian Campbell [this message]
     [not found]     ` <jwv38h9v2cg.fsf-monnier+gmane.comp.hardware.netbook.arm.sunxi@gnu.org>
2014-04-19 14:32       ` [U-Boot] [linux-sunxi] Re: [PATCH 2/3] net/designware: invalidate entire descriptor in dw_eth_send Ian Campbell
2014-04-24 17:41     ` [U-Boot] " Alexey Brodkin
2014-04-24 19:14       ` Ian Campbell
2014-04-25  8:48         ` Alexey Brodkin
2014-04-27 18:47           ` Ian Campbell
2014-04-28 12:05             ` Alexey Brodkin
2014-04-28 19:34               ` Ian Campbell
2014-04-25  0:58       ` Stefan Monnier
2014-04-19 13:52   ` [U-Boot] [PATCH 3/3] net/designware: align cache invalidation on rx Ian Campbell
2014-04-20  5:43     ` [U-Boot] [linux-sunxi] " Shixin Zeng
2014-04-20  5:16   ` [U-Boot] [linux-sunxi] Uboot error: address not aligned in v7_dcache_inval_range Shixin Zeng
2014-04-26 18:27   ` Marek Vasut
2014-04-27 18:40     ` Ian Campbell
2014-04-27 19:14       ` Marek Vasut
2014-04-28 19:55     ` Ian Campbell
2014-04-28 20:21       ` Marek Vasut
2014-05-01 18:43         ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397915542-987-2-git-send-email-ijc@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox