Module Name:    src
Committed By:   jmcneill
Date:           Tue Apr 30 23:19:55 UTC 2019

Modified Files:
        src/sys/dev/ic: dwc_mmc.c dwc_mmc_var.h

Log Message:
Simplify card detect


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/dwc_mmc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/dwc_mmc_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.15 src/sys/dev/ic/dwc_mmc.c:1.16
--- src/sys/dev/ic/dwc_mmc.c:1.15	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ic/dwc_mmc.c	Tue Apr 30 23:19:55 2019
@@ -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 <jmcne...@invisible.ca>
@@ -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 @@ static int
 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

Index: src/sys/dev/ic/dwc_mmc_var.h
diff -u src/sys/dev/ic/dwc_mmc_var.h:1.7 src/sys/dev/ic/dwc_mmc_var.h:1.8
--- src/sys/dev/ic/dwc_mmc_var.h:1.7	Tue Jun 19 22:44:33 2018
+++ src/sys/dev/ic/dwc_mmc_var.h	Tue Apr 30 23:19:55 2019
@@ -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 <jmcne...@invisible.ca>
@@ -49,7 +49,6 @@ struct dwc_mmc_softc {
 	kcondvar_t sc_idst_cv;
 
 	int sc_mmc_width;
-	int sc_mmc_present;
 	int sc_mmc_port;
 
 	device_t sc_sdmmc_dev;

Reply via email to