From owner-svn-src-all@FreeBSD.ORG Tue May 19 21:16:54 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A530423; Tue, 19 May 2015 21:16:54 +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 ECE1016C4; Tue, 19 May 2015 21:16:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4JLGrZH089486; Tue, 19 May 2015 21:16:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4JLGrkB089485; Tue, 19 May 2015 21:16:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201505192116.t4JLGrkB089485@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 19 May 2015 21:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283128 - 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-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: Tue, 19 May 2015 21:16:54 -0000 Author: imp Date: Tue May 19 21:16:53 2015 New Revision: 283128 URL: https://svnweb.freebsd.org/changeset/base/283128 Log: Re-select the SD card before getting the SD status. On a couple Atmel boards, this prevents some error messages during enumeration and also gives us the correct erase block size. They appear to be harmless elsewhere. # Note: we treat too many commands as 'can't fail' if they don't work # after a couple of retries. We need to fix that, but not today... Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Tue May 19 21:16:51 2015 (r283127) +++ head/sys/dev/mmc/mmc.c Tue May 19 21:16:53 2015 (r283128) @@ -1379,6 +1379,20 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->hs_tran_speed = SD_MAX_HS; } } + + /* + * We reselect the card here. Some cards become + * unselected and timeout with the above two commands, + * although the state tables / diagrams in the standard + * suggest they go back to the transfer state. The only + * thing we use from the sd_status is the erase sector + * size, but it is still nice to get that right. It is + * normally harmless for cards not misbehaving. The + * Atmel bridge will complain about this command timing + * out. Others seem to handle it correctly, so it may + * be a combination of card and controller. + */ + mmc_select_card(sc, ivar->rca); mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status); mmc_app_decode_sd_status(ivar->raw_sd_status, &ivar->sd_status);