Lines Matching refs:omap_host

122 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host);
123 static void sdhci_omap_stop_clock(struct sdhci_omap_host *omap_host);
137 static int sdhci_omap_set_pbias(struct sdhci_omap_host *omap_host, in sdhci_omap_set_pbias() argument
141 struct device *dev = omap_host->dev; in sdhci_omap_set_pbias()
143 if (IS_ERR(omap_host->pbias)) in sdhci_omap_set_pbias()
147 ret = regulator_set_voltage(omap_host->pbias, iov, iov); in sdhci_omap_set_pbias()
153 if (omap_host->pbias_enabled) in sdhci_omap_set_pbias()
156 ret = regulator_enable(omap_host->pbias); in sdhci_omap_set_pbias()
162 omap_host->pbias_enabled = true; in sdhci_omap_set_pbias()
164 if (!omap_host->pbias_enabled) in sdhci_omap_set_pbias()
167 ret = regulator_disable(omap_host->pbias); in sdhci_omap_set_pbias()
172 omap_host->pbias_enabled = false; in sdhci_omap_set_pbias()
178 static int sdhci_omap_enable_iov(struct sdhci_omap_host *omap_host, in sdhci_omap_enable_iov() argument
182 struct sdhci_host *host = omap_host->host; in sdhci_omap_enable_iov()
185 ret = sdhci_omap_set_pbias(omap_host, false, 0); in sdhci_omap_enable_iov()
197 ret = sdhci_omap_set_pbias(omap_host, true, iov); in sdhci_omap_enable_iov()
204 static void sdhci_omap_conf_bus_power(struct sdhci_omap_host *omap_host, in sdhci_omap_conf_bus_power() argument
210 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL); in sdhci_omap_conf_bus_power()
218 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg); in sdhci_omap_conf_bus_power()
221 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg); in sdhci_omap_conf_bus_power()
228 if (sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL) & HCTL_SDBP) in sdhci_omap_conf_bus_power()
240 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_enable_sdio_irq() local
243 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_enable_sdio_irq()
248 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_enable_sdio_irq()
253 static inline void sdhci_omap_set_dll(struct sdhci_omap_host *omap_host, in sdhci_omap_set_dll() argument
259 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_set_dll()
263 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
266 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
268 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_set_dll()
273 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
276 static void sdhci_omap_disable_tuning(struct sdhci_omap_host *omap_host) in sdhci_omap_disable_tuning() argument
280 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_disable_tuning()
282 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_disable_tuning()
284 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_disable_tuning()
286 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_disable_tuning()
293 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_execute_tuning() local
295 struct device *dev = omap_host->dev; in sdhci_omap_execute_tuning()
312 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA2); in sdhci_omap_execute_tuning()
326 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_execute_tuning()
328 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_execute_tuning()
341 omap_host->is_tuning = true; in sdhci_omap_execute_tuning()
349 sdhci_omap_set_dll(omap_host, phase_delay); in sdhci_omap_execute_tuning()
409 sdhci_omap_set_dll(omap_host, phase_delay + i); in sdhci_omap_execute_tuning()
426 sdhci_omap_set_dll(omap_host, phase_delay + i); in sdhci_omap_execute_tuning()
445 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_execute_tuning()
451 sdhci_omap_set_dll(omap_host, phase_delay); in sdhci_omap_execute_tuning()
453 omap_host->is_tuning = false; in sdhci_omap_execute_tuning()
458 omap_host->is_tuning = false; in sdhci_omap_execute_tuning()
460 sdhci_omap_disable_tuning(omap_host); in sdhci_omap_execute_tuning()
478 struct sdhci_omap_host *omap_host; in sdhci_omap_card_busy() local
482 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_card_busy()
484 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_card_busy()
485 ac12 = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_card_busy()
490 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_card_busy()
502 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_PSTATE); in sdhci_omap_card_busy()
506 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_card_busy()
508 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_card_busy()
525 struct sdhci_omap_host *omap_host; in sdhci_omap_start_signal_voltage_switch() local
529 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_start_signal_voltage_switch()
530 dev = omap_host->dev; in sdhci_omap_start_signal_voltage_switch()
533 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_start_signal_voltage_switch()
537 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage); in sdhci_omap_start_signal_voltage_switch()
539 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_start_signal_voltage_switch()
541 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_start_signal_voltage_switch()
545 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_start_signal_voltage_switch()
549 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage); in sdhci_omap_start_signal_voltage_switch()
551 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_start_signal_voltage_switch()
553 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_start_signal_voltage_switch()
560 ret = sdhci_omap_enable_iov(omap_host, iov); in sdhci_omap_start_signal_voltage_switch()
570 static void sdhci_omap_set_timing(struct sdhci_omap_host *omap_host, u8 timing) in sdhci_omap_set_timing() argument
574 struct device *dev = omap_host->dev; in sdhci_omap_set_timing()
576 if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) in sdhci_omap_set_timing()
579 if (omap_host->timing == timing) in sdhci_omap_set_timing()
582 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_timing()
584 pinctrl_state = omap_host->pinctrl_state[timing]; in sdhci_omap_set_timing()
585 ret = pinctrl_select_state(omap_host->pinctrl, pinctrl_state); in sdhci_omap_set_timing()
591 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_timing()
592 omap_host->timing = timing; in sdhci_omap_set_timing()
595 static void sdhci_omap_set_power_mode(struct sdhci_omap_host *omap_host, in sdhci_omap_set_power_mode() argument
598 if (omap_host->bus_mode == MMC_POWER_OFF) in sdhci_omap_set_power_mode()
599 sdhci_omap_disable_tuning(omap_host); in sdhci_omap_set_power_mode()
600 omap_host->power_mode = power_mode; in sdhci_omap_set_power_mode()
603 static void sdhci_omap_set_bus_mode(struct sdhci_omap_host *omap_host, in sdhci_omap_set_bus_mode() argument
608 if (omap_host->bus_mode == mode) in sdhci_omap_set_bus_mode()
611 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_bus_mode()
616 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_bus_mode()
618 omap_host->bus_mode = mode; in sdhci_omap_set_bus_mode()
625 struct sdhci_omap_host *omap_host; in sdhci_omap_set_ios() local
628 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_ios()
630 sdhci_omap_set_bus_mode(omap_host, ios->bus_mode); in sdhci_omap_set_ios()
631 sdhci_omap_set_timing(omap_host, ios->timing); in sdhci_omap_set_ios()
633 sdhci_omap_set_power_mode(omap_host, ios->power_mode); in sdhci_omap_set_ios()
648 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host) in sdhci_omap_start_clock() argument
652 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); in sdhci_omap_start_clock()
654 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg); in sdhci_omap_start_clock()
657 static void sdhci_omap_stop_clock(struct sdhci_omap_host *omap_host) in sdhci_omap_stop_clock() argument
661 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); in sdhci_omap_stop_clock()
663 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg); in sdhci_omap_stop_clock()
669 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_clock() local
672 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_clock()
681 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_clock()
697 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_enable_dma() local
699 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_enable_dma()
705 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_enable_dma()
720 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_bus_width() local
723 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_bus_width()
728 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_bus_width()
738 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_init_74_clocks() local
740 if (omap_host->power_mode == power_mode) in sdhci_omap_init_74_clocks()
748 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_init_74_clocks()
750 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_init_74_clocks()
751 sdhci_omap_writel(omap_host, SDHCI_OMAP_CMD, 0x0); in sdhci_omap_init_74_clocks()
758 if (sdhci_omap_readl(omap_host, SDHCI_OMAP_STAT) & INT_CC_EN) in sdhci_omap_init_74_clocks()
765 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_init_74_clocks()
767 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_init_74_clocks()
768 sdhci_omap_writel(omap_host, SDHCI_OMAP_STAT, INT_CC_EN); in sdhci_omap_init_74_clocks()
778 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_uhs_signaling() local
780 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_uhs_signaling()
782 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_uhs_signaling()
787 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_uhs_signaling()
790 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_uhs_signaling()
797 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_reset() local
802 if (omap_host->is_tuning) in sdhci_omap_reset()
805 if (omap_host->flags & SDHCI_OMAP_SPECIAL_RESET) { in sdhci_omap_reset()
832 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_irq() local
834 if (omap_host->is_tuning && host->cmd && !host->data_early && in sdhci_omap_irq()
885 static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host) in sdhci_omap_set_capabilities() argument
889 struct device *dev = omap_host->dev; in sdhci_omap_set_capabilities()
899 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_set_capabilities()
907 sdhci_omap_writel(omap_host, SDHCI_OMAP_CAPA, reg); in sdhci_omap_set_capabilities()
957 *sdhci_omap_iodelay_pinctrl_state(struct sdhci_omap_host *omap_host, char *mode, in sdhci_omap_iodelay_pinctrl_state() argument
960 struct device *dev = omap_host->dev; in sdhci_omap_iodelay_pinctrl_state()
961 char *version = omap_host->version; in sdhci_omap_iodelay_pinctrl_state()
970 pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, str); in sdhci_omap_iodelay_pinctrl_state()
974 pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, mode); in sdhci_omap_iodelay_pinctrl_state()
986 *omap_host) in sdhci_omap_config_iodelay_pinctrl_state()
988 struct device *dev = omap_host->dev; in sdhci_omap_config_iodelay_pinctrl_state()
989 struct sdhci_host *host = omap_host->host; in sdhci_omap_config_iodelay_pinctrl_state()
996 if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) in sdhci_omap_config_iodelay_pinctrl_state()
1006 omap_host->pinctrl = devm_pinctrl_get(omap_host->dev); in sdhci_omap_config_iodelay_pinctrl_state()
1007 if (IS_ERR(omap_host->pinctrl)) { in sdhci_omap_config_iodelay_pinctrl_state()
1009 return PTR_ERR(omap_host->pinctrl); in sdhci_omap_config_iodelay_pinctrl_state()
1012 state = pinctrl_lookup_state(omap_host->pinctrl, "default"); in sdhci_omap_config_iodelay_pinctrl_state()
1019 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr104", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1024 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr50", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1029 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr50", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1034 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr25", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1039 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr12", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1044 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr_1_8v", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1049 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr_3_3v", in sdhci_omap_config_iodelay_pinctrl_state()
1056 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "hs", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1061 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "hs", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1066 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "hs200_1_8v", caps2, in sdhci_omap_config_iodelay_pinctrl_state()
1071 omap_host->pinctrl_state = pinctrl_state; in sdhci_omap_config_iodelay_pinctrl_state()
1093 struct sdhci_omap_host *omap_host; in sdhci_omap_probe() local
1116 sizeof(*omap_host)); in sdhci_omap_probe()
1123 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_probe()
1124 omap_host->host = host; in sdhci_omap_probe()
1125 omap_host->base = host->ioaddr; in sdhci_omap_probe()
1126 omap_host->dev = dev; in sdhci_omap_probe()
1127 omap_host->power_mode = MMC_POWER_UNDEFINED; in sdhci_omap_probe()
1128 omap_host->timing = MMC_TIMING_LEGACY; in sdhci_omap_probe()
1129 omap_host->flags = data->flags; in sdhci_omap_probe()
1141 omap_host->version = "rev11"; in sdhci_omap_probe()
1165 omap_host->pbias = devm_regulator_get_optional(dev, "pbias"); in sdhci_omap_probe()
1166 if (IS_ERR(omap_host->pbias)) { in sdhci_omap_probe()
1167 ret = PTR_ERR(omap_host->pbias); in sdhci_omap_probe()
1172 omap_host->pbias_enabled = false; in sdhci_omap_probe()
1188 ret = sdhci_omap_set_capabilities(omap_host); in sdhci_omap_probe()
1212 ret = sdhci_omap_config_iodelay_pinctrl_state(omap_host); in sdhci_omap_probe()
1249 static void sdhci_omap_context_save(struct sdhci_omap_host *omap_host) in sdhci_omap_context_save() argument
1251 omap_host->con = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_context_save()
1252 omap_host->hctl = sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL); in sdhci_omap_context_save()
1253 omap_host->sysctl = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); in sdhci_omap_context_save()
1254 omap_host->capa = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_context_save()
1255 omap_host->ie = sdhci_omap_readl(omap_host, SDHCI_OMAP_IE); in sdhci_omap_context_save()
1256 omap_host->ise = sdhci_omap_readl(omap_host, SDHCI_OMAP_ISE); in sdhci_omap_context_save()
1260 static void sdhci_omap_context_restore(struct sdhci_omap_host *omap_host) in sdhci_omap_context_restore() argument
1262 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, omap_host->hctl); in sdhci_omap_context_restore()
1263 sdhci_omap_writel(omap_host, SDHCI_OMAP_CAPA, omap_host->capa); in sdhci_omap_context_restore()
1264 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, omap_host->hctl); in sdhci_omap_context_restore()
1266 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, omap_host->sysctl); in sdhci_omap_context_restore()
1267 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, omap_host->con); in sdhci_omap_context_restore()
1268 sdhci_omap_writel(omap_host, SDHCI_OMAP_IE, omap_host->ie); in sdhci_omap_context_restore()
1269 sdhci_omap_writel(omap_host, SDHCI_OMAP_ISE, omap_host->ise); in sdhci_omap_context_restore()
1276 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_suspend() local
1280 sdhci_omap_context_save(omap_host); in sdhci_omap_suspend()
1293 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_resume() local
1299 sdhci_omap_context_restore(omap_host); in sdhci_omap_resume()