diff options
author | 2011-07-31 16:55:01 +0000 | |
---|---|---|
committer | 2011-07-31 16:55:01 +0000 | |
commit | afa11e3fcd5c8daebf8eb4269b5236b96846e098 (patch) | |
tree | 0b4127e5426c3ed760aea771ed4226a6239cde97 /sys/dev | |
parent | Actually, by merging individual patches, we are already in sync (diff) | |
download | wireguard-openbsd-afa11e3fcd5c8daebf8eb4269b5236b96846e098.tar.xz wireguard-openbsd-afa11e3fcd5c8daebf8eb4269b5236b96846e098.zip |
Add support for the Ricoh 5U823 SD/MMC controller found on the x220.
ok deraadt@, phessler@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/sdhc_pci.c | 19 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdhc.c | 8 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdhcvar.h | 4 |
3 files changed, 22 insertions, 9 deletions
diff --git a/sys/dev/pci/sdhc_pci.c b/sys/dev/pci/sdhc_pci.c index 32225b63dea..54bae58acb6 100644 --- a/sys/dev/pci/sdhc_pci.c +++ b/sys/dev/pci/sdhc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhc_pci.c,v 1.10 2010/09/07 16:21:46 deraadt Exp $ */ +/* $OpenBSD: sdhc_pci.c,v 1.11 2011/07/31 16:55:01 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -62,6 +62,10 @@ sdhc_pci_match(struct device *parent, void *match, void *aux) PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_SYSTEM_SDHC) return 1; + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RICOH && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823) + return 1; + return 0; } @@ -79,6 +83,7 @@ sdhc_pci_attach(struct device *parent, struct device *self, void *aux) bus_space_tag_t iot; bus_space_handle_t ioh; bus_size_t size; + u_int32_t caps = 0; /* Some TI controllers needs special treatment. */ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_TI && @@ -86,11 +91,19 @@ sdhc_pci_attach(struct device *parent, struct device *self, void *aux) pa->pa_function == 4) sdhc_takecontroller(pa); - /* ENE controllers break if set to 0V bus power */ + /* ENE controllers break if set to 0V bus power. */ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ENE && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ENE_SDCARD) sc->sc.sc_flags |= SDHC_F_NOPWR0; + /* Some RICOH controllers lack a capability register. */ + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RICOH && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RICOH_R5U823) + caps = (0x21 << SDHC_BASE_FREQ_SHIFT) | + (0x21 << SDHC_TIMEOUT_FREQ_SHIFT) | + SDHC_TIMEOUT_FREQ_UNIT | SDHC_VOLTAGE_SUPP_3_3V | + SDHC_DMA_SUPPORT; + if (pci_intr_map(pa, &ih)) { printf(": can't map interrupt\n"); return; @@ -136,7 +149,7 @@ sdhc_pci_attach(struct device *parent, struct device *self, void *aux) continue; } - if (sdhc_host_found(&sc->sc, iot, ioh, size, usedma) != 0) + if (sdhc_host_found(&sc->sc, iot, ioh, size, usedma, caps) != 0) /* XXX: sc->sc_host leak */ printf("%s at 0x%x: can't initialize host\n", sc->sc.sc_dev.dv_xname, reg); diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c index 03d60bae7db..828e54284fb 100644 --- a/sys/dev/sdmmc/sdhc.c +++ b/sys/dev/sdmmc/sdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhc.c,v 1.33 2010/09/07 16:21:46 deraadt Exp $ */ +/* $OpenBSD: sdhc.c,v 1.34 2011/07/31 16:55:01 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -129,11 +129,10 @@ struct cfdriver sdhc_cd = { */ int sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot, - bus_space_handle_t ioh, bus_size_t iosize, int usedma) + bus_space_handle_t ioh, bus_size_t iosize, int usedma, u_int32_t caps) { struct sdmmcbus_attach_args saa; struct sdhc_host *hp; - u_int32_t caps; int error = 1; #ifdef SDHC_DEBUG u_int16_t version; @@ -167,7 +166,8 @@ sdhc_host_found(struct sdhc_softc *sc, bus_space_tag_t iot, (void)sdhc_host_reset(hp); /* Determine host capabilities. */ - caps = HREAD4(hp, SDHC_CAPABILITIES); + if (caps == 0) + caps = HREAD4(hp, SDHC_CAPABILITIES); /* Use DMA if the host system and the controller support it. */ if (usedma && ISSET(caps, SDHC_DMA_SUPPORT)) diff --git a/sys/dev/sdmmc/sdhcvar.h b/sys/dev/sdmmc/sdhcvar.h index ac16eac30d6..1ad4518333a 100644 --- a/sys/dev/sdmmc/sdhcvar.h +++ b/sys/dev/sdmmc/sdhcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdhcvar.h,v 1.5 2010/09/07 16:21:46 deraadt Exp $ */ +/* $OpenBSD: sdhcvar.h,v 1.6 2011/07/31 16:55:01 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -32,7 +32,7 @@ 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); + bus_space_handle_t, bus_size_t, int, u_int32_t); int sdhc_activate(struct device *, int); void sdhc_shutdown(void *); int sdhc_intr(void *); |