Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc Add a vendor callback for setting signal voltage.
details: https://anonhg.NetBSD.org/src/rev/01cd34ba50d7
branches: trunk
changeset: 353183:01cd34ba50d7
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Apr 22 21:49:41 2017 +0000
description:
Add a vendor callback for setting signal voltage.
diffstat:
sys/dev/sdmmc/sdhc.c | 22 ++++++++++++++++++----
sys/dev/sdmmc/sdhcvar.h | 3 ++-
2 files changed, 20 insertions(+), 5 deletions(-)
diffs (78 lines):
diff -r 547e4918166a -r 01cd34ba50d7 sys/dev/sdmmc/sdhc.c
--- a/sys/dev/sdmmc/sdhc.c Sat Apr 22 21:48:56 2017 +0000
+++ b/sys/dev/sdmmc/sdhc.c Sat Apr 22 21:49:41 2017 +0000
@@ -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 @@
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 @@
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;
}
/*
diff -r 547e4918166a -r 01cd34ba50d7 sys/dev/sdmmc/sdhcvar.h
--- a/sys/dev/sdmmc/sdhcvar.h Sat Apr 22 21:48:56 2017 +0000
+++ b/sys/dev/sdmmc/sdhcvar.h Sat Apr 22 21:49:41 2017 +0000
@@ -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 @@
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. */
Home |
Main Index |
Thread Index |
Old Index