From owner-svn-src-all@freebsd.org Sun Jan 24 19:36:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE66F7859; Sun, 24 Jan 2016 19:36:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FB77BC4; Sun, 24 Jan 2016 19:36:50 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0OJanmG081793; Sun, 24 Jan 2016 19:36:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0OJan11081792; Sun, 24 Jan 2016 19:36:49 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201601241936.u0OJan11081792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 Jan 2016 19:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r294679 - stable/10/sys/arm/freescale/imx X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2016 19:36:50 -0000 Author: ian Date: Sun Jan 24 19:36:49 2016 New Revision: 294679 URL: https://svnweb.freebsd.org/changeset/base/294679 Log: MFC r292419, r294237: Fix the clock divisor calc for imx6 sdcard bus speed. Quick exit after setting the clock control register. Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/freescale/imx/imx_sdhci.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx_sdhci.c Sun Jan 24 19:34:05 2016 (r294678) +++ stable/10/sys/arm/freescale/imx/imx_sdhci.c Sun Jan 24 19:36:49 2016 (r294679) @@ -429,6 +429,7 @@ imx_sdhci_write_2(device_t dev, struct s } else { imx_sdhc_set_clock(sc, false); } + return; } /* @@ -522,12 +523,19 @@ imx_sdhc_set_clock(struct imx_sdhci_soft else freq = sc->baseclk_hz / (2 * divisor); - for (prescale = 2; prescale < freq / prescale / 16;) + for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16);) prescale <<= 1; - for (divisor = 1; freq < freq / prescale / divisor;) + for (divisor = 1; freq < sc->baseclk_hz / (prescale * divisor);) ++divisor; +#ifdef DEBUG + device_printf(sc->dev, + "desired SD freq: %d, actual: %d; base %d prescale %d divisor %d\n", + freq, sc->baseclk_hz / (prescale * divisor), sc->baseclk_hz, + prescale, divisor); +#endif + prescale >>= 1; divisor -= 1;