Message ID | 1488184144-122285-3-git-send-email-shawn.lin@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 27/02/17 10:29, Shawn Lin wrote: > We expect all the variant host drivers to return the timeout > clk rate in Hz unit so that it's more easy for us to work through > all cases in one place. > > Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> > --- > > Changes in v2: None > > drivers/mmc/host/sdhci.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 6fdd7a7..9707f11 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -3101,6 +3101,7 @@ int sdhci_setup_host(struct sdhci_host *host) > unsigned int override_timeout_clk; > u32 max_clk; > int ret; > + bool skip_div; > > WARN_ON(host == NULL); > if (host == NULL) > @@ -3292,7 +3293,9 @@ int sdhci_setup_host(struct sdhci_host *host) > if (host->timeout_clk == 0) { > if (host->ops->get_timeout_clock) { > host->timeout_clk = > - host->ops->get_timeout_clock(host); > + DIV_ROUND_UP(host->ops->get_timeout_clock(host), 1000); > + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) > + skip_div = true; > } else { > pr_err("%s: Hardware doesn't specify timeout clock frequency.\n", > mmc_hostname(mmc)); > @@ -3301,7 +3304,7 @@ int sdhci_setup_host(struct sdhci_host *host) > } > } > > - if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) > + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT && !skip_div) > host->timeout_clk *= 1000; Just move this above "if (host->timeout_clk == 0) {" and you don't need skip_div. Also you will have to roll all these patches together or you are breaking bisectability. -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6fdd7a7..9707f11 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3101,6 +3101,7 @@ int sdhci_setup_host(struct sdhci_host *host) unsigned int override_timeout_clk; u32 max_clk; int ret; + bool skip_div; WARN_ON(host == NULL); if (host == NULL) @@ -3292,7 +3293,9 @@ int sdhci_setup_host(struct sdhci_host *host) if (host->timeout_clk == 0) { if (host->ops->get_timeout_clock) { host->timeout_clk = - host->ops->get_timeout_clock(host); + DIV_ROUND_UP(host->ops->get_timeout_clock(host), 1000); + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) + skip_div = true; } else { pr_err("%s: Hardware doesn't specify timeout clock frequency.\n", mmc_hostname(mmc)); @@ -3301,7 +3304,7 @@ int sdhci_setup_host(struct sdhci_host *host) } } - if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT && !skip_div) host->timeout_clk *= 1000; if (override_timeout_clk)
We expect all the variant host drivers to return the timeout clk rate in Hz unit so that it's more easy for us to work through all cases in one place. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> --- Changes in v2: None drivers/mmc/host/sdhci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)