From owner-svn-src-all@FreeBSD.ORG Fri Apr 4 01:10:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E282A594; Fri, 4 Apr 2014 01:10:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 CDB173F6; Fri, 4 Apr 2014 01:10:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s341A2Hn094708; Fri, 4 Apr 2014 01:10:02 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s341A2i9094707; Fri, 4 Apr 2014 01:10:02 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201404040110.s341A2i9094707@svn.freebsd.org> From: Ian Lepore Date: Fri, 4 Apr 2014 01:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264097 - head/sys/dev/sdhci X-SVN-Group: head 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.17 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: Fri, 04 Apr 2014 01:10:03 -0000 Author: ian Date: Fri Apr 4 01:10:02 2014 New Revision: 264097 URL: http://svnweb.freebsd.org/changeset/base/264097 Log: When changing the sd bus clock divisor, clear just the bus clock enable bit before changing the divisor bits in the register. We were writing a zero to the register, which clears the enable, but also cleared the divisor bits at the same time. That's a violation of the sdhci spec, which says the divisor can only be changed when the clock is disabled. This has worked okay on most hardware for years, but the TI OMAP controller would misbehave after changing the divisor improperly. Submitted by: Svatopluk Kraus Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Fri Apr 4 00:59:40 2014 (r264096) +++ head/sys/dev/sdhci/sdhci.c Fri Apr 4 01:10:02 2014 (r264097) @@ -235,7 +235,8 @@ sdhci_set_clock(struct sdhci_slot *slot, slot->clock = clock; /* Turn off the clock. */ - WR2(slot, SDHCI_CLOCK_CONTROL, 0); + clk = RD2(slot, SDHCI_CLOCK_CONTROL); + WR2(slot, SDHCI_CLOCK_CONTROL, clk & ~SDHCI_CLOCK_CARD_EN); /* If no clock requested - left it so. */ if (clock == 0) return;