Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc fix problem for ESDHC/USDHC due to change of r...



details:   https://anonhg.NetBSD.org/src/rev/54c612e068f2
branches:  trunk
changeset: 354643:54c612e068f2
user:      ryo <ryo%NetBSD.org@localhost>
date:      Fri Jun 23 08:43:59 2017 +0000

description:
fix problem for ESDHC/USDHC due to change of r1.96

on ESDHC/USDHC, even if the iosize is less than SDHC_HOST_CTL_VERSION,
specver must be an appropriate value.

diffstat:

 sys/dev/sdmmc/sdhc.c    |  71 ++++++++++++++++++++++++------------------------
 sys/dev/sdmmc/sdhcreg.h |   3 +-
 2 files changed, 37 insertions(+), 37 deletions(-)

diffs (111 lines):

diff -r 9afc845af1ae -r 54c612e068f2 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Fri Jun 23 06:33:35 2017 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Fri Jun 23 08:43:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.100 2017/04/22 21:49:41 jmcneill Exp $      */
+/*     $NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $   */
 /*     $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $        */
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.100 2017/04/22 21:49:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.101 2017/06/23 08:43:59 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -292,42 +292,41 @@
        callout_init(&hp->tuning_timer, CALLOUT_MPSAFE);
        callout_setfunc(&hp->tuning_timer, sdhc_tuning_timer, hp);
 
-       if (iosize <= SDHC_HOST_CTL_VERSION) {
-               aprint_normal_dev(sc->sc_dev, "SDHC NO-VERS");
-               hp->specver = -1;
+       if (ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) {
+               sdhcver = SDHC_SPEC_VERS_300 << SDHC_SPEC_VERS_SHIFT;
+       } else if (ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) {
+               sdhcver = HREAD4(hp, SDHC_ESDHC_HOST_CTL_VERSION);
+       } else if (iosize <= SDHC_HOST_CTL_VERSION) {
+               sdhcver = SDHC_SPEC_NOVERS << SDHC_SPEC_VERS_SHIFT;
        } else {
-               if (ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) {
-                       sdhcver = SDHC_SPEC_VERS_300 << SDHC_SPEC_VERS_SHIFT;
-               } else if (ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) {
-                       sdhcver = HREAD4(hp, SDHC_ESDHC_HOST_CTL_VERSION);
-               } else
-                       sdhcver = HREAD2(hp, SDHC_HOST_CTL_VERSION);
-               aprint_normal_dev(sc->sc_dev, "SDHC ");
-               hp->specver = SDHC_SPEC_VERSION(sdhcver);
-               switch (SDHC_SPEC_VERSION(sdhcver)) {
-               case SDHC_SPEC_VERS_100:
-                       aprint_normal("1.0");
-                       break;
-
-               case SDHC_SPEC_VERS_200:
-                       aprint_normal("2.0");
-                       break;
-
-               case SDHC_SPEC_VERS_300:
-                       aprint_normal("3.0");
-                       break;
-
-               case SDHC_SPEC_VERS_400:
-                       aprint_normal("4.0");
-                       break;
-
-               default:
-                       aprint_normal("unknown version(0x%x)",
-                           SDHC_SPEC_VERSION(sdhcver));
-                       break;
-               }
+               sdhcver = HREAD2(hp, SDHC_HOST_CTL_VERSION);
+       }
+       aprint_normal_dev(sc->sc_dev, "SDHC ");
+       hp->specver = SDHC_SPEC_VERSION(sdhcver);
+       switch (SDHC_SPEC_VERSION(sdhcver)) {
+       case SDHC_SPEC_VERS_100:
+               aprint_normal("1.0");
+               break;
+       case SDHC_SPEC_VERS_200:
+               aprint_normal("2.0");
+               break;
+       case SDHC_SPEC_VERS_300:
+               aprint_normal("3.0");
+               break;
+       case SDHC_SPEC_VERS_400:
+               aprint_normal("4.0");
+               break;
+       case SDHC_SPEC_NOVERS:
+               hp->specver = -1;
+               aprint_normal("NO-VERS");
+               break;
+       default:
+               aprint_normal("unknown version(0x%x)",
+                   SDHC_SPEC_VERSION(sdhcver));
+               break;
+       }
+       if (SDHC_SPEC_VERSION(sdhcver) != SDHC_SPEC_NOVERS)
                aprint_normal(", rev %u", SDHC_VENDOR_VERSION(sdhcver));
-       }
 
        /*
         * Reset the host controller and enable interrupts.
diff -r 9afc845af1ae -r 54c612e068f2 sys/dev/sdmmc/sdhcreg.h
--- a/sys/dev/sdmmc/sdhcreg.h   Fri Jun 23 06:33:35 2017 +0000
+++ b/sys/dev/sdmmc/sdhcreg.h   Fri Jun 23 08:43:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhcreg.h,v 1.18 2015/12/31 11:53:19 ryo Exp $ */
+/*     $NetBSD: sdhcreg.h,v 1.19 2017/06/23 08:43:59 ryo Exp $ */
 /*     $OpenBSD: sdhcreg.h,v 1.4 2006/07/30 17:20:40 fgsch Exp $       */
 
 /*
@@ -246,6 +246,7 @@
 #define SDHC_SPEC_VERS_200             0x01
 #define SDHC_SPEC_VERS_300             0x02
 #define SDHC_SPEC_VERS_400             0x03
+#define SDHC_SPEC_NOVERS               0xff    /* dummy */
 
 /* SDHC_CAPABILITIES decoding */
 #define SDHC_BASE_V3_FREQ_KHZ(cap)                                     \



Home | Main Index | Thread Index | Old Index