diff options
author | mav <mav@FreeBSD.org> | 2008-12-01 17:45:56 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-12-01 17:45:56 +0000 |
commit | 9ce9c6455336df8584cd3ea4f1f108d07a3b008f (patch) | |
tree | c4e2183f3b49511000d8a74fb183b90e12e2b30b /sys/dev/sdhci/sdhci.c | |
parent | 7457414ec0e0ecf29b38ad82653bb4b393d17ccf (diff) | |
download | FreeBSD-src-9ce9c6455336df8584cd3ea4f1f108d07a3b008f.zip FreeBSD-src-9ce9c6455336df8584cd3ea4f1f108d07a3b008f.tar.gz |
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.
Diffstat (limited to 'sys/dev/sdhci/sdhci.c')
-rw-r--r-- | sys/dev/sdhci/sdhci.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index dcc33b0..7157dac 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -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), |