]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
mmc: sdhci: add quirks for be to le byte swapping
authorAngelo Dureghello <angelo.dureghello@timesys.com>
Mon, 18 May 2020 19:17:40 +0000 (21:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:51 +0000 (09:32 +0200)
[ Upstream commit e93577ecde8f3cbd12a2eaa0522d5c85e0dbdd53 ]

Some controller as the ColdFire eshdc may require an endianness
byte swap, because DMA read endianness is not configurable.

Facilitate using the bounce buffer for this by adding
->copy_to_bounce_buffer().

Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20200518191742.1251440-2-angelo.dureghello@timesys.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h

index e368f2dabf209235697a29fb6ddcf99c35494b45..5dcdda5918cb596511a6a19bb53031243346536d 100644 (file)
@@ -634,9 +634,13 @@ static int sdhci_pre_dma_transfer(struct sdhci_host *host,
                }
                if (mmc_get_dma_dir(data) == DMA_TO_DEVICE) {
                        /* Copy the data to the bounce buffer */
-                       sg_copy_to_buffer(data->sg, data->sg_len,
-                                         host->bounce_buffer,
-                                         length);
+                       if (host->ops->copy_to_bounce_buffer) {
+                               host->ops->copy_to_bounce_buffer(host,
+                                                                data, length);
+                       } else {
+                               sg_copy_to_buffer(data->sg, data->sg_len,
+                                                 host->bounce_buffer, length);
+                       }
                }
                /* Switch ownership to the DMA */
                dma_sync_single_for_device(host->mmc->parent,
index 79dffbb731d3349095733ab418722566df4b7a79..1bf4f1d9195115244ab7cc4a276d9a335e46199f 100644 (file)
@@ -653,6 +653,9 @@ struct sdhci_ops {
        void    (*voltage_switch)(struct sdhci_host *host);
        void    (*adma_write_desc)(struct sdhci_host *host, void **desc,
                                   dma_addr_t addr, int len, unsigned int cmd);
+       void    (*copy_to_bounce_buffer)(struct sdhci_host *host,
+                                        struct mmc_data *data,
+                                        unsigned int length);
        void    (*request_done)(struct sdhci_host *host,
                                struct mmc_request *mrq);
 };