[PATCH linux dev-5.4 2/2] mmc: sdhci-of-aspeed: Prevent clock divider of zero
Eddie James
eajames at linux.ibm.com
Thu Jul 9 06:24:54 AEST 2020
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 at 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
More information about the openbmc
mailing list