projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
627a78b
)
mmc: sdhci-sprd: Fix the limitation of div
author
Wenchao Chen
<wenchao.chen@unisoc.com>
Wed, 14 Sep 2022 06:37:02 +0000
(14:37 +0800)
committer
Ulf Hansson
<ulf.hansson@linaro.org>
Tue, 20 Sep 2022 09:34:06 +0000
(11:34 +0200)
Because the bit field size of the divider coefficient register is 1023, it is
limited before returning the value.
Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
Link:
https://lore.kernel.org/r/20220914063702.20283-1-wenchao.chen666@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-sprd.c
patch
|
blob
|
history
diff --git
a/drivers/mmc/host/sdhci-sprd.c
b/drivers/mmc/host/sdhci-sprd.c
index f33e9349e4e62eddd6d6c3370cfdcd4a017eeee6..46c55ab4884c2431cd6c65f4f3a296ced944c7dd 100644
(file)
--- a/
drivers/mmc/host/sdhci-sprd.c
+++ b/
drivers/mmc/host/sdhci-sprd.c
@@
-205,14
+205,14
@@
static inline u32 sdhci_sprd_calc_div(u32 base_clk, u32 clk)
if ((base_clk / div) > (clk * 2))
div++;
- if (div > SDHCI_SPRD_CLK_MAX_DIV)
- div = SDHCI_SPRD_CLK_MAX_DIV;
-
if (div % 2)
div = (div + 1) / 2;
else
div = div / 2;
+ if (div > SDHCI_SPRD_CLK_MAX_DIV)
+ div = SDHCI_SPRD_CLK_MAX_DIV;
+
return div;
}