Some ACPI platforms targetting linux that have quirky SDHC controllers
use ACPI _DSD properties to override the capability register of the
controller. An example is the SDHC controller on the Raspberry Pi4.
Diff below implements this.
ok?
Index: dev/acpi/sdhc_acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/sdhc_acpi.c,v
retrieving revision 1.15
diff -u -p -r1.15 sdhc_acpi.c
--- dev/acpi/sdhc_acpi.c 8 May 2020 11:18:01 -0000 1.15
+++ dev/acpi/sdhc_acpi.c 24 Dec 2020 11:19:35 -0000
@@ -84,6 +84,7 @@ sdhc_acpi_attach(struct device *parent,
struct sdhc_acpi_softc *sc = (struct sdhc_acpi_softc *)self;
struct acpi_attach_args *aaa = aux;
struct aml_value res;
+ uint32_t cap, capmask;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_node = aaa->aaa_node;
@@ -140,10 +141,18 @@ sdhc_acpi_attach(struct device *parent,
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;
+ }
+
sc->sc.sc_host = &sc->sc_host;
sc->sc.sc_dmat = aaa->aaa_dmat;
sdhc_host_found(&sc->sc, sc->sc_memt, sc->sc_memh,
- aaa->aaa_size[0], 1, 0);
+ aaa->aaa_size[0], 1, cap);
}
int