Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc If the controller doesn't support switch func ...



details:   https://anonhg.NetBSD.org/src/rev/e6f5a3aa62e9
branches:  trunk
changeset: 971963:e6f5a3aa62e9
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon May 11 09:51:47 2020 +0000

description:
If the controller doesn't support switch func (opcode 6) then skip
setting this but continue with other settings.  This allows us to use
a card, albeit at a lower speed.

diffstat:

 sys/dev/sdmmc/sdmmc_mem.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 7d6df39e77ec -r e6f5a3aa62e9 sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Mon May 11 03:59:33 2020 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Mon May 11 09:51:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc_mem.c,v 1.71 2020/01/04 22:28:26 mlelstv Exp $   */
+/*     $NetBSD: sdmmc_mem.c,v 1.72 2020/05/11 09:51:47 jdc 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.71 2020/01/04 22:28:26 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.72 2020/05/11 09:51:47 jdc Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -833,9 +833,14 @@
                DPRINTF(("%s: switch func mode 0\n", SDMMCDEVNAME(sc)));
                error = sdmmc_mem_sd_switch(sf, 0, 1, 0, &status);
                if (error) {
-                       aprint_error_dev(sc->sc_dev,
-                           "switch func mode 0 failed\n");
-                       return error;
+                       if (error == ENOTSUP) {
+                               /* Not supported by controller */
+                               goto skipswitchfuncs;
+                       } else {
+                               aprint_error_dev(sc->sc_dev,
+                                   "switch func mode 0 failed\n");
+                               return error;
+                       }
                }
 
                support_func = SFUNC_STATUS_GROUP(&status, 1);
@@ -887,6 +892,7 @@
                        delay(25);
                }
        }
+skipswitchfuncs:
 
        /* update bus clock */
        if (sc->sc_busclk > sf->csd.tran_speed)



Home | Main Index | Thread Index | Old Index