public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <b51431@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc:fsl_esdhc invalidate dcache before read
Date: Fri, 10 Jul 2015 08:21:38 +0800	[thread overview]
Message-ID: <20150710002136.GA8978@shlinux2> (raw)
In-Reply-To: <1435199546-12292-1-git-send-email-Peng.Fan@freescale.com>

Ping. Anyone review/apply this patch?

On Thu, Jun 25, 2015 at 10:32:26AM +0800, Peng Fan wrote:
>DCIMVAC is upgraded to DCCIMVAC for the individual processor
>(Cortex-A7) that the DCIMVAC is executed on.
>
>We should follow the linux dma follow. Before DMA read, first
>invalidate dcache then after DMA read, invalidate dcache again.
>
>With the DMA direction DMA_FROM_DEVICE, the dcache need be
>invalidated again after the DMA completion. The reason is
>that we need explicity make sure the dcache been invalidated
>thus to get the DMA'ed memory correctly from the physical memory.
>Any cache-line fill during the DMA operations such as the
>pre-fetching can cause the DMA coherency issue, thus CPU get the stale data.
>
>Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>Signed-off-by: Ye.Li <B37916@freescale.com>
>Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
>Signed-off-by: Jason Liu <r64343@freescale.com>
>---
> drivers/mmc/fsl_esdhc.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
>index c4719e6..0510bf0 100644
>--- a/drivers/mmc/fsl_esdhc.c
>+++ b/drivers/mmc/fsl_esdhc.c
>@@ -341,6 +341,9 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
> 		err = esdhc_setup_data(mmc, data);
> 		if(err)
> 			return err;
>+
>+		if (data->flags & MMC_DATA_READ)
>+			check_and_invalidate_dcache_range(cmd, data);
> 	}
> 
> 	/* Figure out the transfer arguments */
>@@ -437,6 +440,11 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
> 			}
> 		} while ((irqstat & DATA_COMPLETE) != DATA_COMPLETE);
> 
>+		/*
>+		 * Need invalidate the dcache here again to avoid any
>+		 * cache-fill during the DMA operations such as the
>+		 * speculative pre-fetching etc.
>+		 */
> 		if (data->flags & MMC_DATA_READ)
> 			check_and_invalidate_dcache_range(cmd, data);
> #endif
>-- 
>1.8.4
>
>
>_______________________________________________
>U-Boot mailing list
>U-Boot at lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Peng.
-- 

  reply	other threads:[~2015-07-10  0:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25  2:32 [U-Boot] [PATCH] mmc:fsl_esdhc invalidate dcache before read Peng Fan
2015-07-10  0:21 ` Peng Fan [this message]
2015-07-10  7:56 ` Stefano Babic
2015-07-11  2:43   ` Peng Fan
2015-07-26 10:20     ` Stefano Babic
2015-07-27 16:36       ` York Sun
2015-07-27 18:15         ` York Sun
2015-07-27 18:55           ` Stefano Babic

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=20150710002136.GA8978@shlinux2 \
    --to=b51431@freescale.com \
    --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