Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc SDHC can have multiple slots, note which slot ...



details:   https://anonhg.NetBSD.org/src/rev/a0b8fc6c4c39
branches:  trunk
changeset: 780128:a0b8fc6c4c39
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Jul 12 16:58:50 2012 +0000

description:
SDHC can have multiple slots, note which slot a specific sdmmc(4) attaches to.

diffstat:

 sys/dev/sdmmc/sdhc.c |  21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r 3dd32341319c -r a0b8fc6c4c39 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:55:57 2012 +0000
+++ b/sys/dev/sdmmc/sdhc.c      Thu Jul 12 16:58:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdhc.c,v 1.16 2012/07/12 16:46:48 jakllsch Exp $       */
+/*     $NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch 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.16 2012/07/12 16:46:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.17 2012/07/12 16:58:50 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -88,6 +88,7 @@
 };
 
 #define HDEVNAME(hp)   (device_xname((hp)->sc->sc_dev))
+#define HDEVINST(hp)   ((int)(((hp)-(hp)->sc->sc_host[0])/sizeof(*(hp))))
 
 static uint8_t
 hread1(struct sdhc_host *hp, bus_size_t reg)
@@ -216,6 +217,20 @@
        sdhc_card_intr_ack
 };
 
+static int
+sdhc_cfprint(void *aux, const char *pnp)
+{
+       const struct sdmmcbus_attach_args const * saa = aux;
+       const struct sdhc_host * const hp = saa->saa_sch;
+       
+       if (pnp) {
+               aprint_normal("sdmmc at %s", pnp);
+       }
+       aprint_normal(" slot %d", HDEVINST(hp));
+
+       return UNCONF;
+}
+
 /*
  * Called by attachment driver.  For each SD card slot there is one SD
  * host controller standard register set. (1.3)
@@ -390,7 +405,7 @@
        if (ISSET(hp->flags, SHF_USE_DMA))
                saa.saa_caps |= SMC_CAPS_DMA;
 #endif
-       hp->sdmmc = config_found(sc->sc_dev, &saa, NULL);
+       hp->sdmmc = config_found(sc->sc_dev, &saa, sdhc_cfprint);
 
        return 0;
 



Home | Main Index | Thread Index | Old Index