linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Adrian Hunter" <adrian.hunter@intel.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Rui Miguel Silva" <rmfrfs@gmail.com>,
	"Johan Hovold" <johan@kernel.org>,
	"Alex Elder" <elder@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Bruce Chang" <brucechang@via.com.tw>,
	"Harald Welte" <HaraldWelte@viatech.com>,
	"Alex Dubov" <oakad@yahoo.com>,
	"Sascha Sommer" <saschasommer@freenet.de>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	mirq-linux@rere.qmqm.pl,
	"Jesper Nilsson" <jesper.nilsson@axis.com>,
	"Lars Persson" <lars.persson@axis.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>
Subject: [PATCH 10/19] mmc: sdricoh_cs: Move MMC_APP_CMD handling to sdricoh_mmc_cmd()
Date: Tue, 14 Apr 2020 18:14:04 +0200	[thread overview]
Message-ID: <20200414161413.3036-11-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20200414161413.3036-1-ulf.hansson@linaro.org>

Move MMC_APP_CMD specific handling to be managed by sdricoh_mmc_cmd(), as
this makes the code a bit cleaner.

Cc: Sascha Sommer <saschasommer@freenet.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sdricoh_cs.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c
index a41c0660abbf..e7d74db95b57 100644
--- a/drivers/mmc/host/sdricoh_cs.c
+++ b/drivers/mmc/host/sdricoh_cs.c
@@ -149,16 +149,25 @@ static int sdricoh_query_status(struct sdricoh_host *host, unsigned int wanted,
 
 }
 
