diff options
author | Hubert Mazur <hum@semihalf.com> | 2021-12-21 14:52:56 +0000 |
---|---|---|
committer | Wojciech Macek <wma@FreeBSD.org> | 2022-02-22 08:58:35 +0000 |
commit | caca7dd087527e234fea09aac89634f5148b7478 (patch) | |
tree | 2038e1ebe281a6396c48264e79894e8b0daf5a7b | |
parent | 29cb30dcb08ea06e146628f4ef8d029bf55ffa01 (diff) |
sdhci_fsl_fdt: Apply errata for LX2160A
LX2160A is affected by two erratum regarding SDHCI. However this board
has generic compat string in DTS for SDHCI which means erratum cannot
be simply applied. Compare compat string from "/" path with LX2160A
compat string when attaching device and apply erratum.
Reviewed by: mmel, imp
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D34028
-rw-r--r-- | sys/dev/sdhci/sdhci_fsl_fdt.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 2f19136c6078..34e7e6fd449f 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -219,6 +219,13 @@ static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { .errata = SDHCI_FSL_UNSUPP_1_8V | SDHCI_FSL_TUNING_ERRATUM_TYPE2, }; +static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_lx2160a_soc_data = { + .quirks = 0, + .baseclk_div = 2, + .errata = SDHCI_FSL_UNRELIABLE_PULSE_DET | + SDHCI_FSL_HS400_LIMITED_CLK_DIV, +}; + static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data = { .quirks = 0, .baseclk_div = 1, @@ -790,13 +797,23 @@ sdhci_fsl_fdt_attach(device_t dev) sc = device_get_softc(dev); ocd_data = ofw_bus_search_compatible(dev, sdhci_fsl_fdt_compat_data)->ocd_data; - sc->soc_data = (struct sdhci_fsl_fdt_soc_data *)ocd_data; sc->dev = dev; - sc->slot.quirks = sc->soc_data->quirks; sc->flags = 0; host = &sc->slot.host; - rid = 0; + + /* + * LX2160A needs its own soc_data in order to apply SoC + * specific quriks. Since the controller is identified + * only with a generic compatible string we need to do this dance here. + */ + if (ofw_bus_node_is_compatible(OF_finddevice("/"), "fsl,lx2160a")) + sc->soc_data = &sdhci_fsl_fdt_lx2160a_soc_data; + else + sc->soc_data = (struct sdhci_fsl_fdt_soc_data *)ocd_data; + + sc->slot.quirks = sc->soc_data->quirks; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) { |