Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc Print bus width and clock for feature(High spe...



details:   https://anonhg.NetBSD.org/src/rev/8669b8af5c23
branches:  trunk
changeset: 757790:8669b8af5c23
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Thu Sep 23 12:03:27 2010 +0000

description:
Print bus width and clock for feature(High speed support).

diffstat:

 sys/dev/sdmmc/ld_sdmmc.c  |  12 ++++++++++--
 sys/dev/sdmmc/sdmmc_mem.c |   9 +++++++--
 sys/dev/sdmmc/sdmmcvar.h  |   3 ++-
 3 files changed, 19 insertions(+), 5 deletions(-)

diffs (97 lines):

diff -r aa74f7dce67d -r 8669b8af5c23 sys/dev/sdmmc/ld_sdmmc.c
--- a/sys/dev/sdmmc/ld_sdmmc.c  Thu Sep 23 09:42:17 2010 +0000
+++ b/sys/dev/sdmmc/ld_sdmmc.c  Thu Sep 23 12:03:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_sdmmc.c,v 1.5 2010/09/20 09:03:33 kiyohara Exp $    */
+/*     $NetBSD: ld_sdmmc.c,v 1.6 2010/09/23 12:03:27 kiyohara Exp $    */
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.5 2010/09/20 09:03:33 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.6 2010/09/23 12:03:27 kiyohara Exp $");
 
 #include "rnd.h"
 
@@ -146,8 +146,16 @@
 {
        struct ld_sdmmc_softc *sc = (struct ld_sdmmc_softc *)arg;
        struct ld_softc *ld = &sc->sc_ld;
+       struct sdmmc_softc *ssc = device_private(device_parent(ld->sc_dv));
 
        ldattach(ld);
+       aprint_normal_dev(ld->sc_dv, "%d-bit width, bus clock",
+           sc->sc_sf->width);
+       if ((ssc->sc_busclk / 1000) != 0)
+               aprint_normal(" %u.%03u MHz\n",
+                   ssc->sc_busclk / 1000, ssc->sc_busclk % 1000);
+       else
+               aprint_normal(" %u KHz\n", ssc->sc_busclk % 1000);
        kthread_exit(0);
 }
 
diff -r aa74f7dce67d -r 8669b8af5c23 sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Thu Sep 23 09:42:17 2010 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Thu Sep 23 12:03:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc_mem.c,v 1.10 2010/09/21 04:53:53 kiyohara Exp $  */
+/*     $NetBSD: sdmmc_mem.c,v 1.11 2010/09/23 12:03:27 kiyohara Exp $  */
 /*     $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $      */
 
 /*
@@ -46,7 +46,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.10 2010/09/21 04:53:53 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.11 2010/09/23 12:03:27 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -453,6 +453,7 @@
        }
 
         /* change bus width if supported */
+       sf->width = 1;
        if (ISSET(sc->sc_flags, SMF_SD_MODE)) {
                error = sdmmc_mem_send_scr(sc, sf, sf->raw_scr);
                if (error) {
@@ -470,7 +471,9 @@
                        if (error) {
                                DPRINTF(("%s: can't change bus width"
                                    " (%d bit)\n", SDMMCDEVNAME(sc), 4));
+                               goto out;
                        }
+                       sf->width = 4;
                }
        } else if (sf->csd.mmcver >= MMC_CSD_MMCVER_4_0) {
                if (ISSET(sc->sc_caps, SMC_CAPS_8BIT_MODE)) {
@@ -497,6 +500,8 @@
                        }
 
                        /* XXXX: need bus test? (using by CMD14 & CMD19) */
+
+                       sf->width = width;
                }
        }
 
diff -r aa74f7dce67d -r 8669b8af5c23 sys/dev/sdmmc/sdmmcvar.h
--- a/sys/dev/sdmmc/sdmmcvar.h  Thu Sep 23 09:42:17 2010 +0000
+++ b/sys/dev/sdmmc/sdmmcvar.h  Thu Sep 23 12:03:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmcvar.h,v 1.5 2010/09/22 04:32:53 kiyohara Exp $    */
+/*     $NetBSD: sdmmcvar.h,v 1.6 2010/09/23 12:03:27 kiyohara Exp $    */
 /*     $OpenBSD: sdmmcvar.h,v 1.13 2009/01/09 10:55:22 jsg Exp $       */
 
 /*
@@ -161,6 +161,7 @@
        /* common members */
        struct sdmmc_softc *sc;         /* card slot softc */
        uint16_t rca;                   /* relative card address */
+       int width;                      /* bus width */
        int flags;
 #define SFF_ERROR              0x0001  /* function is poo; ignore it */
 #define SFF_SDHC               0x0002  /* SD High Capacity card */



Home | Main Index | Thread Index | Old Index