mmc: fsl_esdhc: simplify 64bit check for SDMA transfers

SDMA can only do DMA with 32 bit addresses. This is true for all
architectures (just doesn't apply to 32 bit ones). Simplify the code and
remove unnecessary CONFIG_FSL_LAYERSCAPE.

Also make the error message more concise.

Signed-off-by: Michael Walle <michael@walle.cc>
This commit is contained in:
Michael Walle 2020-09-23 12:42:47 +02:00 committed by Peng Fan
parent 9098682200
commit da86e8cfcb

View File

@ -211,9 +211,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
{ {
int timeout; int timeout;
struct fsl_esdhc *regs = priv->esdhc_regs; struct fsl_esdhc *regs = priv->esdhc_regs;
#if defined(CONFIG_FSL_LAYERSCAPE)
dma_addr_t addr; dma_addr_t addr;
#endif
uint wml_value; uint wml_value;
wml_value = data->blocksize/4; wml_value = data->blocksize/4;
@ -224,15 +222,10 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value); esdhc_clrsetbits32(&regs->wml, WML_RD_WML_MASK, wml_value);
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
#if defined(CONFIG_FSL_LAYERSCAPE)
addr = virt_to_phys((void *)(data->dest)); addr = virt_to_phys((void *)(data->dest));
if (upper_32_bits(addr)) if (upper_32_bits(addr))
printf("Error found for upper 32 bits\n"); printf("Cannot use 64 bit addresses with SDMA\n");
else esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
#else
esdhc_write32(&regs->dsaddr, (u32)data->dest);
#endif
#endif #endif
} else { } else {
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
@ -251,15 +244,10 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK, esdhc_clrsetbits32(&regs->wml, WML_WR_WML_MASK,
wml_value << 16); wml_value << 16);
#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO #ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO
#if defined(CONFIG_FSL_LAYERSCAPE)
addr = virt_to_phys((void *)(data->src)); addr = virt_to_phys((void *)(data->src));
if (upper_32_bits(addr)) if (upper_32_bits(addr))
printf("Error found for upper 32 bits\n"); printf("Cannot use 64 bit addresses with SDMA\n");
else esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
esdhc_write32(&regs->dsaddr, lower_32_bits(addr));
#else
esdhc_write32(&regs->dsaddr, (u32)data->src);
#endif
#endif #endif
} }
@ -316,17 +304,12 @@ static void check_and_invalidate_dcache_range
unsigned end = 0; unsigned end = 0;
unsigned size = roundup(ARCH_DMA_MINALIGN, unsigned size = roundup(ARCH_DMA_MINALIGN,
data->blocks*data->blocksize); data->blocks*data->blocksize);
#if defined(CONFIG_FSL_LAYERSCAPE)
dma_addr_t addr; dma_addr_t addr;
addr = virt_to_phys((void *)(data->dest)); addr = virt_to_phys((void *)(data->dest));
if (upper_32_bits(addr)) if (upper_32_bits(addr))
printf("Error found for upper 32 bits\n"); printf("Cannot use 64 bit addresses with SDMA\n");
else start = lower_32_bits(addr);
start = lower_32_bits(addr);
#else
start = (unsigned)data->dest;
#endif
end = start + size; end = start + size;
invalidate_dcache_range(start, end); invalidate_dcache_range(start, end);
} }