diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-08-09 13:53:31 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-08-09 13:53:31 +0000 |
commit | cf836419faf46b6e053c866217ae81c9e8831a3e (patch) | |
tree | 0a15ed1b6eb95d65c5370e13d3c7b15d8f5e1df5 /sys/dev/fdt | |
parent | 920a2da943326c3d49e810751e691ecba806b367 (diff) |
Make imxesdhc(4) pass per-function cookies to the SD/MMC bus.
ok kettenis@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r-- | sys/dev/fdt/imxesdhc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/fdt/imxesdhc.c b/sys/dev/fdt/imxesdhc.c index c3f8d4cd4f9..a7654abf253 100644 --- a/sys/dev/fdt/imxesdhc.c +++ b/sys/dev/fdt/imxesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxesdhc.c,v 1.9 2018/08/06 10:52:30 patrick Exp $ */ +/* $OpenBSD: imxesdhc.c,v 1.10 2018/08/09 13:53:30 patrick Exp $ */ /* * Copyright (c) 2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -182,6 +182,7 @@ struct imxesdhc_softc { uint32_t sc_vmmc; uint32_t sc_pwrseq; uint32_t sc_vdd; + int sc_cookies[SDMMC_MAX_FUNCTIONS]; u_int sc_flags; struct device *sdmmc; /* generic SD/MMC device */ @@ -295,7 +296,7 @@ imxesdhc_attach(struct device *parent, struct device *self, void *aux) struct imxesdhc_softc *sc = (struct imxesdhc_softc *) self; struct fdt_attach_args *faa = aux; struct sdmmcbus_attach_args saa; - int error = 1; + int error = 1, node, reg; uint32_t caps; uint32_t width; @@ -446,6 +447,14 @@ imxesdhc_attach(struct device *parent, struct device *self, void *aux) if (width >= 4) saa.caps |= SMC_CAPS_4BIT_MODE; + for (node = OF_child(sc->sc_node); node; node = OF_peer(node)) { + reg = OF_getpropint(node, "reg", -1); + if (reg < 0 || reg >= SDMMC_MAX_FUNCTIONS) + continue; + sc->sc_cookies[reg] = node; + saa.cookies[reg] = &sc->sc_cookies[reg]; + } + sc->sdmmc = config_found(&sc->sc_dev, &saa, NULL); if (sc->sdmmc == NULL) { error = 0; |