Linux-m68k Archive on lore.kernel.org
 help / color / 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 v6 2/4] mmc: sdhci: add quirks for be to le byte swapping
Date: Mon, 18 May 2020 21:17:40 +0200
Message-ID: <20200518191742.1251440-2-angelo.dureghello@timesys.com> (raw)
In-Reply-To: <20200518191742.1251440-1-angelo.dureghello@timesys.com>

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>
---
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
Changes for v6:
- add more details in the commit message body
- add length parameter to copy_to_bounce_buffer()
---
 drivers/mmc/host/sdhci.c | 10 +++++++---
 drivers/mmc/host/sdhci.h |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3f716466fcfd..99613f9891a3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -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,
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 79dffbb731d3..1bf4f1d91951 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -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);
 };
-- 
2.26.2


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 19:17 [PATCH v6 1/4] m68k: mcf5441x: add support for esdhc mmc controller Angelo Dureghello
2020-05-18 19:17 ` Angelo Dureghello [this message]
2020-05-18 19:17 ` [PATCH v6 3/4] mmc: host: add Coldfire esdhc support Angelo Dureghello
2020-05-18 19:17 ` [PATCH v6 4/4] MAINTAINERS: add myself to maintain M5441X mmc host driver Angelo Dureghello
2020-05-19 15:29 ` [PATCH v6 1/4] m68k: mcf5441x: add support for esdhc mmc controller Ulf Hansson
2020-05-19 19:42   ` Angelo Dureghello
2020-05-25  6:02 ` Greg Ungerer
2020-05-25  8:51   ` Angelo Dureghello
2020-05-25 11:15     ` Greg Ungerer

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=20200518191742.1251440-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

Linux-m68k Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-m68k/0 linux-m68k/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-m68k linux-m68k/ https://lore.kernel.org/linux-m68k \
		linux-m68k@vger.kernel.org linux-m68k@lists.linux-m68k.org
	public-inbox-index linux-m68k

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-m68k


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git