diff options
author | Jules Maselbas <jmaselbas@kalray.eu> | 2023-08-18 16:22:43 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-08-21 07:59:14 +0200 |
commit | 88f101358167127fb618760724dcc534a1c703e2 (patch) | |
tree | d390222cff2c32b72dd53dc3fe4d8cb06388f2ea /drivers/mci/sdhci.c | |
parent | 76aa243aad951c4642abd5fccfde941d84bfbd79 (diff) | |
download | barebox-88f101358167127fb618760724dcc534a1c703e2.tar.gz barebox-88f101358167127fb618760724dcc534a1c703e2.tar.xz |
mci: sdhci: Force DMA update to the next block boundary
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Link: https://lore.barebox.org/20230818142244.17157-6-jmaselbas@kalray.eu
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/sdhci.c')
-rw-r--r-- | drivers/mci/sdhci.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c index 4aca3af5aa..b0b83bfaa9 100644 --- a/drivers/mci/sdhci.c +++ b/drivers/mci/sdhci.c @@ -279,8 +279,20 @@ int sdhci_transfer_data_dma(struct sdhci *sdhci, struct mci_data *data, goto out; } + /* + * We currently don't do anything fancy with DMA + * boundaries, but as we can't disable the feature + * we need to at least restart the transfer. + * + * According to the spec sdhci_readl(host, SDHCI_DMA_ADDRESS) + * should return a valid address to continue from, but as + * some controllers are faulty, don't trust them. + */ if (irqstat & SDHCI_INT_DMA) { - u32 addr = sdhci_read32(sdhci, SDHCI_DMA_ADDRESS); + int boundary_cfg = (sdhci->sdma_boundary >> 12) & 0x7; + dma_addr_t boundary_size = 4096 << boundary_cfg; + /* Force update to the next DMA block boundary. */ + dma = (dma & ~(boundary_size - 1)) + boundary_size; /* * DMA engine has stopped on buffer boundary. Acknowledge |