Lines Matching +full:sdhci +full:- +full:caps

1 // SPDX-License-Identifier: GPL-2.0-only
26 #include "sdhci.h"
27 #include "sdhci-pltfm.h"
55 struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); in pxav2_reset()
56 struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; in pxav2_reset()
67 if (pdata && pdata->clk_delay_sel == 1) { in pxav2_reset()
68 tmp = readw(host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); in pxav2_reset()
71 tmp |= (pdata->clk_delay_cycles & SDCLK_DELAY_MASK) in pxav2_reset()
76 writew(tmp, host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); in pxav2_reset()
79 if (pdata && (pdata->flags & PXA_FLAG_ENABLE_CLOCK_GATING)) { in pxav2_reset()
80 tmp = readw(host->ioaddr + SD_FIFO_PARAM); in pxav2_reset()
82 writew(tmp, host->ioaddr + SD_FIFO_PARAM); in pxav2_reset()
84 tmp = readw(host->ioaddr + SD_FIFO_PARAM); in pxav2_reset()
87 writew(tmp, host->ioaddr + SD_FIFO_PARAM); in pxav2_reset()
96 return readl(host->ioaddr + SDHCI_HOST_VERSION - 2) >> 16; in pxav1_readw()
98 return readw(host->ioaddr + reg); in pxav1_readw()
106 if (pxav2_host->sdio_mrq && (intmask & SDHCI_INT_CMD_MASK)) { in pxav1_irq()
112 if (pxav2_host->pinctrl && pxav2_host->pins_default) in pxav1_irq()
113 pinctrl_select_state(pxav2_host->pinctrl, pxav2_host->pins_default); in pxav1_irq()
115 sdio_mrq = pxav2_host->sdio_mrq; in pxav1_irq()
116 pxav2_host->sdio_mrq = NULL; in pxav1_irq()
117 mmc_request_done(host->mmc, sdio_mrq); in pxav1_irq()
129 if (mrq->cmd && !mrq->cmd->error && in pxav1_request_done()
130 (mrq->cmd->opcode == SD_IO_RW_DIRECT || in pxav1_request_done()
131 mrq->cmd->opcode == SD_IO_RW_EXTENDED)) { in pxav1_request_done()
133 tmp = readw(host->ioaddr + SDHCI_TIMEOUT_CONTROL); in pxav1_request_done()
135 writew(tmp, host->ioaddr + SDHCI_TIMEOUT_CONTROL); in pxav1_request_done()
139 pxav2_host->sdio_mrq = mrq; in pxav1_request_done()
142 if (pxav2_host->pinctrl && pxav2_host->pins_cmd_gpio) in pxav1_request_done()
143 pinctrl_select_state(pxav2_host->pinctrl, pxav2_host->pins_cmd_gpio); in pxav1_request_done()
154 mmc_request_done(host->mmc, mrq); in pxav1_request_done()
162 ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); in pxav2_mmc_set_bus_width()
163 tmp = readw(host->ioaddr + SD_CE_ATA_2); in pxav2_mmc_set_bus_width()
174 writew(tmp, host->ioaddr + SD_CE_ATA_2); in pxav2_mmc_set_bus_width()
175 writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); in pxav2_mmc_set_bus_width()
213 { .compatible = "mrvl,pxav1-mmc", .data = &pxav1_variant, },
214 { .compatible = "mrvl,pxav2-mmc", .data = &pxav2_variant, },
222 struct device_node *np = dev->of_node; in pxav2_get_mmc_pdata()
230 if (of_property_read_bool(np, "non-removable")) in pxav2_get_mmc_pdata()
231 pdata->flags |= PXA_FLAG_CARD_PERMANENT; in pxav2_get_mmc_pdata()
233 of_property_read_u32(np, "bus-width", &bus_width); in pxav2_get_mmc_pdata()
235 pdata->flags |= PXA_FLAG_SD_8_BIT_CAPABLE_SLOT; in pxav2_get_mmc_pdata()
237 of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); in pxav2_get_mmc_pdata()
239 pdata->clk_delay_sel = 1; in pxav2_get_mmc_pdata()
240 pdata->clk_delay_cycles = clk_delay_cycles; in pxav2_get_mmc_pdata()
255 struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; in sdhci_pxav2_probe()
257 struct device *dev = &pdev->dev; in sdhci_pxav2_probe()
279 pltfm_host->clk = clk; in sdhci_pxav2_probe()
288 host->quirks = SDHCI_QUIRK_BROKEN_ADMA in sdhci_pxav2_probe()
299 if (pdata->flags & PXA_FLAG_CARD_PERMANENT) { in sdhci_pxav2_probe()
300 /* on-chip device */ in sdhci_pxav2_probe()
301 host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_pxav2_probe()
302 host->mmc->caps |= MMC_CAP_NONREMOVABLE; in sdhci_pxav2_probe()
306 if (pdata->flags & PXA_FLAG_SD_8_BIT_CAPABLE_SLOT) in sdhci_pxav2_probe()
307 host->mmc->caps |= MMC_CAP_8_BIT_DATA; in sdhci_pxav2_probe()
309 if (pdata->quirks) in sdhci_pxav2_probe()
310 host->quirks |= pdata->quirks; in sdhci_pxav2_probe()
311 if (pdata->host_caps) in sdhci_pxav2_probe()
312 host->mmc->caps |= pdata->host_caps; in sdhci_pxav2_probe()
313 if (pdata->pm_caps) in sdhci_pxav2_probe()
314 host->mmc->pm_caps |= pdata->pm_caps; in sdhci_pxav2_probe()
317 host->quirks |= variant->extra_quirks; in sdhci_pxav2_probe()
318 host->ops = variant->ops; in sdhci_pxav2_probe()
321 pxav2_host->pinctrl = devm_pinctrl_get(dev); in sdhci_pxav2_probe()
322 if (!IS_ERR(pxav2_host->pinctrl)) { in sdhci_pxav2_probe()
323 pxav2_host->pins_cmd_gpio = pinctrl_lookup_state(pxav2_host->pinctrl, in sdhci_pxav2_probe()
325 if (IS_ERR(pxav2_host->pins_cmd_gpio)) in sdhci_pxav2_probe()
326 pxav2_host->pins_cmd_gpio = NULL; in sdhci_pxav2_probe()
327 pxav2_host->pins_default = pinctrl_lookup_state(pxav2_host->pinctrl, in sdhci_pxav2_probe()
329 if (IS_ERR(pxav2_host->pins_default)) in sdhci_pxav2_probe()
330 pxav2_host->pins_default = NULL; in sdhci_pxav2_probe()
332 pxav2_host->pinctrl = NULL; in sdhci_pxav2_probe()
348 .name = "sdhci-pxav2",
359 MODULE_DESCRIPTION("SDHCI driver for pxav2");