X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fmmc%2Ftmio-common.c;h=20cd237ef0ebccbe2bbcfb1157ca1582fdd54e65;hb=c05ed00afb95fa5237f16962fccf5810437317bf;hp=5a8506dcb6bdecadaccbb5db5690be5682e9997e;hpb=d31dd3b596190bdecbd109e404f16bd208fe32ba;p=oweals%2Fu-boot.git diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c index 5a8506dcb6..20cd237ef0 100644 --- a/drivers/mmc/tmio-common.c +++ b/drivers/mmc/tmio-common.c @@ -4,16 +4,17 @@ * Author: Masahiro Yamada */ -#include #include #include #include #include #include #include +#include #include #include -#include +#include +#include #include #include #include @@ -352,20 +353,22 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) if (poll_flag == TMIO_SD_DMA_INFO1_END_RD) udelay(1); - dma_unmap_single(buf, len, dir); + dma_unmap_single(dma_addr, len, dir); return ret; } /* check if the address is DMA'able */ -static bool tmio_sd_addr_is_dmaable(const char *src) +static bool tmio_sd_addr_is_dmaable(struct mmc_data *data) { - uintptr_t addr = (uintptr_t)src; + uintptr_t addr = (uintptr_t)data->src; if (!IS_ALIGNED(addr, TMIO_SD_DMA_MINALIGN)) return false; #if defined(CONFIG_RCAR_GEN3) + if (!(data->flags & MMC_DATA_READ) && !IS_ALIGNED(addr, 128)) + return false; /* Gen3 DMA has 32bit limit */ if (addr >> 32) return false; @@ -480,7 +483,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, if (data) { /* use DMA if the HW supports it and the buffer is aligned */ if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL && - tmio_sd_addr_is_dmaable(data->src)) + tmio_sd_addr_is_dmaable(data)) ret = tmio_sd_dma_xfer(dev, data); else ret = tmio_sd_pio_xfer(dev, cmd, data);