arm: allwinner: Disable the clock before changing it's freq

You aren't supposed to changing the freq of a clock when it is
enable so disable the clock before changing the freq and then
re-enable it.

MFC after:	1 month
This commit is contained in:
Emmanuel Vadot 2019-10-14 21:50:44 +00:00
parent 153e7b98e9
commit 101260f3a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353527

View File

@ -1433,6 +1433,10 @@ aw_mmc_update_ios(device_t bus, device_t child)
}
/* Set the MMC clock. */
error = clk_disable(sc->aw_clk_mmc);
if (error != 0 && bootverbose)
device_printf(sc->aw_dev,
"failed to disable mmc clock: %d\n", error);
error = clk_set_freq(sc->aw_clk_mmc, clock,
CLK_SET_ROUND_DOWN);
if (error != 0) {
@ -1441,6 +1445,10 @@ aw_mmc_update_ios(device_t bus, device_t child)
clock, error);
return (error);
}
error = clk_enable(sc->aw_clk_mmc);
if (error != 0 && bootverbose)
device_printf(sc->aw_dev,
"failed to re-enable mmc clock: %d\n", error);
if (sc->aw_mmc_conf->can_calibrate)
AW_MMC_WRITE_4(sc, AW_MMC_SAMP_DL, AW_MMC_SAMP_DL_SW_EN);