Module Name:    src
Committed By:   jmcneill
Date:           Sat Apr 29 13:21:31 UTC 2023

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

Log Message:
sdmmc: Only check chipset WP status for SD cards.

The sdmmc_chip_write_protect callback returns the write protect switch
status from the controller (SDWP#). This signal does not exist for eMMC;
instead, write protect is signaled using card registers (CSD). So lets
skip asking the chipset for WP status on eMMC cards for each write
request.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 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.74 src/sys/dev/sdmmc/sdmmc_mem.c:1.75
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.74	Tue Aug  3 07:54:39 2021
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Sat Apr 29 13:21:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.74 2021/08/03 07:54:39 msaitoh Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.75 2023/04/29 13:21:31 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.74 2021/08/03 07:54:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.75 2023/04/29 13:21:31 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -2125,7 +2125,8 @@ sdmmc_mem_write_block(struct sdmmc_funct
 	SDMMC_LOCK(sc);
 	mutex_enter(&sc->sc_mtx);
 
-	if (sdmmc_chip_write_protect(sc->sc_sct, sc->sc_sch)) {
+	if (ISSET(sc->sc_flags, SMF_SD_MODE) &&
+	    sdmmc_chip_write_protect(sc->sc_sct, sc->sc_sch)) {
 		aprint_normal_dev(sc->sc_dev, "write-protected\n");
 		error = EIO;
 		goto out;

Reply via email to