Lines Matching refs:omap_host

118 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host);
119 static void sdhci_omap_stop_clock(struct sdhci_omap_host *omap_host);
133 static int sdhci_omap_set_pbias(struct sdhci_omap_host *omap_host, in sdhci_omap_set_pbias() argument
137 struct device *dev = omap_host->dev; in sdhci_omap_set_pbias()
139 if (IS_ERR(omap_host->pbias)) in sdhci_omap_set_pbias()
143 ret = regulator_set_voltage(omap_host->pbias, iov, iov); in sdhci_omap_set_pbias()
149 if (omap_host->pbias_enabled) in sdhci_omap_set_pbias()
152 ret = regulator_enable(omap_host->pbias); in sdhci_omap_set_pbias()
158 omap_host->pbias_enabled = true; in sdhci_omap_set_pbias()
160 if (!omap_host->pbias_enabled) in sdhci_omap_set_pbias()
163 ret = regulator_disable(omap_host->pbias); in sdhci_omap_set_pbias()
168 omap_host->pbias_enabled = false; in sdhci_omap_set_pbias()
174 static int sdhci_omap_enable_iov(struct sdhci_omap_host *omap_host, in sdhci_omap_enable_iov() argument
178 struct sdhci_host *host = omap_host->host; in sdhci_omap_enable_iov()
181 ret = sdhci_omap_set_pbias(omap_host, false, 0); in sdhci_omap_enable_iov()
193 ret = sdhci_omap_set_pbias(omap_host, true, iov); in sdhci_omap_enable_iov()
200 static void sdhci_omap_conf_bus_power(struct sdhci_omap_host *omap_host, in sdhci_omap_conf_bus_power() argument
206 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL); in sdhci_omap_conf_bus_power()
214 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg); in sdhci_omap_conf_bus_power()
217 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg); in sdhci_omap_conf_bus_power()
224 if (sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL) & HCTL_SDBP) in sdhci_omap_conf_bus_power()
236 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_enable_sdio_irq() local
239 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_enable_sdio_irq()
244 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_enable_sdio_irq()
249 static inline void sdhci_omap_set_dll(struct sdhci_omap_host *omap_host, in sdhci_omap_set_dll() argument
255 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_set_dll()
259 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
262 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
264 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_set_dll()
269 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_set_dll()
272 static void sdhci_omap_disable_tuning(struct sdhci_omap_host *omap_host) in sdhci_omap_disable_tuning() argument
276 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_disable_tuning()
278 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_disable_tuning()
280 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_disable_tuning()
282 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_disable_tuning()
289 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_execute_tuning() local
291 struct device *dev = omap_host->dev; in sdhci_omap_execute_tuning()
308 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA2); in sdhci_omap_execute_tuning()
322 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL); in sdhci_omap_execute_tuning()
324 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg); in sdhci_omap_execute_tuning()
337 omap_host->is_tuning = true; in sdhci_omap_execute_tuning()
345 sdhci_omap_set_dll(omap_host, phase_delay); in sdhci_omap_execute_tuning()
405 sdhci_omap_set_dll(omap_host, phase_delay + i); in sdhci_omap_execute_tuning()
422 sdhci_omap_set_dll(omap_host, phase_delay + i); in sdhci_omap_execute_tuning()
441 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_execute_tuning()
447 sdhci_omap_set_dll(omap_host, phase_delay); in sdhci_omap_execute_tuning()
449 omap_host->is_tuning = false; in sdhci_omap_execute_tuning()
454 omap_host->is_tuning = false; in sdhci_omap_execute_tuning()
456 sdhci_omap_disable_tuning(omap_host); in sdhci_omap_execute_tuning()
474 struct sdhci_omap_host *omap_host; in sdhci_omap_card_busy() local
478 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_card_busy()
480 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_card_busy()
481 ac12 = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_card_busy()
486 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_card_busy()
498 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_PSTATE); in sdhci_omap_card_busy()
502 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_card_busy()
504 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_card_busy()
521 struct sdhci_omap_host *omap_host; in sdhci_omap_start_signal_voltage_switch() local
525 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_start_signal_voltage_switch()
526 dev = omap_host->dev; in sdhci_omap_start_signal_voltage_switch()
529 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_start_signal_voltage_switch()
533 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage); in sdhci_omap_start_signal_voltage_switch()
535 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_start_signal_voltage_switch()
537 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_start_signal_voltage_switch()
541 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_start_signal_voltage_switch()
545 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage); in sdhci_omap_start_signal_voltage_switch()
547 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12); in sdhci_omap_start_signal_voltage_switch()
549 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg); in sdhci_omap_start_signal_voltage_switch()
556 ret = sdhci_omap_enable_iov(omap_host, iov); in sdhci_omap_start_signal_voltage_switch()
566 static void sdhci_omap_set_timing(struct sdhci_omap_host *omap_host, u8 timing) in sdhci_omap_set_timing() argument
570 struct device *dev = omap_host->dev; in sdhci_omap_set_timing()
572 if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) in sdhci_omap_set_timing()
575 if (omap_host->timing == timing) in sdhci_omap_set_timing()
578 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_timing()
580 pinctrl_state = omap_host->pinctrl_state[timing]; in sdhci_omap_set_timing()
581 ret = pinctrl_select_state(omap_host->pinctrl, pinctrl_state); in sdhci_omap_set_timing()
587 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_timing()
588 omap_host->timing = timing; in sdhci_omap_set_timing()
591 static void sdhci_omap_set_power_mode(struct sdhci_omap_host *omap_host, in sdhci_omap_set_power_mode() argument
594 if (omap_host->bus_mode == MMC_POWER_OFF) in sdhci_omap_set_power_mode()
595 sdhci_omap_disable_tuning(omap_host); in sdhci_omap_set_power_mode()
596 omap_host->power_mode = power_mode; in sdhci_omap_set_power_mode()
599 static void sdhci_omap_set_bus_mode(struct sdhci_omap_host *omap_host, in sdhci_omap_set_bus_mode() argument
604 if (omap_host->bus_mode == mode) in sdhci_omap_set_bus_mode()
607 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_bus_mode()
612 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_bus_mode()
614 omap_host->bus_mode = mode; in sdhci_omap_set_bus_mode()
621 struct sdhci_omap_host *omap_host; in sdhci_omap_set_ios() local
624 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_ios()
626 sdhci_omap_set_bus_mode(omap_host, ios->bus_mode); in sdhci_omap_set_ios()
627 sdhci_omap_set_timing(omap_host, ios->timing); in sdhci_omap_set_ios()
629 sdhci_omap_set_power_mode(omap_host, ios->power_mode); in sdhci_omap_set_ios()
644 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host) in sdhci_omap_start_clock() argument
648 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); in sdhci_omap_start_clock()
650 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg); in sdhci_omap_start_clock()
653 static void sdhci_omap_stop_clock(struct sdhci_omap_host *omap_host) in sdhci_omap_stop_clock() argument
657 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); in sdhci_omap_stop_clock()
659 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg); in sdhci_omap_stop_clock()
665 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_clock() local
668 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_clock()
677 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_clock()
692 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_enable_dma() local
694 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_enable_dma()
700 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_enable_dma()
715 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_bus_width() local
718 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_bus_width()
723 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_bus_width()
733 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_init_74_clocks() local
735 if (omap_host->power_mode == power_mode) in sdhci_omap_init_74_clocks()
743 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_init_74_clocks()
745 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_init_74_clocks()
746 sdhci_omap_writel(omap_host, SDHCI_OMAP_CMD, 0x0); in sdhci_omap_init_74_clocks()
753 if (sdhci_omap_readl(omap_host, SDHCI_OMAP_STAT) & INT_CC_EN) in sdhci_omap_init_74_clocks()
760 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_init_74_clocks()
762 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_init_74_clocks()
763 sdhci_omap_writel(omap_host, SDHCI_OMAP_STAT, INT_CC_EN); in sdhci_omap_init_74_clocks()
773 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_set_uhs_signaling() local
775 sdhci_omap_stop_clock(omap_host); in sdhci_omap_set_uhs_signaling()
777 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_set_uhs_signaling()
782 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg); in sdhci_omap_set_uhs_signaling()
785 sdhci_omap_start_clock(omap_host); in sdhci_omap_set_uhs_signaling()
792 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_reset() local
797 if (omap_host->is_tuning) in sdhci_omap_reset()
800 if (omap_host->flags & SDHCI_OMAP_SPECIAL_RESET) { in sdhci_omap_reset()
827 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_irq() local
829 if (omap_host->is_tuning && host->cmd && !host->data_early && in sdhci_omap_irq()
880 static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host) in sdhci_omap_set_capabilities() argument
884 struct device *dev = omap_host->dev; in sdhci_omap_set_capabilities()
894 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_set_capabilities()
902 sdhci_omap_writel(omap_host, SDHCI_OMAP_CAPA, reg); in sdhci_omap_set_capabilities()
952 *sdhci_omap_iodelay_pinctrl_state(struct sdhci_omap_host *omap_host, char *mode, in sdhci_omap_iodelay_pinctrl_state() argument
955 struct device *dev = omap_host->dev; in sdhci_omap_iodelay_pinctrl_state()
956 char *version = omap_host->version; in sdhci_omap_iodelay_pinctrl_state()
965 pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, str); in sdhci_omap_iodelay_pinctrl_state()
969 pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, mode); in sdhci_omap_iodelay_pinctrl_state()
981 *omap_host) in sdhci_omap_config_iodelay_pinctrl_state()
983 struct device *dev = omap_host->dev; in sdhci_omap_config_iodelay_pinctrl_state()
984 struct sdhci_host *host = omap_host->host; in sdhci_omap_config_iodelay_pinctrl_state()
991 if (!(omap_host->flags & SDHCI_OMAP_REQUIRE_IODELAY)) in sdhci_omap_config_iodelay_pinctrl_state()
1001 omap_host->pinctrl = devm_pinctrl_get(omap_host->dev); in sdhci_omap_config_iodelay_pinctrl_state()
1002 if (IS_ERR(omap_host->pinctrl)) { in sdhci_omap_config_iodelay_pinctrl_state()
1004 return PTR_ERR(omap_host->pinctrl); in sdhci_omap_config_iodelay_pinctrl_state()
1007 state = pinctrl_lookup_state(omap_host->pinctrl, "default"); in sdhci_omap_config_iodelay_pinctrl_state()
1014 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr104", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1019 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr50", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1024 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr50", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1029 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr25", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1034 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "sdr12", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1039 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr_1_8v", caps, in sdhci_omap_config_iodelay_pinctrl_state()
1044 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "ddr_3_3v", in sdhci_omap_config_iodelay_pinctrl_state()
1051 state = sdhci_omap_iodelay_pinctrl_state(omap_host, "hs", caps, 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, "hs200_1_8v", caps2, in sdhci_omap_config_iodelay_pinctrl_state()
1066 omap_host->pinctrl_state = pinctrl_state; in sdhci_omap_config_iodelay_pinctrl_state()
1088 struct sdhci_omap_host *omap_host; in sdhci_omap_probe() local
1111 sizeof(*omap_host)); in sdhci_omap_probe()
1118 omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_probe()
1119 omap_host->host = host; in sdhci_omap_probe()
1120 omap_host->base = host->ioaddr; in sdhci_omap_probe()
1121 omap_host->dev = dev; in sdhci_omap_probe()
1122 omap_host->power_mode = MMC_POWER_UNDEFINED; in sdhci_omap_probe()
1123 omap_host->timing = MMC_TIMING_LEGACY; in sdhci_omap_probe()
1124 omap_host->flags = data->flags; in sdhci_omap_probe()
1136 omap_host->version = "rev11"; in sdhci_omap_probe()
1160 omap_host->pbias = devm_regulator_get_optional(dev, "pbias"); in sdhci_omap_probe()
1161 if (IS_ERR(omap_host->pbias)) { in sdhci_omap_probe()
1162 ret = PTR_ERR(omap_host->pbias); in sdhci_omap_probe()
1167 omap_host->pbias_enabled = false; in sdhci_omap_probe()
1182 ret = sdhci_omap_set_capabilities(omap_host); in sdhci_omap_probe()
1206 ret = sdhci_omap_config_iodelay_pinctrl_state(omap_host); in sdhci_omap_probe()
1243 static void sdhci_omap_context_save(struct sdhci_omap_host *omap_host) in sdhci_omap_context_save() argument
1245 omap_host->con = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON); in sdhci_omap_context_save()
1246 omap_host->hctl = sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL); in sdhci_omap_context_save()
1247 omap_host->capa = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA); in sdhci_omap_context_save()
1250 static void sdhci_omap_context_restore(struct sdhci_omap_host *omap_host) in sdhci_omap_context_restore() argument
1252 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, omap_host->con); in sdhci_omap_context_restore()
1253 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, omap_host->hctl); in sdhci_omap_context_restore()
1254 sdhci_omap_writel(omap_host, SDHCI_OMAP_CAPA, omap_host->capa); in sdhci_omap_context_restore()
1261 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_suspend() local
1265 sdhci_omap_context_save(omap_host); in sdhci_omap_suspend()
1278 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); in sdhci_omap_resume() local
1284 sdhci_omap_context_restore(omap_host); in sdhci_omap_resume()