From: Kevin Hilman <khilman@baylibre.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 3/4] mmc: meson-gx: switch to dynamic timeout values
Date: Fri, 24 Mar 2017 15:59:14 -0700 [thread overview]
Message-ID: <m2tw6ie0xp.fsf@baylibre.com> (raw)
In-Reply-To: <c6a47d71-edc7-5396-e275-07432dffad3a@gmail.com> (Heiner Kallweit's message of "Fri, 24 Mar 2017 23:10:58 +0100")
Heiner Kallweit <hkallweit1@gmail.com> writes:
> Currently we use a fixed timeout of 4s for all data transfers. Switch
> to dynamic timeout values by making use of data->timeout_ns.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index b0a9317b..e637b3ba 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -169,6 +169,18 @@ struct sd_emmc_desc {
> #define CMD_RESP_MASK GENMASK(31, 1)
> #define CMD_RESP_SRAM BIT(0)
>
> +static unsigned int meson_mmc_get_timeout(struct mmc_data *data)
nit: add an _msecs to the func name for clarity/readability.
> +{
> + unsigned int timeout = data->timeout_ns / NSEC_PER_MSEC;
> +
> + if (!timeout)
> + return SD_EMMC_CMD_TIMEOUT_DATA;
> +
> + timeout = roundup_pow_of_two(timeout);
> +
> + return min(timeout, 32768U); /* max. 2^15 ms */
> +}
> +
> static int meson_mmc_clk_set(struct meson_host *host, unsigned long clk_rate)
> {
> struct mmc_host *mmc = host->mmc;
> @@ -448,7 +460,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
> if (data) {
> cmd_cfg |= CMD_CFG_DATA_IO;
> cmd_cfg |= FIELD_PREP(CMD_CFG_TIMEOUT_MASK,
> - ilog2(SD_EMMC_CMD_TIMEOUT_DATA));
> + ilog2(meson_mmc_get_timeout(data)));
>
> if (data->blocks > 1) {
> cmd_cfg |= CMD_CFG_BLOCK_MODE;
Otherwise,
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Kevin
next prev parent reply other threads:[~2017-03-24 22:59 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 [this message]
2017-03-24 22:15 ` [PATCH 4/4] mmc: meson-gx: add CMD23 mode Heiner Kallweit
2017-03-24 23:19 ` 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=m2tw6ie0xp.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=hkallweit1@gmail.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