|
|
@ -372,11 +372,19 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* check if the address is DMA'able */ |
|
|
|
/* check if the address is DMA'able */ |
|
|
|
static bool tmio_sd_addr_is_dmaable(unsigned long addr) |
|
|
|
static bool tmio_sd_addr_is_dmaable(const char *src) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
uintptr_t addr = (uintptr_t)src; |
|
|
|
|
|
|
|
|
|
|
|
if (!IS_ALIGNED(addr, TMIO_SD_DMA_MINALIGN)) |
|
|
|
if (!IS_ALIGNED(addr, TMIO_SD_DMA_MINALIGN)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_RCAR_GEN3) |
|
|
|
|
|
|
|
/* Gen3 DMA has 32bit limit */ |
|
|
|
|
|
|
|
if (addr >> 32) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARM64) && \ |
|
|
|
#if defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARM64) && \ |
|
|
|
defined(CONFIG_SPL_BUILD) |
|
|
|
defined(CONFIG_SPL_BUILD) |
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -486,7 +494,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, |
|
|
|
if (data) { |
|
|
|
if (data) { |
|
|
|
/* use DMA if the HW supports it and the buffer is aligned */ |
|
|
|
/* use DMA if the HW supports it and the buffer is aligned */ |
|
|
|
if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL && |
|
|
|
if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL && |
|
|
|
tmio_sd_addr_is_dmaable((long)data->src)) |
|
|
|
tmio_sd_addr_is_dmaable(data->src)) |
|
|
|
ret = tmio_sd_dma_xfer(dev, data); |
|
|
|
ret = tmio_sd_dma_xfer(dev, data); |
|
|
|
else |
|
|
|
else |
|
|
|
ret = tmio_sd_pio_xfer(dev, data); |
|
|
|
ret = tmio_sd_pio_xfer(dev, data); |
|
|
|