Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2015 21:16:53 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283128 - head/sys/dev/mmc
Message-ID:  <201505192116.t4JLGrkB089485@svn.freebsd.org>

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



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