Lines Matching refs:host

67 static inline int msm_dll_poll_ck_out_en(struct sdhci_host *host, u8 poll)  in msm_dll_poll_ck_out_en()  argument
71 struct mmc_host *mmc = host->mmc; in msm_dll_poll_ck_out_en()
74 ck_out_en = !!(readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) & in msm_dll_poll_ck_out_en()
85 ck_out_en = !!(readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) & in msm_dll_poll_ck_out_en()
92 static int msm_config_cm_dll_phase(struct sdhci_host *host, u8 phase) in msm_config_cm_dll_phase() argument
101 struct mmc_host *mmc = host->mmc; in msm_config_cm_dll_phase()
103 spin_lock_irqsave(&host->lock, flags); in msm_config_cm_dll_phase()
105 config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
108 writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
111 rc = msm_dll_poll_ck_out_en(host, 0); in msm_config_cm_dll_phase()
119 config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
122 writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
125 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_config_cm_dll_phase()
126 | CORE_CK_OUT_EN), host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
129 rc = msm_dll_poll_ck_out_en(host, 1); in msm_config_cm_dll_phase()
133 config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
136 writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG); in msm_config_cm_dll_phase()
143 spin_unlock_irqrestore(&host->lock, flags); in msm_config_cm_dll_phase()
157 static int msm_find_most_appropriate_phase(struct sdhci_host *host, in msm_find_most_appropriate_phase() argument
166 struct mmc_host *mmc = host->mmc; in msm_find_most_appropriate_phase()
259 static inline void msm_cm_dll_set_freq(struct sdhci_host *host) in msm_cm_dll_set_freq() argument
264 if (host->clock <= 112000000) in msm_cm_dll_set_freq()
266 else if (host->clock <= 125000000) in msm_cm_dll_set_freq()
268 else if (host->clock <= 137000000) in msm_cm_dll_set_freq()
270 else if (host->clock <= 150000000) in msm_cm_dll_set_freq()
272 else if (host->clock <= 162000000) in msm_cm_dll_set_freq()
274 else if (host->clock <= 175000000) in msm_cm_dll_set_freq()
276 else if (host->clock <= 187000000) in msm_cm_dll_set_freq()
278 else if (host->clock <= 200000000) in msm_cm_dll_set_freq()
281 config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG); in msm_cm_dll_set_freq()
284 writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG); in msm_cm_dll_set_freq()
288 static int msm_init_cm_dll(struct sdhci_host *host) in msm_init_cm_dll() argument
290 struct mmc_host *mmc = host->mmc; in msm_init_cm_dll()
294 spin_lock_irqsave(&host->lock, flags); in msm_init_cm_dll()
301 writel_relaxed((readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC) in msm_init_cm_dll()
302 & ~CORE_CLK_PWRSAVE), host->ioaddr + CORE_VENDOR_SPEC); in msm_init_cm_dll()
305 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
306 | CORE_DLL_RST), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
309 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
310 | CORE_DLL_PDN), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
311 msm_cm_dll_set_freq(host); in msm_init_cm_dll()
314 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
315 & ~CORE_DLL_RST), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
318 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
319 & ~CORE_DLL_PDN), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
322 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
323 | CORE_DLL_EN), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
326 writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG) in msm_init_cm_dll()
327 | CORE_CK_OUT_EN), host->ioaddr + CORE_DLL_CONFIG); in msm_init_cm_dll()
330 while (!(readl_relaxed(host->ioaddr + CORE_DLL_STATUS) & in msm_init_cm_dll()
336 spin_unlock_irqrestore(&host->lock, flags); in msm_init_cm_dll()
342 spin_unlock_irqrestore(&host->lock, flags); in msm_init_cm_dll()
346 static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode) in sdhci_msm_execute_tuning() argument
351 struct mmc_host *mmc = host->mmc; in sdhci_msm_execute_tuning()
352 struct mmc_ios ios = host->mmc->ios; in sdhci_msm_execute_tuning()
358 if (host->clock <= 100 * 1000 * 1000 || in sdhci_msm_execute_tuning()
365 rc = msm_init_cm_dll(host); in sdhci_msm_execute_tuning()
372 rc = msm_config_cm_dll_phase(host, phase); in sdhci_msm_execute_tuning()
386 rc = msm_find_most_appropriate_phase(host, tuned_phases, in sdhci_msm_execute_tuning()
397 rc = msm_config_cm_dll_phase(host, phase); in sdhci_msm_execute_tuning()
431 struct sdhci_host *host; in sdhci_msm_probe() local
445 host = sdhci_pltfm_init(pdev, &msm_host->sdhci_msm_pdata, 0); in sdhci_msm_probe()
446 if (IS_ERR(host)) in sdhci_msm_probe()
447 return PTR_ERR(host); in sdhci_msm_probe()
449 pltfm_host = sdhci_priv(host); in sdhci_msm_probe()
451 msm_host->mmc = host->mmc; in sdhci_msm_probe()
454 ret = mmc_of_parse(host->mmc); in sdhci_msm_probe()
525 host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_msm_probe()
526 host->quirks |= SDHCI_QUIRK_SINGLE_POWER_WRITE; in sdhci_msm_probe()
528 host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION)); in sdhci_msm_probe()
545 caps = readl_relaxed(host->ioaddr + SDHCI_CAPABILITIES); in sdhci_msm_probe()
547 writel_relaxed(caps, host->ioaddr + in sdhci_msm_probe()
551 ret = sdhci_add_host(host); in sdhci_msm_probe()
571 struct sdhci_host *host = platform_get_drvdata(pdev); in sdhci_msm_remove() local
572 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in sdhci_msm_remove()
574 int dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) == in sdhci_msm_remove()
577 sdhci_remove_host(host, dead); in sdhci_msm_remove()