All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-mmc@vger.kernel.org
Cc: "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	linux-renesas-soc@vger.kernel.org,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>
Subject: [PATCH 2/5] mmc: renesas_sdhi: use helpers to access struct scatterlist members
Date: Tue, 10 Apr 2018 11:38:28 +0200	[thread overview]
Message-ID: <20180410093831.1759-3-wsa+renesas@sang-engineering.com> (raw)
In-Reply-To: <20180410093831.1759-1-wsa+renesas@sang-engineering.com>

From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Instead of directly accessing the members of struct scatterlist use the
helpers mmc_get_dma_dir() and sg_dma_address() in
renesas_sdhi_internal_dmac_start_dma(). Based on previous work by
Masaharu Hayakawa.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
[rebased to mmc/next]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 9c50d64cd10c..6c2f3ae01de9 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -158,7 +158,6 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 {
 	struct scatterlist *sg = host->sg_ptr;
 	u32 dtran_mode = DTRAN_MODE_BUS_WID_TH | DTRAN_MODE_ADDR_MODE;
-	enum dma_data_direction dir;
 	int ret;
 
 	/* This DMAC cannot handle if sg_len is not 1 */
@@ -170,16 +169,15 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 
 	if (data->flags & MMC_DATA_READ) {
 		dtran_mode |= DTRAN_MODE_CH_NUM_CH1;
-		dir = DMA_FROM_DEVICE;
 		if (test_bit(SDHI_INTERNAL_DMAC_ONE_RX_ONLY, &global_flags) &&
 		    test_and_set_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags))
 			goto force_pio;
 	} else {
 		dtran_mode |= DTRAN_MODE_CH_NUM_CH0;
-		dir = DMA_TO_DEVICE;
 	}
 
-	ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len, dir);
+	ret = dma_map_sg(&host->pdev->dev, sg, host->sg_len,
+			 mmc_get_dma_dir(data));
 	if (ret == 0)
 		goto force_pio;
 
@@ -189,7 +187,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 	renesas_sdhi_internal_dmac_dm_write(host, DM_CM_DTRAN_MODE,
 					    dtran_mode);
 	renesas_sdhi_internal_dmac_dm_write(host, DM_DTRAN_ADDR,
-					    sg->dma_address);
+					    sg_dma_address(sg));
 
 	return;
 
-- 
2.11.0

  parent reply	other threads:[~2018-04-10  9:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  9:38 [PATCH 0/5] mmc: renesas_sdhi_internal_dmac: DMA handling fixes Wolfram Sang
2018-04-10  9:38 ` [PATCH 1/5] mmc: renesas_sdhi_internal_dmac: limit DMA RX for old SoCs Wolfram Sang
2018-04-10  9:48   ` Geert Uytterhoeven
2018-04-12 11:11     ` Wolfram Sang
2018-04-12 11:25       ` Geert Uytterhoeven
2018-04-12 11:31         ` Wolfram Sang
2018-04-12 11:34           ` Geert Uytterhoeven
2018-04-12 11:40             ` Wolfram Sang
2018-04-11  7:14   ` Simon Horman
2018-04-12 11:21     ` Wolfram Sang
2018-04-13  8:14       ` Simon Horman
2018-04-13  8:35         ` Wolfram Sang
2018-04-13  9:47           ` Simon Horman
2018-04-10  9:38 ` Wolfram Sang [this message]
2018-04-11  7:15   ` [PATCH 2/5] mmc: renesas_sdhi: use helpers to access struct scatterlist members Simon Horman
2018-04-10  9:38 ` [PATCH 3/5] mmc: renesas_sdhi: Fix alignment check of sg buffer Wolfram Sang
2018-04-11  7:17   ` Simon Horman
2018-04-10  9:38 ` [PATCH 4/5] mmc: renesas_sdhi_internal_dmac: use more generic whitelisting Wolfram Sang
2018-04-10  9:38 ` [PATCH 5/5] mmc: renesas_sdhi_internal_dmac: remove superfluous WARN Wolfram Sang
2018-04-11  7:23   ` Simon Horman

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=20180410093831.1759-3-wsa+renesas@sang-engineering.com \
    --to=wsa+renesas@sang-engineering.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.