[U-Boot] [PATCH] ls2085a: esdhc: flush D-cache before 'mmc read'

Yangbo Lu yangbo.lu at freescale.com
Wed Jun 24 04:13:28 CEST 2015


It needs to flush D-cache before 'mmc read' so that
we can see the right data in DDR. And fix parameter
for invalidate_dcache_range() after 'mmc read'.

Signed-off-by: Yangbo Lu <yangbo.lu at freescale.com>
Cc: York Sun <yorksun at freescale.com>
---
 drivers/mmc/fsl_esdhc.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index c4719e6..3ca25bd 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -192,6 +192,17 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 	wml_value = data->blocksize/4;
 
 	if (data->flags & MMC_DATA_READ) {
+#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
+#ifdef CONFIG_LS2085A
+		/*
+		 * It's temporary for ls2085a so that
+		 * we can see right data in DDR
+		 */
+		flush_dcache_range((ulong)data->dest,
+				   (ulong)data->dest+data->blocks
+					 *data->blocksize);
+#endif
+#endif
 		if (wml_value > WML_RD_WML_MAX)
 			wml_value = WML_RD_WML_MAX_VAL;
 
@@ -278,14 +289,9 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
 static void check_and_invalidate_dcache_range
 	(struct mmc_cmd *cmd,
 	 struct mmc_data *data) {
-#ifdef CONFIG_LS2085A
-	unsigned start = 0;
-#else
-	unsigned start = (unsigned)data->dest ;
-#endif
+	unsigned start, end;
 	unsigned size = roundup(ARCH_DMA_MINALIGN,
 				data->blocks*data->blocksize);
-	unsigned end = start+size ;
 #ifdef CONFIG_LS2085A
 	dma_addr_t addr;
 
@@ -294,7 +300,10 @@ static void check_and_invalidate_dcache_range
 		printf("Error found for upper 32 bits\n");
 	else
 		start = lower_32_bits(addr);
+#else
+	start = (unsigned)data->dest;
 #endif
+	end = start + size;
 	invalidate_dcache_range(start, end);
 }
 #endif
-- 
2.1.0.27.g96db324



More information about the U-Boot mailing list