Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sdmmc - Get SDIO reset working (from OpenBSD).



details:   https://anonhg.NetBSD.org/src/rev/e83e1366bb4e
branches:  trunk
changeset: 827327:e83e1366bb4e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Oct 23 13:47:17 2017 +0000

description:
- Get SDIO reset working (from OpenBSD).
- After switching bus width, notify the host controller of the change.

diffstat:

 sys/dev/sdmmc/sdmmc_io.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (56 lines):

diff -r df82f346e89c -r e83e1366bb4e sys/dev/sdmmc/sdmmc_io.c
--- a/sys/dev/sdmmc/sdmmc_io.c  Mon Oct 23 13:28:19 2017 +0000
+++ b/sys/dev/sdmmc/sdmmc_io.c  Mon Oct 23 13:47:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc_io.c,v 1.12 2015/10/06 14:32:51 mlelstv Exp $    */
+/*     $NetBSD: sdmmc_io.c,v 1.13 2017/10/23 13:47:17 jmcneill Exp $   */
 /*     $OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $       */
 
 /*
@@ -20,7 +20,7 @@
 /* Routines for SD I/O cards. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.12 2015/10/06 14:32:51 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.13 2017/10/23 13:47:17 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -122,9 +122,6 @@
                goto out;
        }
 
-       /* Reset I/O functions (again). */
-       sdmmc_io_reset(sc);
-
        /* Send the new OCR value until all cards are ready. */
        error = sdmmc_io_send_op_cond(sc, host_ocr, NULL);
        if (error) {
@@ -203,6 +200,11 @@
                        sdmmc_io_write_1(sf, SD_IO_CCCR_BUS_WIDTH,
                            CCCR_BUS_WIDTH_4);
                        sf->width = 4;
+                       error = sdmmc_chip_bus_width(sc->sc_sct, sc->sc_sch,
+                           sf->width);
+                       if (error)
+                               aprint_error_dev(sc->sc_dev,
+                                   "can't change bus width\n");
                }
 
                error = sdmmc_read_cis(sf, &sf->cis);
@@ -535,12 +537,10 @@
 static void
 sdmmc_io_reset(struct sdmmc_softc *sc)
 {
+       u_char data = CCCR_CTL_RES;
 
-       /* Don't lock */
-#if 0 /* XXX command fails */
-       (void)sdmmc_io_write(sc, NULL, SD_IO_REG_CCCR_CTL, CCCR_CTL_RES);
-       sdmmc_delay(100000);
-#endif
+       if (sdmmc_io_rw_direct(sc, NULL, SD_IO_CCCR_CTL, &data, SD_ARG_CMD52_WRITE) == 0)
+               sdmmc_delay(100000);
 }
 
 /*



Home | Main Index | Thread Index | Old Index