From: Adrian Hunter <adrian.hunter@intel.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>, linux-mmc@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci: fix minimum clock rate for v3 controller
Date: Tue, 14 Jan 2020 15:08:08 +0200 [thread overview]
Message-ID: <4264051e-6126-83c3-e49e-3d9050ff35ce@intel.com> (raw)
In-Reply-To: <3f3b2ac4634802af591a20b1b98dc8d0158aec45.1577962196.git.mirq-linux@rere.qmqm.pl>
On 2/01/20 12:51 pm, Michał Mirosław wrote:
> For SDHCIv3+ with programmable clock mode, minimal clock frequency is
> still base clock / max(divider). Minimal programmable clock frequency is
> always greater than minimal divided clock frequency. Without this patch,
> SDHCI uses out-of-spec initial frequency when multiplier is big enough:
>
> mmc1: mmc_rescan_try_freq: trying to init card at 468750 Hz
> [for 480 MHz source clock divided by 1024]
The maximum divisor in programmable clock mode is 1024. So I do not
understand what is wrong. Can you explain some more?
>
> Cc: stable@vger.kernel.org
> Fixes: c3ed3877625f ("mmc: sdhci: add support for programmable clock mode")
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> drivers/mmc/host/sdhci.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 275102c0a1bf..0036ddf85674 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -3902,11 +3902,9 @@ int sdhci_setup_host(struct sdhci_host *host)
> if (host->ops->get_min_clock)
> mmc->f_min = host->ops->get_min_clock(host);
> else if (host->version >= SDHCI_SPEC_300) {
> - if (host->clk_mul) {
> - mmc->f_min = (host->max_clk * host->clk_mul) / 1024;
> + if (host->clk_mul)
> max_clk = host->max_clk * host->clk_mul;
> - } else
> - mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
> + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
> } else
> mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
>
>
next prev parent reply other threads:[~2020-01-14 13:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 10:51 [PATCH] mmc: sdhci: fix minimum clock rate for v3 controller Michał Mirosław
2020-01-14 13:08 ` Adrian Hunter [this message]
2020-01-14 15:53 ` Michał Mirosław
2020-01-15 7:16 ` Adrian Hunter
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=4264051e-6126-83c3-e49e-3d9050ff35ce@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--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