]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation
authorInochi Amaoto <inochiama@gmail.com>
Thu, 21 May 2026 07:21:20 +0000 (15:21 +0800)
committerUlf Hansson <ulfh@kernel.org>
Fri, 29 May 2026 12:43:42 +0000 (14:43 +0200)
commitb837e38c255dd9f8b53511d52e87f1fda32b3dfe
tree7b472ce963cd953b58666229cb4834115468fb3e
parentf48ee49726ee4ab545fd2dc644f169c0809b19b3
mmc: litex_mmc: Use DIV_ROUND_UP for more accurate clock calculation

The previous clock uses roundup_pow_of_two() to calculate the core
clock frequency. It does not meet the actual hardware meaning.
The actual frequency is calculated by "ref_clk / ((div >> 1) << 1)".

Fix the clock divider calculation.

Fixes: 92e099104729 ("mmc: Add driver for LiteX's LiteSDCard interface")
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Reviewed-by: Gabriel Somlo <gsomlo@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
drivers/mmc/host/litex_mmc.c