Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Simplify card detect



details:   https://anonhg.NetBSD.org/src/rev/eb70c99f623f
branches:  trunk
changeset: 450933:eb70c99f623f
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Apr 30 23:19:55 2019 +0000

description:
Simplify card detect

diffstat:

 sys/dev/ic/dwc_mmc.c     |  15 +++------------
 sys/dev/ic/dwc_mmc_var.h |   3 +--
 2 files changed, 4 insertions(+), 14 deletions(-)

diffs (57 lines):

diff -r 8942046bdfa8 -r eb70c99f623f sys/dev/ic/dwc_mmc.c
--- a/sys/dev/ic/dwc_mmc.c      Tue Apr 30 23:10:33 2019 +0000
+++ b/sys/dev/ic/dwc_mmc.c      Tue Apr 30 23:19:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.16 2019/04/30 23:19:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.16 2019/04/30 23:19:55 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -266,20 +266,11 @@
 dwc_mmc_card_detect(sdmmc_chipset_handle_t sch)
 {
        struct dwc_mmc_softc *sc = sch;
-       int v = 0, i;
 
        if (!sc->sc_card_detect)
                return 1;       /* no card detect pin, assume present */
 
-       for (i = 0; i < 5; i++) {
-               v += sc->sc_card_detect(sc);
-               delay(1000);
-       }
-       if (v == 5)
-               sc->sc_mmc_present = 0;
-       else if (v == 0)
-               sc->sc_mmc_present = 1;
-       return sc->sc_mmc_present;
+       return sc->sc_card_detect(sc);
 }
 
 static int
diff -r 8942046bdfa8 -r eb70c99f623f sys/dev/ic/dwc_mmc_var.h
--- a/sys/dev/ic/dwc_mmc_var.h  Tue Apr 30 23:10:33 2019 +0000
+++ b/sys/dev/ic/dwc_mmc_var.h  Tue Apr 30 23:19:55 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.7 2018/06/19 22:44:33 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.8 2019/04/30 23:19:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -49,7 +49,6 @@
        kcondvar_t sc_idst_cv;
 
        int sc_mmc_width;
-       int sc_mmc_present;
        int sc_mmc_port;
 
        device_t sc_sdmmc_dev;



Home | Main Index | Thread Index | Old Index