[PATCH] mci: sdhci: fix dma mapping

Marco Felsch m.felsch at pengutronix.de
Mon Apr 8 09:31:01 PDT 2024


In case of MMC_DATA_READ the dest address should be used and in case of
MMC_DATA_WRITE the src address should be used. We had no issues for now
since both dest and src point to same address due to the union.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 drivers/mci/sdhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index edb819d66d42..a141e504971b 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -233,10 +233,10 @@ void sdhci_setup_data_dma(struct sdhci *sdhci, struct mci_data *data,
 	nbytes = data->blocks * data->blocksize;
 
 	if (data->flags & MMC_DATA_READ)
-		*dma = dma_map_single(dev, (void *)data->src, nbytes,
+		*dma = dma_map_single(dev, data->dest, nbytes,
 				      DMA_FROM_DEVICE);
 	else
-		*dma = dma_map_single(dev, data->dest, nbytes,
+		*dma = dma_map_single(dev, (void *)data->src, nbytes,
 				      DMA_TO_DEVICE);
 
 	if (dma_mapping_error(dev, *dma)) {
-- 
2.39.2




More information about the barebox mailing list