All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: joel@jms.id.au, Eddie James <eajames@linux.ibm.com>
Subject: [PATCH linux dev-5.4 2/2] mmc: sdhci-of-aspeed: Prevent clock divider of zero
Date: Wed,  8 Jul 2020 15:24:54 -0500	[thread overview]
Message-ID: <20200708202454.21333-2-eajames@linux.ibm.com> (raw)
In-Reply-To: <20200708202454.21333-1-eajames@linux.ibm.com>

The Aspeed specification forbids a clock divider of zero, which will be
calculated if the parent clock is equal to the desired clock. Testing
confirmed this broke the host controller.

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

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 8962f6664381..5aa72e80cae9 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -74,6 +74,10 @@ static void aspeed_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
 	}
 	div >>= 1;
 
+	/* Aspeed forbids a clock div of 0 */
+	if (!div)
+		div = 1;
+
 	clk = div << SDHCI_DIVIDER_SHIFT;
 
 	sdhci_enable_clk(host, clk);
-- 
2.24.0

  reply	other threads:[~2020-07-08 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 20:24 [PATCH linux dev-5.4 1/2] clk: AST2600: Add mux for EMMC clock Eddie James
2020-07-08 20:24 ` Eddie James [this message]
2020-07-09 11:56   ` [PATCH linux dev-5.4 2/2] mmc: sdhci-of-aspeed: Prevent clock divider of zero Andrew Jeffery
2020-07-09 11:34 ` [PATCH linux dev-5.4 1/2] clk: AST2600: Add mux for EMMC clock Andrew Jeffery

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=20200708202454.21333-2-eajames@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.