mmc: dw-mmc-rockchip: Fix handling invalid clock rates
authorPeter Geis <pgwipeout@gmail.com>
Sat, 5 Mar 2022 21:58:35 +0000 (16:58 -0500)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 7 Mar 2022 11:56:48 +0000 (12:56 +0100)
commit52c92286b71e28d88642a4a416f40fbdb6cbb46f
tree906e7a07330f594bfcbf3b7c3f646aac2ab55da5
parentc4313e75001492f8a288d3ffd595544cbc880821
mmc: dw-mmc-rockchip: Fix handling invalid clock rates

The Rockchip rk356x ciu clock cannot be set as low as the dw-mmc
hardware supports. This leads to a situation during card initialization
where the clock is set lower than the clock driver can support. The
dw-mmc-rockchip driver spews errors when this happens.
For normal operation this only happens a few times during boot, but when
cd-broken is enabled (in cases such as the SoQuartz module) this fires
multiple times each poll cycle.

Fix this by testing the lowest possible frequency that the clock driver
can support which is within the mmc specification. Divide that rate by
the internal divider and set f_min to this.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20220305215835.2210388-3-pgwipeout@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc-rockchip.c