Lines Matching +full:sdhci +full:- +full:8
1 // SPDX-License-Identifier: GPL-2.0-only
3 * sdhci-pltfm.c Support for SDHCI platform devices
14 * SDHCI platform devices
16 * Inspired by sdhci-pci.c, by Pierre Ossman
26 #include "sdhci-pltfm.h"
32 return clk_get_rate(pltfm_host->clk); in sdhci_pltfm_clk_get_max_clock()
45 if (device_property_present(dev, "sdhci,wp-inverted") || in sdhci_wp_inverted()
46 device_property_present(dev, "wp-inverted")) in sdhci_wp_inverted()
49 /* Old device trees don't have the wp-inverted property. */ in sdhci_wp_inverted()
61 struct device_node *np = pdev->dev.of_node; in sdhci_get_compatibility()
66 if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc")) in sdhci_get_compatibility()
67 host->quirks |= SDHCI_QUIRK_BROKEN_DMA; in sdhci_get_compatibility()
69 if (of_device_is_compatible(np, "fsl,p2020-esdhc") || in sdhci_get_compatibility()
70 of_device_is_compatible(np, "fsl,p1010-esdhc") || in sdhci_get_compatibility()
71 of_device_is_compatible(np, "fsl,t4240-esdhc") || in sdhci_get_compatibility()
72 of_device_is_compatible(np, "fsl,mpc8536-esdhc")) in sdhci_get_compatibility()
73 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; in sdhci_get_compatibility()
81 struct device *dev = &pdev->dev; in sdhci_get_property()
86 if (device_property_present(dev, "sdhci,auto-cmd12")) in sdhci_get_property()
87 host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12; in sdhci_get_property()
89 if (device_property_present(dev, "sdhci,1-bit-only") || in sdhci_get_property()
90 (device_property_read_u32(dev, "bus-width", &bus_width) == 0 && in sdhci_get_property()
92 host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; in sdhci_get_property()
95 host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT; in sdhci_get_property()
97 if (device_property_present(dev, "broken-cd")) in sdhci_get_property()
98 host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_get_property()
100 if (device_property_present(dev, "no-1-8-v")) in sdhci_get_property()
101 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; in sdhci_get_property()
105 device_property_read_u32(dev, "clock-frequency", &pltfm_host->clock); in sdhci_get_property()
107 if (device_property_present(dev, "keep-power-in-suspend")) in sdhci_get_property()
108 host->mmc->pm_caps |= MMC_PM_KEEP_POWER; in sdhci_get_property()
110 if (device_property_read_bool(dev, "wakeup-source") || in sdhci_get_property()
111 device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */ in sdhci_get_property()
112 host->mmc->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; in sdhci_get_property()
136 host = sdhci_alloc_host(&pdev->dev, in sdhci_pltfm_init()
144 host->ioaddr = ioaddr; in sdhci_pltfm_init()
145 host->irq = irq; in sdhci_pltfm_init()
146 host->hw_name = dev_name(&pdev->dev); in sdhci_pltfm_init()
147 if (pdata && pdata->ops) in sdhci_pltfm_init()
148 host->ops = pdata->ops; in sdhci_pltfm_init()
150 host->ops = &sdhci_pltfm_ops; in sdhci_pltfm_init()
152 host->quirks = pdata->quirks; in sdhci_pltfm_init()
153 host->quirks2 = pdata->quirks2; in sdhci_pltfm_init()
160 dev_err(&pdev->dev, "%s failed %d\n", __func__, ret); in sdhci_pltfm_init()
198 int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); in sdhci_pltfm_unregister()
201 clk_disable_unprepare(pltfm_host->clk); in sdhci_pltfm_unregister()
215 if (host->tuning_mode != SDHCI_TUNING_MODE_3) in sdhci_pltfm_suspend()
216 mmc_retune_needed(host->mmc); in sdhci_pltfm_suspend()
222 clk_disable_unprepare(pltfm_host->clk); in sdhci_pltfm_suspend()
234 ret = clk_prepare_enable(pltfm_host->clk); in sdhci_pltfm_resume()
240 clk_disable_unprepare(pltfm_host->clk); in sdhci_pltfm_resume()
254 pr_info("sdhci-pltfm: SDHCI platform and OF driver helper\n"); in sdhci_pltfm_drv_init()
265 MODULE_DESCRIPTION("SDHCI platform and OF driver helper");