Hi all,

We have a driver for the Winbond W83l518D, which is an old SDMMC controller
that only supports SDMMC version 1.0.  This means that it doesn't handle
newer opcodes.  Unfortunately, instead of passing them through to the card,
it fails to handle them.  Our current code (specifically sdmmc_mem.c:830)
relies on sending the switch function opcode, which is one of the opcodes
that this controller doesn't support.

I'd like to add a capability in sdmmcvar.h to show that the controller only
supports v1.0.  This is different from the other capabilities there which
are supported (i.e. not unsupported) capabilities.  The reason to do this
is to avoid touching every other driver to add a v1.1+ capability, so it's
the least intrusive way that I can see of supporting this controller.

Patch attached and comments appreciated.

Regards,

Julian
? sys/dev/sdmmc/sdmmc_mem.c.dist
? sys/dev/sdmmc/sdmmcvar.h.dist
cvs diff: Diffing sys/dev/sdmmc
Index: sys/dev/sdmmc/sdmmc_mem.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sdmmc/sdmmc_mem.c,v
retrieving revision 1.68.2.1
diff -u -r1.68.2.1 sdmmc_mem.c
--- sys/dev/sdmmc/sdmmc_mem.c   25 Feb 2020 18:40:43 -0000      1.68.2.1
+++ sys/dev/sdmmc/sdmmc_mem.c   7 May 2020 07:18:39 -0000
@@ -829,7 +829,8 @@
 
        best_func = 0;
        if (sf->scr.sd_spec >= SCR_SD_SPEC_VER_1_10 &&
-           ISSET(sf->csd.ccc, SD_CSD_CCC_SWITCH)) {
+           ISSET(sf->csd.ccc, SD_CSD_CCC_SWITCH) &&
+           !ISSET(sc->sc_caps, SMC_CAPS_ONLY_V10)) {
                DPRINTF(("%s: switch func mode 0\n", SDMMCDEVNAME(sc)));
                error = sdmmc_mem_sd_switch(sf, 0, 1, 0, &status);
                if (error) {
Index: sys/dev/sdmmc/sdmmcvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/sdmmc/sdmmcvar.h,v
retrieving revision 1.30.4.1
diff -u -r1.30.4.1 sdmmcvar.h
--- sys/dev/sdmmc/sdmmcvar.h    25 Feb 2020 18:40:43 -0000      1.30.4.1
+++ sys/dev/sdmmc/sdmmcvar.h    7 May 2020 07:18:39 -0000
@@ -254,6 +254,7 @@
                                    | SMC_CAPS_UHS_SDR104 \
                                    | SMC_CAPS_UHS_DDR50)
 #define SMC_CAPS_MMC_HS200     __BIT(15)       /* eMMC HS200 timing */
+#define SMC_CAPS_ONLY_V10      __BIT(29)       /* controller is v1.0 only */
 #define SMC_CAPS_POLLING       __BIT(30)       /* driver supports cmd polling 
*/
 
        /* function */

Reply via email to