Lines Matching +full:write +full:- +full:back

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/mmc/slot-gpio.h>
16 #include "sdhci-pltfm.h"
43 struct mutex write_lock; /* protect back to back writes */
63 return -EFAULT; in sdhci_bcm_kona_sd_reset()
72 * Back-to-Back register write needs a delay of 1ms at bootup (min 10uS) in sdhci_bcm_kona_sd_reset()
73 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_reset()
74 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_reset()
75 * insert-removal. in sdhci_bcm_kona_sd_reset()
97 * Back-to-Back register write needs a delay of 1ms at bootup (min 10uS) in sdhci_bcm_kona_sd_init()
98 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_init()
99 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_init()
100 * insert-removal. in sdhci_bcm_kona_sd_init()
119 * Back-to-Back register write needs a delay of min 10uS. in sdhci_bcm_kona_sd_card_emulate()
120 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_card_emulate()
121 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_card_emulate()
122 * insert-removal. in sdhci_bcm_kona_sd_card_emulate()
125 mutex_lock(&kona_dev->write_lock); in sdhci_bcm_kona_sd_card_emulate()
132 ret = mmc_gpio_get_ro(host->mmc); in sdhci_bcm_kona_sd_card_emulate()
143 mutex_unlock(&kona_dev->write_lock); in sdhci_bcm_kona_sd_card_emulate()
153 if (mmc_gpio_get_cd(host->mmc) > 0) { in sdhci_bcm_kona_card_event()
154 dev_dbg(mmc_dev(host->mmc), in sdhci_bcm_kona_card_event()
158 dev_dbg(mmc_dev(host->mmc), in sdhci_bcm_kona_card_event()
197 { .compatible = "brcm,kona-sdhci"},
198 { .compatible = "bcm,kona-sdhci"}, /* deprecated name */
207 struct device *dev = &pdev->dev; in sdhci_bcm_kona_probe()
218 dev_dbg(dev, "%s: inited. IOADDR=%p\n", __func__, host->ioaddr); in sdhci_bcm_kona_probe()
223 mutex_init(&kona_dev->write_lock); in sdhci_bcm_kona_probe()
225 ret = mmc_of_parse(host->mmc); in sdhci_bcm_kona_probe()
229 if (!host->mmc->f_max) { in sdhci_bcm_kona_probe()
230 dev_err(&pdev->dev, "Missing max-freq for SDHCI cfg\n"); in sdhci_bcm_kona_probe()
231 ret = -ENXIO; in sdhci_bcm_kona_probe()
236 pltfm_priv->clk = devm_clk_get(dev, NULL); in sdhci_bcm_kona_probe()
237 if (IS_ERR(pltfm_priv->clk)) { in sdhci_bcm_kona_probe()
239 ret = PTR_ERR(pltfm_priv->clk); in sdhci_bcm_kona_probe()
243 ret = clk_set_rate(pltfm_priv->clk, host->mmc->f_max); in sdhci_bcm_kona_probe()
249 ret = clk_prepare_enable(pltfm_priv->clk); in sdhci_bcm_kona_probe()
255 dev_dbg(dev, "non-removable=%c\n", in sdhci_bcm_kona_probe()
256 mmc_card_is_removable(host->mmc) ? 'N' : 'Y'); in sdhci_bcm_kona_probe()
258 (mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N', in sdhci_bcm_kona_probe()
259 (mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N'); in sdhci_bcm_kona_probe()
261 if (!mmc_card_is_removable(host->mmc)) in sdhci_bcm_kona_probe()
262 host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_bcm_kona_probe()
265 (host->mmc->caps & MMC_CAP_8_BIT_DATA) ? 'Y' : 'N'); in sdhci_bcm_kona_probe()
278 if (!mmc_card_is_removable(host->mmc)) { in sdhci_bcm_kona_probe()
291 if (mmc_gpio_get_cd(host->mmc) > 0) in sdhci_bcm_kona_probe()
304 clk_disable_unprepare(pltfm_priv->clk); in sdhci_bcm_kona_probe()
309 dev_err(dev, "Probing of sdhci-pltfm failed: %d\n", ret); in sdhci_bcm_kona_probe()
317 struct clk *clk = pltfm_host->clk; in sdhci_bcm_kona_remove()
325 .name = "sdhci-kona",