Module Name: src Committed By: jmcneill Date: Sat Apr 22 21:49:41 UTC 2017
Modified Files: src/sys/dev/sdmmc: sdhc.c sdhcvar.h Log Message: Add a vendor callback for setting signal voltage. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/dev/sdmmc/sdhc.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sdmmc/sdhcvar.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/sdmmc/sdhc.c diff -u src/sys/dev/sdmmc/sdhc.c:1.99 src/sys/dev/sdmmc/sdhc.c:1.100 --- src/sys/dev/sdmmc/sdhc.c:1.99 Fri Feb 17 10:51:48 2017 +++ src/sys/dev/sdmmc/sdhc.c Sat Apr 22 21:49:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc.c,v 1.99 2017/02/17 10:51:48 nonaka Exp $ */ +/* $NetBSD: sdhc.c,v 1.100 2017/04/22 21:49:41 jmcneill 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.99 2017/02/17 10:51:48 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.100 2017/04/22 21:49:41 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1342,6 +1342,7 @@ static int sdhc_signal_voltage(sdmmc_chipset_handle_t sch, int signal_voltage) { struct sdhc_host *hp = (struct sdhc_host *)sch; + int error = 0; if (hp->specver < SDHC_SPEC_VERS_300) return EINVAL; @@ -1349,19 +1350,32 @@ sdhc_signal_voltage(sdmmc_chipset_handle mutex_enter(&hp->intr_lock); switch (signal_voltage) { case SDMMC_SIGNAL_VOLTAGE_180: + if (hp->sc->sc_vendor_signal_voltage != NULL) { + error = hp->sc->sc_vendor_signal_voltage(hp->sc, + signal_voltage); + if (error != 0) + break; + } if (!ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) HSET2(hp, SDHC_HOST_CTL2, SDHC_1_8V_SIGNAL_EN); break; case SDMMC_SIGNAL_VOLTAGE_330: if (!ISSET(hp->sc->sc_flags, SDHC_FLAG_USDHC)) HCLR2(hp, SDHC_HOST_CTL2, SDHC_1_8V_SIGNAL_EN); + if (hp->sc->sc_vendor_signal_voltage != NULL) { + error = hp->sc->sc_vendor_signal_voltage(hp->sc, + signal_voltage); + if (error != 0) + break; + } break; default: - return EINVAL; + error = EINVAL; + break; } mutex_exit(&hp->intr_lock); - return 0; + return error; } /* Index: src/sys/dev/sdmmc/sdhcvar.h diff -u src/sys/dev/sdmmc/sdhcvar.h:1.28 src/sys/dev/sdmmc/sdhcvar.h:1.29 --- src/sys/dev/sdmmc/sdhcvar.h:1.28 Fri Feb 17 10:51:48 2017 +++ src/sys/dev/sdmmc/sdhcvar.h Sat Apr 22 21:49:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sdhcvar.h,v 1.28 2017/02/17 10:51:48 nonaka Exp $ */ +/* $NetBSD: sdhcvar.h,v 1.29 2017/04/22 21:49:41 jmcneill Exp $ */ /* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */ /* @@ -74,6 +74,7 @@ struct sdhc_softc { int (*sc_vendor_bus_clock)(struct sdhc_softc *, int); int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *); void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *); + int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int); }; /* Host controller functions called by the attachment driver. */