svn commit: r185527 - head/sys/dev/sdhci
Alexander Motin
mav at FreeBSD.org
Mon Dec 1 09:45:57 PST 2008
Author: mav
Date: Mon Dec 1 17:45:56 2008
New Revision: 185527
URL: http://svn.freebsd.org/changeset/base/185527
Log:
Add controller suspend/resume support.
To be able to correctly suspend/resume with card inserted,
respective support should be also implemented at mmc and mmcsd layers.
Modified:
head/sys/dev/sdhci/sdhci.c
Modified: head/sys/dev/sdhci/sdhci.c
==============================================================================
--- head/sys/dev/sdhci/sdhci.c Mon Dec 1 17:40:57 2008 (r185526)
+++ head/sys/dev/sdhci/sdhci.c Mon Dec 1 17:45:56 2008 (r185527)
@@ -802,6 +802,31 @@ sdhci_detach(device_t dev)
}
static int
+sdhci_suspend(device_t dev)
+{
+ struct sdhci_softc *sc = device_get_softc(dev);
+ int i, err;
+
+ err = bus_generic_suspend(dev);
+ if (err)
+ return (err);
+ for (i = 0; i < sc->num_slots; i++)
+ sdhci_reset(&sc->slots[i], SDHCI_RESET_ALL);
+ return (0);
+}
+
+static int
+sdhci_resume(device_t dev)
+{
+ struct sdhci_softc *sc = device_get_softc(dev);
+ int i;
+
+ for (i = 0; i < sc->num_slots; i++)
+ sdhci_init(&sc->slots[i]);
+ return (bus_generic_resume(dev));
+}
+
+static int
sdhci_update_ios(device_t brdev, device_t reqdev)
{
struct sdhci_slot *slot = device_get_ivars(reqdev);
@@ -1508,6 +1533,8 @@ static device_method_t sdhci_methods[] =
DEVMETHOD(device_probe, sdhci_probe),
DEVMETHOD(device_attach, sdhci_attach),
DEVMETHOD(device_detach, sdhci_detach),
+ DEVMETHOD(device_suspend, sdhci_suspend),
+ DEVMETHOD(device_resume, sdhci_resume),
/* Bus interface */
DEVMETHOD(bus_read_ivar, sdhci_read_ivar),
More information about the svn-src-all
mailing list