Lines Matching +full:back +full:- +full:to +full:- +full:back

25 #include <linux/mmc/slot-gpio.h>
27 #include "sdhci-pltfm.h"
54 struct mutex write_lock; /* protect back to back writes */
63 /* This timeout should be sufficent for core to reset */ in sdhci_bcm_kona_sd_reset()
74 return -EFAULT; in sdhci_bcm_kona_sd_reset()
83 * Back-to-Back register write needs a delay of 1ms at bootup (min 10uS) in sdhci_bcm_kona_sd_reset()
84 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_reset()
85 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_reset()
86 * insert-removal. in sdhci_bcm_kona_sd_reset()
103 /* Enable the AHB clock gating module to the host */ in sdhci_bcm_kona_sd_init()
108 * Back-to-Back register write needs a delay of 1ms at bootup (min 10uS) in sdhci_bcm_kona_sd_init()
109 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_init()
110 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_init()
111 * insert-removal. in sdhci_bcm_kona_sd_init()
120 * IP to function properly the bit 0 of CORESTAT register needs to be set/reset
121 * to generate the CD IRQ handled in sdhci.c which schedules card_tasklet.
130 * Back-to-Back register write needs a delay of min 10uS. in sdhci_bcm_kona_sd_card_emulate()
131 * Back-to-Back writes to same register needs delay when SD bus clock in sdhci_bcm_kona_sd_card_emulate()
132 * is very low w.r.t AHB clock, mainly during boot-time and during card in sdhci_bcm_kona_sd_card_emulate()
133 * insert-removal. in sdhci_bcm_kona_sd_card_emulate()
136 mutex_lock(&kona_dev->write_lock); in sdhci_bcm_kona_sd_card_emulate()
143 ret = mmc_gpio_get_ro(host->mmc); in sdhci_bcm_kona_sd_card_emulate()
154 mutex_unlock(&kona_dev->write_lock); in sdhci_bcm_kona_sd_card_emulate()
164 if (mmc_gpio_get_cd(host->mmc) > 0) { in sdhci_bcm_kona_card_event()
165 dev_dbg(mmc_dev(host->mmc), in sdhci_bcm_kona_card_event()
169 dev_dbg(mmc_dev(host->mmc), in sdhci_bcm_kona_card_event()
179 * JEDEC and SD spec specify supplying 74 continuous clocks to in sdhci_bcm_kona_init_74_clocks()
181 * that translates to 740us in sdhci_bcm_kona_init_74_clocks()
208 { .compatible = "brcm,kona-sdhci"},
209 { .compatible = "bcm,kona-sdhci"}, /* deprecated name */
218 struct device *dev = &pdev->dev; in sdhci_bcm_kona_probe()
229 dev_dbg(dev, "%s: inited. IOADDR=%p\n", __func__, host->ioaddr); in sdhci_bcm_kona_probe()
234 mutex_init(&kona_dev->write_lock); in sdhci_bcm_kona_probe()
236 ret = mmc_of_parse(host->mmc); in sdhci_bcm_kona_probe()
240 if (!host->mmc->f_max) { in sdhci_bcm_kona_probe()
241 dev_err(&pdev->dev, "Missing max-freq for SDHCI cfg\n"); in sdhci_bcm_kona_probe()
242 ret = -ENXIO; in sdhci_bcm_kona_probe()
247 pltfm_priv->clk = devm_clk_get(dev, NULL); in sdhci_bcm_kona_probe()
248 if (IS_ERR(pltfm_priv->clk)) { in sdhci_bcm_kona_probe()
249 dev_err(dev, "Failed to get core clock\n"); in sdhci_bcm_kona_probe()
250 ret = PTR_ERR(pltfm_priv->clk); in sdhci_bcm_kona_probe()
254 ret = clk_set_rate(pltfm_priv->clk, host->mmc->f_max); in sdhci_bcm_kona_probe()
256 dev_err(dev, "Failed to set rate core clock\n"); in sdhci_bcm_kona_probe()
260 ret = clk_prepare_enable(pltfm_priv->clk); in sdhci_bcm_kona_probe()
262 dev_err(dev, "Failed to enable core clock\n"); in sdhci_bcm_kona_probe()
266 dev_dbg(dev, "non-removable=%c\n", in sdhci_bcm_kona_probe()
267 mmc_card_is_removable(host->mmc) ? 'N' : 'Y'); in sdhci_bcm_kona_probe()
269 (mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N', in sdhci_bcm_kona_probe()
270 (mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N'); in sdhci_bcm_kona_probe()
272 if (!mmc_card_is_removable(host->mmc)) in sdhci_bcm_kona_probe()
273 host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_bcm_kona_probe()
276 (host->mmc->caps & MMC_CAP_8_BIT_DATA) ? 'Y' : 'N'); in sdhci_bcm_kona_probe()
289 if (!mmc_card_is_removable(host->mmc)) { in sdhci_bcm_kona_probe()
293 "unable to emulate card insertion\n"); in sdhci_bcm_kona_probe()
298 * Since the card detection GPIO interrupt is configured to be in sdhci_bcm_kona_probe()
302 if (mmc_gpio_get_cd(host->mmc) > 0) in sdhci_bcm_kona_probe()
315 clk_disable_unprepare(pltfm_priv->clk); in sdhci_bcm_kona_probe()
320 dev_err(dev, "Probing of sdhci-pltfm failed: %d\n", ret); in sdhci_bcm_kona_probe()
326 .name = "sdhci-kona",