Lines Matching refs:msm_host
136 #define msm_host_readl(msm_host, host, offset) \ argument
137 msm_host->var_ops->msm_readl_relaxed(host, offset)
139 #define msm_host_writel(msm_host, val, host, offset) \ argument
140 msm_host->var_ops->msm_writel_relaxed(val, host, offset)
292 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_priv_msm_offset() local
294 return msm_host->offset; in sdhci_priv_msm_offset()
305 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_mci_variant_readl_relaxed() local
307 return readl_relaxed(msm_host->core_mem + offset); in sdhci_msm_mci_variant_readl_relaxed()
320 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_mci_variant_writel_relaxed() local
322 writel_relaxed(val, msm_host->core_mem + offset); in sdhci_msm_mci_variant_writel_relaxed()
353 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in msm_set_clock_rate_for_bus_mode() local
355 struct clk *core_clk = msm_host->bulk_clks[0].clk; in msm_set_clock_rate_for_bus_mode()
366 msm_host->clk_rate = clock; in msm_set_clock_rate_for_bus_mode()
607 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in msm_init_cm_dll() local
612 msm_host->offset; in msm_init_cm_dll()
614 if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk)) in msm_init_cm_dll()
615 xo_clk = clk_get_rate(msm_host->xo_clk); in msm_init_cm_dll()
628 if (msm_host->dll_config) in msm_init_cm_dll()
629 writel_relaxed(msm_host->dll_config, in msm_init_cm_dll()
632 if (msm_host->use_14lpp_dll_reset) { in msm_init_cm_dll()
658 if (!msm_host->dll_config) in msm_init_cm_dll()
661 if (msm_host->use_14lpp_dll_reset && in msm_init_cm_dll()
662 !IS_ERR_OR_NULL(msm_host->xo_clk)) { in msm_init_cm_dll()
698 if (msm_host->use_14lpp_dll_reset) { in msm_init_cm_dll()
699 if (!msm_host->dll_config) in msm_init_cm_dll()
712 if (msm_host->uses_tassadar_dll) { in msm_init_cm_dll()
721 if (msm_host->clk_rate < 150000000) in msm_init_cm_dll()
761 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in msm_hc_select_default() local
764 msm_host->offset; in msm_hc_select_default()
766 if (!msm_host->use_cdclp533) { in msm_hc_select_default()
801 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in msm_hc_select_hs400() local
806 msm_host->offset; in msm_hc_select_hs400()
818 if ((msm_host->tuning_done || ios.enhanced_strobe) && in msm_hc_select_hs400()
819 !msm_host->calibration_done) { in msm_hc_select_hs400()
827 if (!msm_host->clk_rate && !msm_host->use_cdclp533) { in msm_hc_select_hs400()
883 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_cdclp533_calibration() local
887 msm_host->offset; in sdhci_msm_cdclp533_calibration()
900 ret = msm_config_cm_dll_phase(host, msm_host->saved_tuning_phase); in sdhci_msm_cdclp533_calibration()
989 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_cm_dll_sdc4_calibration() local
1002 if (msm_host->updated_ddr_cfg) in sdhci_msm_cm_dll_sdc4_calibration()
1006 writel_relaxed(msm_host->ddr_config, host->ioaddr + ddr_cfg_offset); in sdhci_msm_cm_dll_sdc4_calibration()
1040 if (!msm_host->use_14lpp_dll_reset) { in sdhci_msm_cm_dll_sdc4_calibration()
1062 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_hs400_dll_calibration() local
1067 msm_host->offset; in sdhci_msm_hs400_dll_calibration()
1082 msm_host->saved_tuning_phase); in sdhci_msm_hs400_dll_calibration()
1092 if (msm_host->use_cdclp533) in sdhci_msm_hs400_dll_calibration()
1123 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_restore_sdr_dll_config() local
1139 ret = msm_config_cm_dll_phase(host, msm_host->saved_tuning_phase); in sdhci_msm_restore_sdr_dll_config()
1173 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_execute_tuning() local
1176 msm_host->use_cdr = false; in sdhci_msm_execute_tuning()
1182 msm_host->use_cdr = true; in sdhci_msm_execute_tuning()
1188 msm_host->tuning_done = 0; in sdhci_msm_execute_tuning()
1254 msm_host->saved_tuning_phase = phase; in sdhci_msm_execute_tuning()
1267 msm_host->tuning_done = true; in sdhci_msm_execute_tuning()
1280 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_hs400() local
1284 (msm_host->tuning_done || ios->enhanced_strobe) && in sdhci_msm_hs400()
1285 !msm_host->calibration_done) { in sdhci_msm_hs400()
1288 msm_host->calibration_done = true; in sdhci_msm_hs400()
1300 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_set_uhs_signaling() local
1304 msm_host->offset; in sdhci_msm_set_uhs_signaling()
1361 msm_host->calibration_done = false; in sdhci_msm_set_uhs_signaling()
1372 static int sdhci_msm_set_pincfg(struct sdhci_msm_host *msm_host, bool level) in sdhci_msm_set_pincfg() argument
1374 struct platform_device *pdev = msm_host->pdev; in sdhci_msm_set_pincfg()
1393 static int msm_toggle_vqmmc(struct sdhci_msm_host *msm_host, in msm_toggle_vqmmc() argument
1399 if (msm_host->vqmmc_enabled == level) in msm_toggle_vqmmc()
1404 if (msm_host->caps_0 & CORE_3_0V_SUPPORT) in msm_toggle_vqmmc()
1406 else if (msm_host->caps_0 & CORE_1_8V_SUPPORT) in msm_toggle_vqmmc()
1409 if (msm_host->caps_0 & CORE_VOLT_SUPPORT) { in msm_toggle_vqmmc()
1426 msm_host->vqmmc_enabled = level; in msm_toggle_vqmmc()
1431 static int msm_config_vqmmc_mode(struct sdhci_msm_host *msm_host, in msm_config_vqmmc_mode() argument
1444 static int sdhci_msm_set_vqmmc(struct sdhci_msm_host *msm_host, in sdhci_msm_set_vqmmc() argument
1467 ret = msm_config_vqmmc_mode(msm_host, mmc, level); in sdhci_msm_set_vqmmc()
1469 ret = msm_toggle_vqmmc(msm_host, mmc, level); in sdhci_msm_set_vqmmc()
1474 static inline void sdhci_msm_init_pwr_irq_wait(struct sdhci_msm_host *msm_host) in sdhci_msm_init_pwr_irq_wait() argument
1476 init_waitqueue_head(&msm_host->pwr_irq_wait); in sdhci_msm_init_pwr_irq_wait()
1480 struct sdhci_msm_host *msm_host) in sdhci_msm_complete_pwr_irq_wait() argument
1482 wake_up(&msm_host->pwr_irq_wait); in sdhci_msm_complete_pwr_irq_wait()
1497 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_check_power_status() local
1501 msm_host->offset; in sdhci_msm_check_power_status()
1505 msm_host->curr_pwr_state, msm_host->curr_io_level); in sdhci_msm_check_power_status()
1513 if (!msm_host->mci_removed) in sdhci_msm_check_power_status()
1514 val = msm_host_readl(msm_host, host, in sdhci_msm_check_power_status()
1538 if ((req_type & msm_host->curr_pwr_state) || in sdhci_msm_check_power_status()
1539 (req_type & msm_host->curr_io_level)) in sdhci_msm_check_power_status()
1548 if (!wait_event_timeout(msm_host->pwr_irq_wait, in sdhci_msm_check_power_status()
1549 msm_host->pwr_irq_flag, in sdhci_msm_check_power_status()
1551 dev_warn(&msm_host->pdev->dev, in sdhci_msm_check_power_status()
1562 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_dump_pwr_ctrl_regs() local
1564 msm_host->offset; in sdhci_msm_dump_pwr_ctrl_regs()
1568 msm_host_readl(msm_host, host, msm_offset->core_pwrctl_status), in sdhci_msm_dump_pwr_ctrl_regs()
1569 msm_host_readl(msm_host, host, msm_offset->core_pwrctl_mask), in sdhci_msm_dump_pwr_ctrl_regs()
1570 msm_host_readl(msm_host, host, msm_offset->core_pwrctl_ctl)); in sdhci_msm_dump_pwr_ctrl_regs()
1576 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_handle_pwr_irq() local
1582 const struct sdhci_msm_offset *msm_offset = msm_host->offset; in sdhci_msm_handle_pwr_irq()
1584 irq_status = msm_host_readl(msm_host, host, in sdhci_msm_handle_pwr_irq()
1588 msm_host_writel(msm_host, irq_status, host, in sdhci_msm_handle_pwr_irq()
1598 while (irq_status & msm_host_readl(msm_host, host, in sdhci_msm_handle_pwr_irq()
1607 msm_host_writel(msm_host, irq_status, host, in sdhci_msm_handle_pwr_irq()
1626 ret = sdhci_msm_set_vqmmc(msm_host, mmc, in sdhci_msm_handle_pwr_irq()
1629 ret = sdhci_msm_set_pincfg(msm_host, in sdhci_msm_handle_pwr_irq()
1663 msm_host_writel(msm_host, irq_ack, host, in sdhci_msm_handle_pwr_irq()
1670 if (msm_host->caps_0 & CORE_VOLT_SUPPORT) { in sdhci_msm_handle_pwr_irq()
1688 (msm_host->caps_0 & CORE_3_0V_SUPPORT)) in sdhci_msm_handle_pwr_irq()
1691 (msm_host->caps_0 & CORE_1_8V_SUPPORT)) in sdhci_msm_handle_pwr_irq()
1700 msm_host->curr_pwr_state = pwr_state; in sdhci_msm_handle_pwr_irq()
1702 msm_host->curr_io_level = io_level; in sdhci_msm_handle_pwr_irq()
1705 mmc_hostname(msm_host->mmc), __func__, irq, irq_status, in sdhci_msm_handle_pwr_irq()
1713 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_pwr_irq() local
1716 msm_host->pwr_irq_flag = 1; in sdhci_msm_pwr_irq()
1717 sdhci_msm_complete_pwr_irq_wait(msm_host); in sdhci_msm_pwr_irq()
1726 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_get_max_clock() local
1727 struct clk *core_clk = msm_host->bulk_clks[0].clk; in sdhci_msm_get_max_clock()
1774 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_set_clock() local
1777 msm_host->clk_rate = clock; in sdhci_msm_set_clock()
1846 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_cqe_add_host() local
1870 msm_host->mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD; in sdhci_msm_cqe_add_host()
1919 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in __sdhci_msm_check_write() local
1935 msm_host->transfer_mode = val; in __sdhci_msm_check_write()
1938 if (!msm_host->use_cdr) in __sdhci_msm_check_write()
1940 if ((msm_host->transfer_mode & SDHCI_TRNS_READ) && in __sdhci_msm_check_write()
1950 msm_host->pwr_irq_flag = 0; in __sdhci_msm_check_write()
1985 static void sdhci_msm_set_regulator_caps(struct sdhci_msm_host *msm_host) in sdhci_msm_set_regulator_caps() argument
1987 struct mmc_host *mmc = msm_host->mmc; in sdhci_msm_set_regulator_caps()
1991 const struct sdhci_msm_offset *msm_offset = msm_host->offset; in sdhci_msm_set_regulator_caps()
2009 u32 io_level = msm_host->curr_io_level; in sdhci_msm_set_regulator_caps()
2023 msm_host->caps_0 |= caps; in sdhci_msm_set_regulator_caps()
2034 static int sdhci_msm_register_vreg(struct sdhci_msm_host *msm_host) in sdhci_msm_register_vreg() argument
2038 ret = mmc_regulator_get_supply(msm_host->mmc); in sdhci_msm_register_vreg()
2042 sdhci_msm_set_regulator_caps(msm_host); in sdhci_msm_register_vreg()
2106 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_dump_vendor_regs() local
2107 const struct sdhci_msm_offset *msm_offset = msm_host->offset; in sdhci_msm_dump_vendor_regs()
2204 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_get_of_property() local
2207 &msm_host->ddr_config)) in sdhci_msm_get_of_property()
2208 msm_host->ddr_config = DDR_CONFIG_POR_VAL; in sdhci_msm_get_of_property()
2210 of_property_read_u32(node, "qcom,dll-config", &msm_host->dll_config); in sdhci_msm_get_of_property()
2218 struct sdhci_msm_host *msm_host; in sdhci_msm_probe() local
2228 host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, sizeof(*msm_host)); in sdhci_msm_probe()
2234 msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_probe()
2235 msm_host->mmc = host->mmc; in sdhci_msm_probe()
2236 msm_host->pdev = pdev; in sdhci_msm_probe()
2248 msm_host->mci_removed = var_info->mci_removed; in sdhci_msm_probe()
2249 msm_host->restore_dll_config = var_info->restore_dll_config; in sdhci_msm_probe()
2250 msm_host->var_ops = var_info->var_ops; in sdhci_msm_probe()
2251 msm_host->offset = var_info->offset; in sdhci_msm_probe()
2252 msm_host->uses_tassadar_dll = var_info->uses_tassadar_dll; in sdhci_msm_probe()
2254 msm_offset = msm_host->offset; in sdhci_msm_probe()
2259 msm_host->saved_tuning_phase = INVALID_TUNING_PHASE; in sdhci_msm_probe()
2262 msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus"); in sdhci_msm_probe()
2263 if (!IS_ERR(msm_host->bus_clk)) { in sdhci_msm_probe()
2265 ret = clk_set_rate(msm_host->bus_clk, INT_MAX); in sdhci_msm_probe()
2268 ret = clk_prepare_enable(msm_host->bus_clk); in sdhci_msm_probe()
2280 msm_host->bulk_clks[1].clk = clk; in sdhci_msm_probe()
2289 msm_host->bulk_clks[0].clk = clk; in sdhci_msm_probe()
2296 msm_host->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); in sdhci_msm_probe()
2297 if (IS_ERR(msm_host->opp_table)) { in sdhci_msm_probe()
2298 ret = PTR_ERR(msm_host->opp_table); in sdhci_msm_probe()
2317 msm_host->bulk_clks[2].clk = clk; in sdhci_msm_probe()
2322 msm_host->bulk_clks[3].clk = clk; in sdhci_msm_probe()
2324 ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), in sdhci_msm_probe()
2325 msm_host->bulk_clks); in sdhci_msm_probe()
2333 msm_host->xo_clk = devm_clk_get(&pdev->dev, "xo"); in sdhci_msm_probe()
2334 if (IS_ERR(msm_host->xo_clk)) { in sdhci_msm_probe()
2335 ret = PTR_ERR(msm_host->xo_clk); in sdhci_msm_probe()
2339 if (!msm_host->mci_removed) { in sdhci_msm_probe()
2340 msm_host->core_mem = devm_platform_ioremap_resource(pdev, 1); in sdhci_msm_probe()
2341 if (IS_ERR(msm_host->core_mem)) { in sdhci_msm_probe()
2342 ret = PTR_ERR(msm_host->core_mem); in sdhci_msm_probe()
2351 if (!msm_host->mci_removed) { in sdhci_msm_probe()
2353 msm_host_writel(msm_host, HC_MODE_EN, host, in sdhci_msm_probe()
2355 config = msm_host_readl(msm_host, host, in sdhci_msm_probe()
2358 msm_host_writel(msm_host, config, host, in sdhci_msm_probe()
2367 core_version = msm_host_readl(msm_host, host, in sdhci_msm_probe()
2376 msm_host->use_14lpp_dll_reset = true; in sdhci_msm_probe()
2383 msm_host->use_cdclp533 = true; in sdhci_msm_probe()
2397 msm_host->updated_ddr_cfg = true; in sdhci_msm_probe()
2399 ret = sdhci_msm_register_vreg(msm_host); in sdhci_msm_probe()
2419 msm_host->pwr_irq = platform_get_irq_byname(pdev, "pwr_irq"); in sdhci_msm_probe()
2420 if (msm_host->pwr_irq < 0) { in sdhci_msm_probe()
2421 ret = msm_host->pwr_irq; in sdhci_msm_probe()
2425 sdhci_msm_init_pwr_irq_wait(msm_host); in sdhci_msm_probe()
2427 msm_host_writel(msm_host, INT_MASK, host, in sdhci_msm_probe()
2430 ret = devm_request_threaded_irq(&pdev->dev, msm_host->pwr_irq, NULL, in sdhci_msm_probe()
2438 msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY; in sdhci_msm_probe()
2467 clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), in sdhci_msm_probe()
2468 msm_host->bulk_clks); in sdhci_msm_probe()
2472 dev_pm_opp_put_clkname(msm_host->opp_table); in sdhci_msm_probe()
2474 if (!IS_ERR(msm_host->bus_clk)) in sdhci_msm_probe()
2475 clk_disable_unprepare(msm_host->bus_clk); in sdhci_msm_probe()
2485 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_remove() local
2492 dev_pm_opp_put_clkname(msm_host->opp_table); in sdhci_msm_remove()
2497 clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), in sdhci_msm_remove()
2498 msm_host->bulk_clks); in sdhci_msm_remove()
2499 if (!IS_ERR(msm_host->bus_clk)) in sdhci_msm_remove()
2500 clk_disable_unprepare(msm_host->bus_clk); in sdhci_msm_remove()
2509 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_runtime_suspend() local
2513 clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), in sdhci_msm_runtime_suspend()
2514 msm_host->bulk_clks); in sdhci_msm_runtime_suspend()
2523 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); in sdhci_msm_runtime_resume() local
2526 ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), in sdhci_msm_runtime_resume()
2527 msm_host->bulk_clks); in sdhci_msm_runtime_resume()
2534 if (msm_host->restore_dll_config && msm_host->clk_rate) in sdhci_msm_runtime_resume()
2537 dev_pm_opp_set_rate(dev, msm_host->clk_rate); in sdhci_msm_runtime_resume()