Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/sdhci/sdhci_fsl_fdt.c
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { | static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { | ||||
.quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP, | .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP, | ||||
.baseclk_div = 2, | .baseclk_div = 2, | ||||
.errata = SDHCI_FSL_UNSUPP_1_8V | SDHCI_FSL_TUNING_ERRATUM_TYPE2, | .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 = { | static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data = { | ||||
.quirks = 0, | .quirks = 0, | ||||
.baseclk_div = 1, | .baseclk_div = 1, | ||||
}; | }; | ||||
static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] = { | static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] = { | ||||
{"fsl,ls1012a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1012a_soc_data}, | {"fsl,ls1012a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1012a_soc_data}, | ||||
{"fsl,ls1028a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1028a_soc_data}, | {"fsl,ls1028a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1028a_soc_data}, | ||||
▲ Show 20 Lines • Show All 555 Lines • ▼ Show 20 Lines | sdhci_fsl_fdt_attach(device_t dev) | ||||
phandle_t node; | phandle_t node; | ||||
int rid, ret; | int rid, ret; | ||||
clk_t clk; | clk_t clk; | ||||
node = ofw_bus_get_node(dev); | node = ofw_bus_get_node(dev); | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
ocd_data = ofw_bus_search_compatible(dev, | ocd_data = ofw_bus_search_compatible(dev, | ||||
sdhci_fsl_fdt_compat_data)->ocd_data; | sdhci_fsl_fdt_compat_data)->ocd_data; | ||||
sc->soc_data = (struct sdhci_fsl_fdt_soc_data *)ocd_data; | |||||
sc->dev = dev; | sc->dev = dev; | ||||
sc->slot.quirks = sc->soc_data->quirks; | |||||
sc->flags = 0; | sc->flags = 0; | ||||
host = &sc->slot.host; | host = &sc->slot.host; | ||||
rid = 0; | rid = 0; | ||||
/* | |||||
* LX2160A needs its own soc_data in order to apply SoC | |||||
imp: This comment looks misaligned... though that may be an artifact of phab. | |||||
* 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, | sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, | ||||
RF_ACTIVE); | RF_ACTIVE); | ||||
if (sc->mem_res == NULL) { | if (sc->mem_res == NULL) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Could not allocate resources for controller\n"); | "Could not allocate resources for controller\n"); | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 673 Lines • Show Last 20 Lines |
This comment looks misaligned... though that may be an artifact of phab.