-static int sdricoh_mmc_cmd(struct sdricoh_host *host, unsigned char opcode,
-			   unsigned int arg)
+static int sdricoh_mmc_cmd(struct sdricoh_host *host, struct mmc_command *cmd)
 {
 	unsigned int status;
 	int result = 0;
 	unsigned int loop = 0;
+	unsigned char opcode = cmd->opcode;
+
 	/* reset status reg? */
 	sdricoh_writel(host, R21C_STATUS, 0x18);
+
+	/* MMC_APP_CMDs need some special handling */
+	if (host->app_cmd) {
+		opcode |= 64;
+		host->app_cmd = 0;
+	} else if (opcode == MMC_APP_CMD)
+		host->app_cmd = 1;
+
 	/* fill parameters */
-	sdricoh_writel(host, R204_CMD_ARG, arg);
+	sdricoh_writel(host, R204_CMD_ARG, cmd->arg);
 	sdricoh_writel(host, R200_CMD, (0x10000 << 8) | opcode);
 	/* wait for command completion */
 	if (opcode) {
@@ -250,28 +259,20 @@ static void sdricoh_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	struct mmc_command *cmd = mrq->cmd;
 	struct mmc_data *data = cmd->data;
 	struct device *dev = host->dev;
-	unsigned char opcode = cmd->opcode;
 	int i;
 
 	dev_dbg(dev, "=============================\n");
-	dev_dbg(dev, "sdricoh_request opcode=%i\n", opcode);
+	dev_dbg(dev, "sdricoh_request opcode=%i\n", cmd->opcode);
 
 	sdricoh_writel(host, R21C_STATUS, 0x18);
 
-	/* MMC_APP_CMDs need some special handling */
-	if (host->app_cmd) {
-		opcode |= 64;
-		host->app_cmd = 0;
-	} else if (opcode == MMC_APP_CMD)
-		host->app_cmd = 1;
-
 	/* read/write commands seem to require this */
 	if (data) {
 		sdricoh_writew(host, R226_BLOCKSIZE, data->blksz);
 		sdricoh_writel(host, R208_DATAIO, 0);
 	}
 
-	cmd->error = sdricoh_mmc_cmd(host, opcode, cmd->arg);
+	cmd->error = sdricoh_mmc_cmd(host, cmd);
 
 	/* read response buffer */
 	if (cmd->flags & MMC_RSP_PRESENT) {
-- 
2.20.1


  parent reply	other threads:[~2020-04-14 16:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 16:13 [PATCH 00/19] mmc: Improve host driver's support for R1B responses Ulf Hansson
2020-04-14 16:13 ` [PATCH 01/19] mmc: atmel-mci: Keep timer enabled when queuing a next request Ulf Hansson
2020-04-17 20:39   ` ludovic.desroches
2020-04-14 16:13 ` [PATCH 02/19] mmc: atmel-mci: Set the timer per command rather than per request Ulf Hansson
2020-04-17 20:40   ` ludovic.desroches
2020-04-14 16:13 ` [PATCH 03/19] mmc: atmel-mci: Respect the cmd->busy_timeout from the mmc core Ulf Hansson
2020-04-17 20:44   ` ludovic.desroches
2020-04-14 16:13 ` [PATCH 04/19] mmc: jz4740: Inform the mmc core about the maximum busy timeout Ulf Hansson
2020-04-14 16:13 ` [PATCH 05/19] mmc: usdhi6rol0: " Ulf Hansson
2020-04-15  6:34   ` Jesper Nilsson
2020-04-14 16:14 ` [PATCH 06/19] mmc: cb710: " Ulf Hansson
2020-04-14 18:39   ` Michał Mirosław
2020-04-15  7:41     ` Ulf Hansson
2020-05-08  8:38       ` Ulf Hansson
2020-04-14 16:14 ` [PATCH 07/19] mmc: owl-mmc: Respect the cmd->busy_timeout from the mmc core Ulf Hansson
2020-04-14 16:14 ` [PATCH 08/19] mmc: sdricoh_cs: Drop unused defines Ulf Hansson
2020-04-14 16:14 ` [PATCH 09/19] mmc: sdricoh_cs: Use MMC_APP_CMD rather than a hardcoded number Ulf Hansson
2020-04-14 16:14 ` Ulf Hansson [this message]
2020-04-14 16:14 ` [PATCH 11/19] mmc: sdricoh_cs: Drop redundant in-parameter to sdricoh_query_status() Ulf Hansson
2020-04-14 16:14 ` [PATCH 12/19] mmc: sdricoh_cs: Throttle polling rate for data transfers Ulf Hansson
2020-04-14 16:14 ` [PATCH 13/19] mmc: sdricoh_cs: Throttle polling rate for commands Ulf Hansson
2020-04-14 16:14 ` [PATCH 14/19] mmc: sdricoh_cs: Respect the cmd->busy_timeout from the mmc core Ulf Hansson
2020-04-14 16:14 ` [PATCH 15/19] mmc: tifm_sd: Inform the mmc core about the maximum busy timeout Ulf Hansson
2020-04-14 16:14 ` [PATCH 16/19] mmc: via-sdmmc: Respect the cmd->busy_timeout from the mmc core Ulf Hansson
2020-04-14 16:14 ` [PATCH 17/19] mmc: mmc_spi: Add/rename defines for timeouts Ulf Hansson
2020-04-14 16:14 ` [PATCH 18/19] mmc: mmc_spi: Respect the cmd->busy_timeout from the mmc core Ulf Hansson
2020-04-14 16:14 ` [PATCH 19/19] staging: greybus: sdio: " Ulf Hansson
2020-04-15  8:30   ` Rui Miguel Silva
2020-04-16 10:25   ` Greg Kroah-Hartman

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=20200414161413.3036-11-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=HaraldWelte@viatech.com \
    --cc=adrian.hunter@intel.com \
    --cc=brucechang@via.com.tw \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=jesper.nilsson@axis.com \
    --cc=johan@kernel.org \
    --cc=lars.persson@axis.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=nicolas.ferre@microchip.com \
    --cc=oakad@yahoo.com \
    --cc=paul@crapouillou.net \
    --cc=rmfrfs@gmail.com \
    --cc=saschasommer@freenet.de \
    /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).