linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: linux-clk@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
	linux-mmc@vger.kernel.org, andrew@aj.id.au, joel@jms.id.au,
	ulf.hansson@linaro.org, adrian.hunter@intel.com,
	sboyd@kernel.org, mturquette@baylibre.com, eajames@linux.ibm.com
Subject: [PATCH 2/2] mmc: sdhci-of-aspeed: Fix clock divider calculation
Date: Thu,  9 Jul 2020 14:57:06 -0500	[thread overview]
Message-ID: <20200709195706.12741-3-eajames@linux.ibm.com> (raw)
In-Reply-To: <20200709195706.12741-1-eajames@linux.ibm.com>

When calculating the clock divider, start dividing at 2 instead of 1.
The divider is divided by two at the end of the calculation, so starting
at 1 may result in a divider of 0, which shouldn't happen.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/mmc/host/sdhci-of-aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 56912e30c47e..a1bcc0f4ba9e 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -68,7 +68,7 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	if (WARN_ON(clock > host->max_clk))
 		clock = host->max_clk;
 
-	for (div = 1; div < 256; div *= 2) {
+	for (div = 2; div < 256; div *= 2) {
 		if ((parent / div) <= clock)
 			break;
 	}
-- 
2.24.0


  parent reply	other threads:[~2020-07-09 20:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 19:57 [PATCH 0/2] clk: Aspeed: Fix eMMC clock speeds Eddie James
2020-07-09 19:57 ` [PATCH 1/2] clk: AST2600: Add mux for EMMC clock Eddie James
2020-07-10  3:03   ` Joel Stanley
2020-07-11 16:16   ` Stephen Boyd
2020-07-09 19:57 ` Eddie James [this message]
2020-07-10  1:13   ` [PATCH 2/2] mmc: sdhci-of-aspeed: Fix clock divider calculation Andrew Jeffery
2020-07-10  3:04     ` Joel Stanley
2020-07-10  6:41   ` Adrian Hunter
2020-07-10  7:39   ` Ulf Hansson
2020-07-10  9:00     ` Andrew Jeffery
2020-07-10  9:27   ` Ulf Hansson

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=20200709195706.12741-3-eajames@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@aj.id.au \
    --cc=joel@jms.id.au \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).