From: Heiner Kallweit <hkallweit1@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Kevin Hilman <khilman@baylibre.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
linux-amlogic@lists.infradead.org
Subject: [PATCH 4/4] mmc: meson-gx: add CMD23 mode
Date: Fri, 24 Mar 2017 23:15:33 +0100 [thread overview]
Message-ID: <51dcee34-1cfe-641e-5e06-aa7ef667831e@gmail.com> (raw)
In-Reply-To: <f6960395-370e-16b0-1a2a-2a1fce720d45@gmail.com>
CMD23 mode (use "set block count" command before transferring multiple
data blocks) typically is more performant as host / card know upfront
how many data blocks to expect. Therefore add support for this mode to
the driver.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index e637b3ba..6e93270f 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -181,6 +181,17 @@ static unsigned int meson_mmc_get_timeout(struct mmc_data *data)
return min(timeout, 32768U); /* max. 2^15 ms */
}
+static struct mmc_command *meson_mmc_get_next_command(struct mmc_command *cmd)
+{
+ if (cmd->opcode == MMC_SET_BLOCK_COUNT && !cmd->error)
+ return cmd->mrq->cmd;
+ else if (mmc_op_multi(cmd->opcode) &&
+ (!cmd->mrq->sbc || cmd->error || cmd->data->error))
+ return cmd->mrq->stop;
+ else
+ return NULL;
+}
+
static int meson_mmc_clk_set(struct meson_host *host, unsigned long clk_rate)
{
struct mmc_host *mmc = host->mmc;
@@ -626,7 +637,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
{
struct meson_host *host = dev_id;
- struct mmc_command *cmd = host->cmd;
+ struct mmc_command *next_cmd, *cmd = host->cmd;
struct mmc_data *data;
unsigned int xfer_bytes;
@@ -641,10 +652,11 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
host->bounce_buf, xfer_bytes);
}
- if (!data || !data->stop || cmd->mrq->sbc)
- meson_mmc_request_done(host->mmc, cmd->mrq);
+ next_cmd = meson_mmc_get_next_command(cmd);
+ if (next_cmd)
+ meson_mmc_start_cmd(host->mmc, next_cmd);
else
- meson_mmc_start_cmd(host->mmc, data->stop);
+ meson_mmc_request_done(host->mmc, cmd->mrq);
return IRQ_HANDLED;
}
@@ -756,6 +768,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
if (ret)
goto err_div_clk;
+ mmc->caps |= MMC_CAP_CMD23;
mmc->max_blk_count = CMD_CFG_LENGTH_MASK;
mmc->max_req_size = mmc->max_blk_count * mmc->max_blk_size;
--
2.12.0
next prev parent reply other threads:[~2017-03-24 22:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-24 22:01 [PATCH 0/4] mmc: meson-gx: smaller functional extensions Heiner Kallweit
2017-03-24 22:05 ` [PATCH 1/4] mmc: meson-gx: use bitfield macros Heiner Kallweit
2017-03-24 22:52 ` Kevin Hilman
2017-03-25 9:57 ` Heiner Kallweit
2017-03-24 22:08 ` [PATCH 2/4] mmc: meson-gx: use per port interrupt names Heiner Kallweit
2017-03-24 22:53 ` Kevin Hilman
2017-03-24 22:10 ` [PATCH 3/4] mmc: meson-gx: switch to dynamic timeout values Heiner Kallweit
2017-03-24 22:59 ` Kevin Hilman
2017-03-24 22:15 ` Heiner Kallweit [this message]
2017-03-24 23:19 ` [PATCH 4/4] mmc: meson-gx: add CMD23 mode Kevin Hilman
2017-03-24 23:21 ` [PATCH 0/4] mmc: meson-gx: smaller functional extensions Kevin Hilman
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=51dcee34-1cfe-641e-5e06-aa7ef667831e@gmail.com \
--to=hkallweit1@gmail.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.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