Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sdmmc sdmmc: Only check chipset WP status for SD cards.



details:   https://anonhg.NetBSD.org/src/rev/fc43320fa98b
branches:  trunk
changeset: 374517:fc43320fa98b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Apr 29 13:21:31 2023 +0000

description:
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.

diffstat:

 sys/dev/sdmmc/sdmmc_mem.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r c85c5281fb34 -r fc43320fa98b sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Sat Apr 29 13:00:17 2023 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Sat Apr 29 13:21:31 2023 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index