linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo.dureghello@timesys.com>
To: adrian.hunter@intel.com, ulf.hansson@linaro.org, gerg@linux-m68k.org
Cc: linux-mmc@vger.kernel.org, linux-m68k@vger.kernel.org,
	Angelo Dureghello <angelo.dureghello@timesys.com>
Subject: [PATCH v5 2/3] mmc: sdhci: add quirks for be to le byte swapping
Date: Sat, 16 May 2020 00:27:29 +0200	[thread overview]
Message-ID: <20200515222730.967105-2-angelo.dureghello@timesys.com> (raw)
In-Reply-To: <20200515222730.967105-1-angelo.dureghello@timesys.com>

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

Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com>
---
Changes for v3:
- add post request callback
Changes for v4:
none
Changes for v5:
- remove useless comment before swapping bounce buffer
- rename pre_dma_transfer to copy_to_bounce_buffer
---
 drivers/mmc/host/sdhci.c | 9 ++++++---
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3f716466fcfd..b7ba43e3b7c5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -634,9 +634,12 @@ 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);
+			} 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,
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 79dffbb731d3..632ea297bb60 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -653,6 +653,8 @@ 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);
 	void	(*request_done)(struct sdhci_host *host,
 				struct mmc_request *mrq);
 };
-- 
2.26.2


  reply	other threads:[~2020-05-15 22:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 22:27 [PATCH v5 1/3] m68k: mcf5441x: add support for esdhc mmc controller Angelo Dureghello
2020-05-15 22:27 ` Angelo Dureghello [this message]
2020-05-16 18:06   ` [PATCH v5 2/3] mmc: sdhci: add quirks for be to le byte swapping Adrian Hunter
2020-05-15 22:27 ` [PATCH v5 3/3] mmc: host: add Coldfire esdhc support Angelo Dureghello
2020-05-16 18:09   ` Adrian Hunter
2020-05-18  8:00     ` Angelo Dureghello
2020-05-18  8:02       ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200515222730.967105-2-angelo.dureghello@timesys.com \
    --to=angelo.dureghello@timesys.com \
    --cc=adrian.hunter@intel.com \
    --cc=gerg@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).