Module Name: src Committed By: jmcneill Date: Mon Oct 23 13:47:17 UTC 2017
Modified Files: src/sys/dev/sdmmc: sdmmc_io.c Log Message: - Get SDIO reset working (from OpenBSD). - After switching bus width, notify the host controller of the change. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sdmmc/sdmmc_io.c 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/sdmmc/sdmmc_io.c diff -u src/sys/dev/sdmmc/sdmmc_io.c:1.12 src/sys/dev/sdmmc/sdmmc_io.c:1.13 --- src/sys/dev/sdmmc/sdmmc_io.c:1.12 Tue Oct 6 14:32:51 2015 +++ src/sys/dev/sdmmc/sdmmc_io.c Mon Oct 23 13:47:17 2017 @@ -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 @@ sdmmc_io_enable(struct sdmmc_softc *sc) 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_init(struct sdmmc_softc *sc, st 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 @@ sdmmc_io_xchg(struct sdmmc_softc *sc, st 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); } /*