mmc: dw_mmc-rockchip: Restore slot's clock if it's updated

slot's clock is cached before calling ->set_ios for sub-driver.
If the clock is updated by sub-driver, it's better to restore
the cached slot's clock. Or we can see a unexpected clock as the
driver didn't know the slot's clock is updated and still use the
old clock to calculate divider. So we may see a lower clock. It
theory, it's won't be a problem because any rate lower than 400k
should be fine, and we even didn't start issuing any command during
the lower clock. But still it's right to update slot's clock to reflect
the correct clock and may fix some potential unknown problems.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I06581320547bb06c306da57e141d06f9206ea585
This commit is contained in:
Shawn Lin
2021-11-05 09:02:23 +08:00
committed by Tao Huang
parent ca8c7fcedd
commit 3f26edfb23

View File

@@ -46,8 +46,10 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios)
* Note: div can only be 0 or 1, but div must be set to 1 for eMMC
* DDR52 8-bit mode.
*/
if (ios->clock < priv->f_min)
if (ios->clock < priv->f_min) {
ios->clock = priv->f_min;
host->slot->clock = ios->clock;
}
if (ios->bus_width == MMC_BUS_WIDTH_8 &&
ios->timing == MMC_TIMING_MMC_DDR52)