Author: manu
Date: Mon Oct 14 21:50:44 2019
New Revision: 353527
URL: https://svnweb.freebsd.org/changeset/base/353527

Log:
  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

Modified:
  head/sys/arm/allwinner/aw_mmc.c

Modified: head/sys/arm/allwinner/aw_mmc.c
==============================================================================
--- head/sys/arm/allwinner/aw_mmc.c     Mon Oct 14 21:49:07 2019        
(r353526)
+++ head/sys/arm/allwinner/aw_mmc.c     Mon Oct 14 21:50:44 2019        
(r353527)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to