summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2022-01-18 11:36:22 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2022-01-18 11:36:22 +0000
commit21d25310401e65a6b3b3fe1df50e3fbe43cdc0f0 (patch)
tree906403bd570c95529ffdbc73fbf0420194a6dd21 /sys/dev/acpi
parente2c18389ad572a97d17e4da054ae4bd45189dec6 (diff)
Improve how quirks are handled on sdhc(4)-compatible drivers. So far
we have passed a modified version of the contents in the capabilities register if we wanted to override what sdhc(4) would otherwise read. Unfortunately there's a second capabilities register that we did not yet take into consideration, which is why to disable DDR50 support we created a quirk flag in the softc. The sdhc(4) ACPI nodes have a way to mask and set bits in both of the capabilities register, which is a flexible approach to solving that issue and using that for our sdhc(4) drivers even improves readability. ok kettenis@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/sdhc_acpi.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/dev/acpi/sdhc_acpi.c b/sys/dev/acpi/sdhc_acpi.c
index 0e3a633fa2b..17931f04ee7 100644
--- a/sys/dev/acpi/sdhc_acpi.c
+++ b/sys/dev/acpi/sdhc_acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc_acpi.c,v 1.19 2021/12/21 20:53:46 kettenis Exp $ */
+/* $OpenBSD: sdhc_acpi.c,v 1.20 2022/01/18 11:36:21 patrick Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
@@ -88,7 +88,7 @@ sdhc_acpi_attach(struct device *parent, struct device *self, void *aux)
struct sdhc_acpi_softc *sc = (struct sdhc_acpi_softc *)self;
struct acpi_attach_args *aaa = aux;
struct aml_value res;
- uint32_t cap, capmask;
+ uint64_t capmask, capset;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_node = aaa->aaa_node;
@@ -135,13 +135,8 @@ sdhc_acpi_attach(struct device *parent, struct device *self, void *aux)
sdhc_acpi_power_on(sc, sc->sc_node);
sdhc_acpi_explore(sc);
- cap = acpi_getpropint(sc->sc_node, "sdhci-caps", 0);
capmask = acpi_getpropint(sc->sc_node, "sdhci-caps-mask", 0);
- if (capmask != 0) {
- cap = bus_space_read_4(sc->sc_memt, sc->sc_memh,
- SDHC_CAPABILITIES);
- cap &= ~capmask;
- }
+ capset = acpi_getpropint(sc->sc_node, "sdhci-caps", 0);
/* Raspberry Pi4 "emmc2" controller. */
if (strcmp(aaa->aaa_dev, "BRCME88C") == 0)
@@ -152,7 +147,7 @@ sdhc_acpi_attach(struct device *parent, struct device *self, void *aux)
sc->sc.sc_clkbase = acpi_getpropint(sc->sc_node,
"clock-frequency", 0) / 1000;
sdhc_host_found(&sc->sc, sc->sc_memt, sc->sc_memh,
- aaa->aaa_size[0], 1, cap);
+ aaa->aaa_size[0], 1, capmask, capset);
}
int