Module Name:    src
Committed By:   jmcneill
Date:           Mon Aug  3 19:17:35 UTC 2015

Modified Files:
        src/sys/dev/sdmmc: sdmmc_mem.c

Log Message:
Handle cards that are already in low voltage (1.8V) mode. Test correct
bit when determining the best SD transfer mode.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sdmmc/sdmmc_mem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.41 src/sys/dev/sdmmc/sdmmc_mem.c:1.42
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.41	Mon Aug  3 12:10:29 2015
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Mon Aug  3 19:17:35 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.41 2015/08/03 12:10:29 jmcneill Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.42 2015/08/03 19:17:35 jmcneill Exp $	*/
 /*	$OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.41 2015/08/03 12:10:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.42 2015/08/03 19:17:35 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -269,7 +269,8 @@ mmc_mode:
 			goto out;
 
 		delay(1000);
-
+	}
+	if (ISSET(host_ocr, MMC_OCR_S18A)) {
 		SET(sc->sc_flags, SMF_UHS_MODE);
 	}
 
@@ -699,20 +700,20 @@ sdmmc_mem_select_transfer_mode(struct sd
 {
 	if (ISSET(sc->sc_flags, SMF_UHS_MODE)) {
 		if (ISSET(sc->sc_caps, SMC_CAPS_UHS_SDR104) &&
-		    ISSET(support_func, SD_ACCESS_MODE_SDR104)) {
+		    ISSET(support_func, 1 << SD_ACCESS_MODE_SDR104)) {
 			return SD_ACCESS_MODE_SDR104;
 		}
 		if (ISSET(sc->sc_caps, SMC_CAPS_UHS_DDR50) &&
-		    ISSET(support_func, SD_ACCESS_MODE_DDR50)) {
+		    ISSET(support_func, 1 << SD_ACCESS_MODE_DDR50)) {
 			return SD_ACCESS_MODE_DDR50;
 		}
 		if (ISSET(sc->sc_caps, SMC_CAPS_UHS_SDR50) &&
-		    ISSET(support_func, SD_ACCESS_MODE_SDR50)) {
+		    ISSET(support_func, 1 << SD_ACCESS_MODE_SDR50)) {
 			return SD_ACCESS_MODE_SDR50;
 		}
 	}
 	if (ISSET(sc->sc_caps, SMC_CAPS_SD_HIGHSPEED) &&
-	    ISSET(support_func, SD_ACCESS_MODE_SDR25)) {
+	    ISSET(support_func, 1 << SD_ACCESS_MODE_SDR25)) {
 		return SD_ACCESS_MODE_SDR25;
 	}
 	return SD_ACCESS_MODE_SDR12;

Reply via email to