Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Oct 2019 21:50:44 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353527 - head/sys/arm/allwinner
Message-ID:  <201910142150.x9ELoi6o017997@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910142150.x9ELoi6o017997>