summaryrefslogtreecommitdiffstats
path: root/sys/dev/sdmmc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2010-08-27 15:41:42 +0000
committerderaadt <deraadt@openbsd.org>2010-08-27 15:41:42 +0000
commit2c6678e47bca79bbefefdbb62fbdbca52110a2ab (patch)
treece9ac50124cbde1254f3d3cad58b9883f8609dac /sys/dev/sdmmc
parentno need for a sc_suspended variable (diff)
downloadwireguard-openbsd-2c6678e47bca79bbefefdbb62fbdbca52110a2ab.tar.xz
wireguard-openbsd-2c6678e47bca79bbefefdbb62fbdbca52110a2ab.zip
Improve sdhc_activate, and make sdhc_powerhook a simple wrapper around
it for now ok kettenis
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r--sys/dev/sdmmc/sdhc.c31
-rw-r--r--sys/dev/sdmmc/sdhcvar.h5
2 files changed, 19 insertions, 17 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c
index 0f90fdf4eae..d09d613cf89 100644
--- a/sys/dev/sdmmc/sdhc.c
+++ b/sys/dev/sdmmc/sdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc.c,v 1.29 2010/08/27 04:09:20 deraadt Exp $ */
+/* $OpenBSD: sdhc.c,v 1.30 2010/08/27 15:41:43 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -248,18 +248,15 @@ err:
return (error);
}
-/*
- * Power hook established by or called from attachment driver.
- */
-void
-sdhc_power(int why, void *arg)
+int
+sdhc_activate(struct device *self, int act)
{
- struct sdhc_softc *sc = arg;
+ struct sdhc_softc *sc = (struct sdhc_softc *)self;
struct sdhc_host *hp;
int n, i;
- switch(why) {
- case PWR_SUSPEND:
+ switch (act) {
+ case DVACT_SUSPEND:
/* XXX poll for command completion or suspend command
* in progress */
@@ -269,11 +266,9 @@ sdhc_power(int why, void *arg)
for (i = 0; i < sizeof hp->regs; i++)
hp->regs[i] = HREAD1(hp, i);
}
- config_activate_children((struct device *)sc,
- DVACT_SUSPEND);
+ config_activate_children((struct device *)sc, act);
break;
-
- case PWR_RESUME:
+ case DVACT_RESUME:
/* Restore the host controller state. */
for (n = 0; n < sc->sc_nhosts; n++) {
hp = sc->sc_host[n];
@@ -281,10 +276,16 @@ sdhc_power(int why, void *arg)
for (i = 0; i < sizeof hp->regs; i++)
HWRITE1(hp, i, hp->regs[i]);
}
- config_activate_children((struct device *)sc,
- DVACT_RESUME);
+ config_activate_children((struct device *)sc, act);
break;
}
+ return (0);
+}
+
+void
+sdhc_powerhook(int why, void *arg)
+{
+ sdhc_activate(arg, why);
}
/*
diff --git a/sys/dev/sdmmc/sdhcvar.h b/sys/dev/sdmmc/sdhcvar.h
index be883e395e5..ae035232689 100644
--- a/sys/dev/sdmmc/sdhcvar.h
+++ b/sys/dev/sdmmc/sdhcvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg Exp $ */
+/* $OpenBSD: sdhcvar.h,v 1.4 2010/08/27 15:41:43 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -33,7 +33,8 @@ struct sdhc_softc {
/* Host controller functions called by the attachment driver. */
int sdhc_host_found(struct sdhc_softc *, bus_space_tag_t,
bus_space_handle_t, bus_size_t, int);
-void sdhc_power(int, void *);
+int sdhc_activate(struct device *, int);
+void sdhc_powerhook(int, void *);
void sdhc_shutdown(void *);
int sdhc_intr(void *);