From owner-svn-src-head@FreeBSD.ORG Fri Aug 16 20:32:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5F682DAE; Fri, 16 Aug 2013 20:32:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4D0C32FC5; Fri, 16 Aug 2013 20:32:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7GKWvtE047306; Fri, 16 Aug 2013 20:32:57 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7GKWvSU047304; Fri, 16 Aug 2013 20:32:57 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201308162032.r7GKWvSU047304@svn.freebsd.org> From: Ian Lepore Date: Fri, 16 Aug 2013 20:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254427 - head/sys/dev/mmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2013 20:32:57 -0000 Author: ian Date: Fri Aug 16 20:32:56 2013 New Revision: 254427 URL: http://svnweb.freebsd.org/changeset/base/254427 Log: During card identification, run the bus at 400KHz, not the minimum speed the bus claims to be capable of. The 400KHz speed is dictated by the SD and MMC standards. Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Fri Aug 16 20:24:41 2013 (r254426) +++ head/sys/dev/mmc/mmc.c Fri Aug 16 20:32:56 2013 (r254427) @@ -106,6 +106,8 @@ struct mmc_ivars { #define CMD_RETRIES 3 +#define CARD_ID_FREQUENCY 400000 /* Spec requires 400KHz max during ID phase. */ + static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver"); static int mmc_debug; @@ -579,7 +581,7 @@ mmc_power_up(struct mmc_softc *sc) mmcbr_update_ios(dev); mmc_ms_delay(1); - mmcbr_set_clock(dev, mmcbr_get_f_min(sc->dev)); + mmcbr_set_clock(dev, CARD_ID_FREQUENCY); mmcbr_set_timing(dev, bus_timing_normal); mmcbr_set_power_mode(dev, power_on); mmcbr_update_ios(dev); @@ -1534,7 +1536,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmc_idle_cards(sc); } else { mmcbr_set_bus_mode(dev, opendrain); - mmcbr_set_clock(dev, mmcbr_get_f_min(dev)); + mmcbr_set_clock(dev, CARD_ID_FREQUENCY); mmcbr_update_ios(dev); /* XXX recompute vdd based on new cards? */ } @@ -1572,11 +1574,10 @@ static int mmc_calculate_clock(struct mmc_softc *sc) { int max_dtr, max_hs_dtr, max_timing; - int nkid, i, f_min, f_max; + int nkid, i, f_max; device_t *kids; struct mmc_ivars *ivar; - f_min = mmcbr_get_f_min(sc->dev); f_max = mmcbr_get_f_max(sc->dev); max_dtr = max_hs_dtr = f_max; if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED))