Searched refs:motg (Results 1 - 1 of 1) sorted by relevance

/linux-4.4.14/drivers/usb/phy/
H A Dphy-msm-usb.c49 #define MSM_USB_BASE (motg->regs)
75 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) msm_hsusb_init_vddcx() argument
80 ret = regulator_set_voltage(motg->vddcx, msm_hsusb_init_vddcx()
81 motg->vdd_levels[VDD_LEVEL_MIN], msm_hsusb_init_vddcx()
82 motg->vdd_levels[VDD_LEVEL_MAX]); msm_hsusb_init_vddcx()
84 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n"); msm_hsusb_init_vddcx()
88 ret = regulator_enable(motg->vddcx); msm_hsusb_init_vddcx()
90 dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n"); msm_hsusb_init_vddcx()
92 ret = regulator_set_voltage(motg->vddcx, 0, msm_hsusb_init_vddcx()
93 motg->vdd_levels[VDD_LEVEL_MAX]); msm_hsusb_init_vddcx()
95 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n"); msm_hsusb_init_vddcx()
96 ret = regulator_disable(motg->vddcx); msm_hsusb_init_vddcx()
98 dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n"); msm_hsusb_init_vddcx()
104 static int msm_hsusb_ldo_init(struct msm_otg *motg, int init) msm_hsusb_ldo_init() argument
109 rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN, msm_hsusb_ldo_init()
112 dev_err(motg->phy.dev, "Cannot set v3p3 voltage\n"); msm_hsusb_ldo_init()
115 rc = regulator_enable(motg->v3p3); msm_hsusb_ldo_init()
117 dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n"); msm_hsusb_ldo_init()
120 rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN, msm_hsusb_ldo_init()
123 dev_err(motg->phy.dev, "Cannot set v1p8 voltage\n"); msm_hsusb_ldo_init()
126 rc = regulator_enable(motg->v1p8); msm_hsusb_ldo_init()
128 dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n"); msm_hsusb_ldo_init()
135 regulator_disable(motg->v1p8); msm_hsusb_ldo_init()
137 regulator_disable(motg->v3p3); msm_hsusb_ldo_init()
142 static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on) msm_hsusb_ldo_set_mode() argument
147 ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_HPM_LOAD); msm_hsusb_ldo_set_mode()
152 ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_HPM_LOAD); msm_hsusb_ldo_set_mode()
155 regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD); msm_hsusb_ldo_set_mode()
159 ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD); msm_hsusb_ldo_set_mode()
162 ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_LPM_LOAD); msm_hsusb_ldo_set_mode()
173 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); ulpi_read() local
198 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); ulpi_write() local
226 static void ulpi_init(struct msm_otg *motg) ulpi_init() argument
228 struct msm_otg_platform_data *pdata = motg->pdata; ulpi_init()
236 dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n", ulpi_init()
238 ulpi_write(&motg->phy, seq[idx], addr + idx); ulpi_init()
245 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_phy_notify_disconnect() local
248 if (motg->manual_pullup) { msm_phy_notify_disconnect()
265 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) msm_otg_link_clk_reset() argument
270 ret = reset_control_assert(motg->link_rst); msm_otg_link_clk_reset()
272 ret = reset_control_deassert(motg->link_rst); msm_otg_link_clk_reset()
275 dev_err(motg->phy.dev, "usb link clk reset %s failed\n", msm_otg_link_clk_reset()
281 static int msm_otg_phy_clk_reset(struct msm_otg *motg) msm_otg_phy_clk_reset() argument
285 if (motg->phy_rst) msm_otg_phy_clk_reset()
286 ret = reset_control_reset(motg->phy_rst); msm_otg_phy_clk_reset()
289 dev_err(motg->phy.dev, "usb phy clk reset failed\n"); msm_otg_phy_clk_reset()
294 static int msm_link_reset(struct msm_otg *motg) msm_link_reset() argument
299 ret = msm_otg_link_clk_reset(motg, 1); msm_link_reset()
306 ret = msm_otg_link_clk_reset(motg, 0); msm_link_reset()
310 if (motg->phy_number) msm_link_reset()
322 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_otg_reset() local
341 if (motg->phy_number) msm_otg_reset()
346 static void msm_phy_reset(struct msm_otg *motg) msm_phy_reset() argument
350 if (motg->pdata->phy_type != SNPS_28NM_INTEGRATED_PHY) { msm_phy_reset()
351 msm_otg_phy_clk_reset(motg); msm_phy_reset()
356 if (motg->phy_number) msm_phy_reset()
375 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_usb_reset() local
378 if (!IS_ERR(motg->core_clk)) msm_usb_reset()
379 clk_prepare_enable(motg->core_clk); msm_usb_reset()
381 ret = msm_link_reset(motg); msm_usb_reset()
387 ret = msm_otg_reset(&motg->phy); msm_usb_reset()
396 msm_phy_reset(motg); msm_usb_reset()
398 if (!IS_ERR(motg->core_clk)) msm_usb_reset()
399 clk_disable_unprepare(motg->core_clk); msm_usb_reset()
406 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_phy_init() local
407 struct msm_otg_platform_data *pdata = motg->pdata; msm_phy_init()
411 ulpi_init(motg); msm_phy_init()
417 msm_phy_reset(motg); msm_phy_init()
433 if (motg->manual_pullup) { msm_phy_init()
451 if (motg->phy_number) msm_phy_init()
462 static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high) msm_hsusb_config_vddcx() argument
464 int max_vol = motg->vdd_levels[VDD_LEVEL_MAX]; msm_hsusb_config_vddcx()
469 min_vol = motg->vdd_levels[VDD_LEVEL_MIN]; msm_hsusb_config_vddcx()
471 min_vol = motg->vdd_levels[VDD_LEVEL_NONE]; msm_hsusb_config_vddcx()
473 ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol); msm_hsusb_config_vddcx()
484 static int msm_otg_suspend(struct msm_otg *motg) msm_otg_suspend() argument
486 struct usb_phy *phy = &motg->phy; msm_otg_suspend()
488 struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_suspend()
492 if (atomic_read(&motg->in_lpm)) msm_otg_suspend()
495 disable_irq(motg->irq); msm_otg_suspend()
513 if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY) { msm_otg_suspend()
536 enable_irq(motg->irq); msm_otg_suspend()
550 if (motg->phy_number) msm_otg_suspend()
553 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY && msm_otg_suspend()
554 motg->pdata->otg_control == OTG_PMIC_CONTROL) msm_otg_suspend()
557 clk_disable_unprepare(motg->pclk); msm_otg_suspend()
558 clk_disable_unprepare(motg->clk); msm_otg_suspend()
559 if (!IS_ERR(motg->core_clk)) msm_otg_suspend()
560 clk_disable_unprepare(motg->core_clk); msm_otg_suspend()
562 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY && msm_otg_suspend()
563 motg->pdata->otg_control == OTG_PMIC_CONTROL) { msm_otg_suspend()
564 msm_hsusb_ldo_set_mode(motg, 0); msm_otg_suspend()
565 msm_hsusb_config_vddcx(motg, 0); msm_otg_suspend()
569 enable_irq_wake(motg->irq); msm_otg_suspend()
573 atomic_set(&motg->in_lpm, 1); msm_otg_suspend()
574 enable_irq(motg->irq); msm_otg_suspend()
581 static int msm_otg_resume(struct msm_otg *motg) msm_otg_resume() argument
583 struct usb_phy *phy = &motg->phy; msm_otg_resume()
589 if (!atomic_read(&motg->in_lpm)) msm_otg_resume()
592 clk_prepare_enable(motg->pclk); msm_otg_resume()
593 clk_prepare_enable(motg->clk); msm_otg_resume()
594 if (!IS_ERR(motg->core_clk)) msm_otg_resume()
595 clk_prepare_enable(motg->core_clk); msm_otg_resume()
597 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY && msm_otg_resume()
598 motg->pdata->otg_control == OTG_PMIC_CONTROL) { msm_otg_resume()
601 if (motg->phy_number) msm_otg_resume()
604 msm_hsusb_ldo_set_mode(motg, 1); msm_otg_resume()
605 msm_hsusb_config_vddcx(motg, 1); msm_otg_resume()
641 disable_irq_wake(motg->irq); msm_otg_resume()
645 atomic_set(&motg->in_lpm, 0); msm_otg_resume()
647 if (motg->async_int) { msm_otg_resume()
648 motg->async_int = 0; msm_otg_resume()
650 enable_irq(motg->irq); msm_otg_resume()
659 static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) msm_otg_notify_charger() argument
661 if (motg->cur_power == mA) msm_otg_notify_charger()
665 dev_info(motg->phy.dev, "Avail curr from USB = %u\n", mA); msm_otg_notify_charger()
666 motg->cur_power = mA; msm_otg_notify_charger()
671 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_otg_set_power() local
680 if (motg->chg_type == USB_SDP_CHARGER) msm_otg_set_power()
681 msm_otg_notify_charger(motg, mA); msm_otg_set_power()
688 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_otg_start_host() local
689 struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_start_host()
728 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); msm_otg_set_host() local
735 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) { msm_otg_set_host()
746 schedule_work(&motg->sm_work); msm_otg_set_host()
755 hcd->power_budget = motg->pdata->power_budget; msm_otg_set_host()
764 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { msm_otg_set_host()
766 schedule_work(&motg->sm_work); msm_otg_set_host()
774 struct msm_otg *motg = container_of(phy, struct msm_otg, phy); msm_otg_start_peripheral() local
775 struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_start_peripheral()
802 struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy); msm_otg_set_peripheral() local
808 if (motg->pdata->mode == USB_DR_MODE_HOST) { msm_otg_set_peripheral()
819 schedule_work(&motg->sm_work); msm_otg_set_peripheral()
834 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { msm_otg_set_peripheral()
836 schedule_work(&motg->sm_work); msm_otg_set_peripheral()
842 static bool msm_chg_check_secondary_det(struct msm_otg *motg) msm_chg_check_secondary_det() argument
844 struct usb_phy *phy = &motg->phy; msm_chg_check_secondary_det()
848 switch (motg->pdata->phy_type) { msm_chg_check_secondary_det()
863 static void msm_chg_enable_secondary_det(struct msm_otg *motg) msm_chg_enable_secondary_det() argument
865 struct usb_phy *phy = &motg->phy; msm_chg_enable_secondary_det()
868 switch (motg->pdata->phy_type) { msm_chg_enable_secondary_det()
903 static bool msm_chg_check_primary_det(struct msm_otg *motg) msm_chg_check_primary_det() argument
905 struct usb_phy *phy = &motg->phy; msm_chg_check_primary_det()
909 switch (motg->pdata->phy_type) { msm_chg_check_primary_det()
924 static void msm_chg_enable_primary_det(struct msm_otg *motg) msm_chg_enable_primary_det() argument
926 struct usb_phy *phy = &motg->phy; msm_chg_enable_primary_det()
929 switch (motg->pdata->phy_type) { msm_chg_enable_primary_det()
949 static bool msm_chg_check_dcd(struct msm_otg *motg) msm_chg_check_dcd() argument
951 struct usb_phy *phy = &motg->phy; msm_chg_check_dcd()
955 switch (motg->pdata->phy_type) { msm_chg_check_dcd()
970 static void msm_chg_disable_dcd(struct msm_otg *motg) msm_chg_disable_dcd() argument
972 struct usb_phy *phy = &motg->phy; msm_chg_disable_dcd()
975 switch (motg->pdata->phy_type) { msm_chg_disable_dcd()
989 static void msm_chg_enable_dcd(struct msm_otg *motg) msm_chg_enable_dcd() argument
991 struct usb_phy *phy = &motg->phy; msm_chg_enable_dcd()
994 switch (motg->pdata->phy_type) { msm_chg_enable_dcd()
1010 static void msm_chg_block_on(struct msm_otg *motg) msm_chg_block_on() argument
1012 struct usb_phy *phy = &motg->phy; msm_chg_block_on()
1021 switch (motg->pdata->phy_type) { msm_chg_block_on()
1045 static void msm_chg_block_off(struct msm_otg *motg) msm_chg_block_off() argument
1047 struct usb_phy *phy = &motg->phy; msm_chg_block_off()
1050 switch (motg->pdata->phy_type) { msm_chg_block_off()
1081 struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work); msm_chg_detect_work() local
1082 struct usb_phy *phy = &motg->phy; msm_chg_detect_work()
1087 switch (motg->chg_state) { msm_chg_detect_work()
1090 msm_chg_block_on(motg); msm_chg_detect_work()
1091 msm_chg_enable_dcd(motg); msm_chg_detect_work()
1092 motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD; msm_chg_detect_work()
1093 motg->dcd_retries = 0; msm_chg_detect_work()
1097 is_dcd = msm_chg_check_dcd(motg); msm_chg_detect_work()
1098 tmout = ++motg->dcd_retries == MSM_CHG_DCD_MAX_RETRIES; msm_chg_detect_work()
1100 msm_chg_disable_dcd(motg); msm_chg_detect_work()
1101 msm_chg_enable_primary_det(motg); msm_chg_detect_work()
1103 motg->chg_state = USB_CHG_STATE_DCD_DONE; msm_chg_detect_work()
1109 vout = msm_chg_check_primary_det(motg); msm_chg_detect_work()
1111 msm_chg_enable_secondary_det(motg); msm_chg_detect_work()
1113 motg->chg_state = USB_CHG_STATE_PRIMARY_DONE; msm_chg_detect_work()
1115 motg->chg_type = USB_SDP_CHARGER; msm_chg_detect_work()
1116 motg->chg_state = USB_CHG_STATE_DETECTED; msm_chg_detect_work()
1121 vout = msm_chg_check_secondary_det(motg); msm_chg_detect_work()
1123 motg->chg_type = USB_DCP_CHARGER; msm_chg_detect_work()
1125 motg->chg_type = USB_CDP_CHARGER; msm_chg_detect_work()
1126 motg->chg_state = USB_CHG_STATE_SECONDARY_DONE; msm_chg_detect_work()
1129 motg->chg_state = USB_CHG_STATE_DETECTED; msm_chg_detect_work()
1131 msm_chg_block_off(motg); msm_chg_detect_work()
1132 dev_dbg(phy->dev, "charger = %d\n", motg->chg_type); msm_chg_detect_work()
1133 schedule_work(&motg->sm_work); msm_chg_detect_work()
1139 schedule_delayed_work(&motg->chg_work, delay); msm_chg_detect_work()
1149 static void msm_otg_init_sm(struct msm_otg *motg) msm_otg_init_sm() argument
1151 struct msm_otg_platform_data *pdata = motg->pdata; msm_otg_init_sm()
1158 set_bit(ID, &motg->inputs); msm_otg_init_sm()
1160 clear_bit(ID, &motg->inputs); msm_otg_init_sm()
1163 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_init_sm()
1165 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_init_sm()
1167 set_bit(ID, &motg->inputs); msm_otg_init_sm()
1168 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_init_sm()
1172 clear_bit(ID, &motg->inputs); msm_otg_init_sm()
1175 set_bit(ID, &motg->inputs); msm_otg_init_sm()
1177 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_init_sm()
1179 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_init_sm()
1188 struct msm_otg *motg = container_of(w, struct msm_otg, sm_work); msm_otg_sm_work() local
1189 struct usb_otg *otg = motg->phy.otg; msm_otg_sm_work()
1195 msm_otg_init_sm(motg); msm_otg_sm_work()
1200 if (!test_bit(ID, &motg->inputs) && otg->host) { msm_otg_sm_work()
1205 } else if (test_bit(B_SESS_VLD, &motg->inputs)) { msm_otg_sm_work()
1206 switch (motg->chg_state) { msm_otg_sm_work()
1208 msm_chg_detect_work(&motg->chg_work.work); msm_otg_sm_work()
1211 switch (motg->chg_type) { msm_otg_sm_work()
1213 msm_otg_notify_charger(motg, msm_otg_sm_work()
1217 msm_otg_notify_charger(motg, msm_otg_sm_work()
1225 msm_otg_notify_charger(motg, IUNIT); msm_otg_sm_work()
1244 if (cancel_delayed_work_sync(&motg->chg_work)) { msm_otg_sm_work()
1248 msm_otg_notify_charger(motg, 0); msm_otg_sm_work()
1249 motg->chg_state = USB_CHG_STATE_UNDEFINED; msm_otg_sm_work()
1250 motg->chg_type = USB_INVALID_CHARGER; msm_otg_sm_work()
1258 if (!test_bit(B_SESS_VLD, &motg->inputs) || msm_otg_sm_work()
1259 !test_bit(ID, &motg->inputs)) { msm_otg_sm_work()
1260 msm_otg_notify_charger(motg, 0); msm_otg_sm_work()
1262 motg->chg_state = USB_CHG_STATE_UNDEFINED; msm_otg_sm_work()
1263 motg->chg_type = USB_INVALID_CHARGER; msm_otg_sm_work()
1271 if (test_bit(ID, &motg->inputs)) { msm_otg_sm_work()
1285 struct msm_otg *motg = data; msm_otg_irq() local
1286 struct usb_phy *phy = &motg->phy; msm_otg_irq()
1289 if (atomic_read(&motg->in_lpm)) { msm_otg_irq()
1291 motg->async_int = 1; msm_otg_irq()
1302 set_bit(ID, &motg->inputs); msm_otg_irq()
1304 clear_bit(ID, &motg->inputs); msm_otg_irq()
1309 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_irq()
1311 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_irq()
1317 schedule_work(&motg->sm_work); msm_otg_irq()
1323 struct msm_otg *motg = s->private; msm_otg_mode_show() local
1324 struct usb_otg *otg = motg->phy.otg; msm_otg_mode_show()
1350 struct msm_otg *motg = s->private; msm_otg_mode_write() local
1352 struct usb_otg *otg = motg->phy.otg; msm_otg_mode_write()
1379 set_bit(ID, &motg->inputs); msm_otg_mode_write()
1380 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_mode_write()
1390 set_bit(ID, &motg->inputs); msm_otg_mode_write()
1391 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_mode_write()
1401 clear_bit(ID, &motg->inputs); msm_otg_mode_write()
1412 schedule_work(&motg->sm_work); msm_otg_mode_write()
1428 static int msm_otg_debugfs_init(struct msm_otg *motg) msm_otg_debugfs_init() argument
1436 msm_otg_dbg_root, motg, &msm_otg_mode_fops); msm_otg_debugfs_init()
1469 struct msm_otg *motg = container_of(vbus, struct msm_otg, vbus); msm_otg_vbus_notifier() local
1472 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_vbus_notifier()
1474 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_vbus_notifier()
1476 if (test_bit(B_SESS_VLD, &motg->inputs)) { msm_otg_vbus_notifier()
1478 gpiod_set_value_cansleep(motg->switch_gpio, 0); msm_otg_vbus_notifier()
1481 gpiod_set_value_cansleep(motg->switch_gpio, 1); msm_otg_vbus_notifier()
1484 schedule_work(&motg->sm_work); msm_otg_vbus_notifier()
1493 struct msm_otg *motg = container_of(id, struct msm_otg, id); msm_otg_id_notifier() local
1496 clear_bit(ID, &motg->inputs); msm_otg_id_notifier()
1498 set_bit(ID, &motg->inputs); msm_otg_id_notifier()
1500 schedule_work(&motg->sm_work); msm_otg_id_notifier()
1505 static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) msm_otg_read_dt() argument
1518 motg->pdata = pdata; msm_otg_read_dt()
1524 motg->link_rst = devm_reset_control_get(&pdev->dev, "link"); msm_otg_read_dt()
1525 if (IS_ERR(motg->link_rst)) msm_otg_read_dt()
1526 return PTR_ERR(motg->link_rst); msm_otg_read_dt()
1528 motg->phy_rst = devm_reset_control_get(&pdev->dev, "phy"); msm_otg_read_dt()
1529 if (IS_ERR(motg->phy_rst)) msm_otg_read_dt()
1530 motg->phy_rst = NULL; msm_otg_read_dt()
1542 motg->phy_number = val; msm_otg_read_dt()
1544 motg->vdd_levels[VDD_LEVEL_NONE] = USB_PHY_SUSP_DIG_VOL; msm_otg_read_dt()
1545 motg->vdd_levels[VDD_LEVEL_MIN] = USB_PHY_VDD_DIG_VOL_MIN; msm_otg_read_dt()
1546 motg->vdd_levels[VDD_LEVEL_MAX] = USB_PHY_VDD_DIG_VOL_MAX; msm_otg_read_dt()
1552 motg->vdd_levels[VDD_LEVEL_NONE] = tmp[VDD_LEVEL_NONE]; msm_otg_read_dt()
1553 motg->vdd_levels[VDD_LEVEL_MIN] = tmp[VDD_LEVEL_MIN]; msm_otg_read_dt()
1554 motg->vdd_levels[VDD_LEVEL_MAX] = tmp[VDD_LEVEL_MAX]; msm_otg_read_dt()
1557 motg->manual_pullup = of_property_read_bool(node, "qcom,manual-pullup"); msm_otg_read_dt()
1559 motg->switch_gpio = devm_gpiod_get_optional(&pdev->dev, "switch", msm_otg_read_dt()
1561 if (IS_ERR(motg->switch_gpio)) msm_otg_read_dt()
1562 return PTR_ERR(motg->switch_gpio); msm_otg_read_dt()
1579 motg->vbus.extcon = ext_vbus; msm_otg_read_dt()
1580 motg->vbus.nb.notifier_call = msm_otg_vbus_notifier; msm_otg_read_dt()
1582 &motg->vbus.nb); msm_otg_read_dt()
1590 set_bit(B_SESS_VLD, &motg->inputs); msm_otg_read_dt()
1592 clear_bit(B_SESS_VLD, &motg->inputs); msm_otg_read_dt()
1596 motg->id.extcon = ext_id; msm_otg_read_dt()
1597 motg->id.nb.notifier_call = msm_otg_id_notifier; msm_otg_read_dt()
1599 &motg->id.nb); msm_otg_read_dt()
1602 extcon_unregister_notifier(motg->vbus.extcon, msm_otg_read_dt()
1603 EXTCON_USB, &motg->vbus.nb); msm_otg_read_dt()
1609 clear_bit(ID, &motg->inputs); msm_otg_read_dt()
1611 set_bit(ID, &motg->inputs); msm_otg_read_dt()
1640 struct msm_otg *motg = container_of(this, struct msm_otg, reboot); msm_otg_reboot_notify() local
1646 gpiod_set_value_cansleep(motg->switch_gpio, 0); msm_otg_reboot_notify()
1657 struct msm_otg *motg; msm_otg_probe() local
1661 motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL); msm_otg_probe()
1662 if (!motg) msm_otg_probe()
1665 motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), msm_otg_probe()
1667 if (!motg->phy.otg) msm_otg_probe()
1670 phy = &motg->phy; msm_otg_probe()
1673 motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk"); msm_otg_probe()
1674 if (IS_ERR(motg->clk)) { msm_otg_probe()
1676 return PTR_ERR(motg->clk); msm_otg_probe()
1685 motg->pclk = devm_clk_get(&pdev->dev, np ? "iface" : "usb_hs_pclk"); msm_otg_probe()
1686 if (IS_ERR(motg->pclk)) { msm_otg_probe()
1688 return PTR_ERR(motg->pclk); msm_otg_probe()
1696 motg->core_clk = devm_clk_get(&pdev->dev, msm_otg_probe()
1702 motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); msm_otg_probe()
1703 if (!motg->regs) msm_otg_probe()
1710 ret = msm_otg_read_dt(pdev, motg); msm_otg_probe()
1720 if (motg->phy_number) { msm_otg_probe()
1730 dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs); msm_otg_probe()
1732 motg->irq = platform_get_irq(pdev, 0); msm_otg_probe()
1733 if (motg->irq < 0) { msm_otg_probe()
1735 ret = motg->irq; msm_otg_probe()
1743 ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs); msm_otg_probe()
1747 motg->vddcx = regs[0].consumer; msm_otg_probe()
1748 motg->v3p3 = regs[1].consumer; msm_otg_probe()
1749 motg->v1p8 = regs[2].consumer; msm_otg_probe()
1751 clk_set_rate(motg->clk, 60000000); msm_otg_probe()
1753 clk_prepare_enable(motg->clk); msm_otg_probe()
1754 clk_prepare_enable(motg->pclk); msm_otg_probe()
1756 if (!IS_ERR(motg->core_clk)) msm_otg_probe()
1757 clk_prepare_enable(motg->core_clk); msm_otg_probe()
1759 ret = msm_hsusb_init_vddcx(motg, 1); msm_otg_probe()
1765 ret = msm_hsusb_ldo_init(motg, 1); msm_otg_probe()
1770 ret = msm_hsusb_ldo_set_mode(motg, 1); msm_otg_probe()
1779 INIT_WORK(&motg->sm_work, msm_otg_sm_work); msm_otg_probe()
1780 INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work); msm_otg_probe()
1781 ret = devm_request_irq(&pdev->dev, motg->irq, msm_otg_irq, IRQF_SHARED, msm_otg_probe()
1782 "msm_otg", motg); msm_otg_probe()
1795 phy->otg->usb_phy = &motg->phy; msm_otg_probe()
1801 ret = usb_add_phy_dev(&motg->phy); msm_otg_probe()
1807 platform_set_drvdata(pdev, motg); msm_otg_probe()
1810 if (motg->pdata->mode == USB_DR_MODE_OTG && msm_otg_probe()
1811 motg->pdata->otg_control == OTG_USER_CONTROL) { msm_otg_probe()
1812 ret = msm_otg_debugfs_init(motg); msm_otg_probe()
1817 if (test_bit(B_SESS_VLD, &motg->inputs)) { msm_otg_probe()
1819 gpiod_set_value_cansleep(motg->switch_gpio, 0); msm_otg_probe()
1822 gpiod_set_value_cansleep(motg->switch_gpio, 1); msm_otg_probe()
1825 motg->reboot.notifier_call = msm_otg_reboot_notify; msm_otg_probe()
1826 register_reboot_notifier(&motg->reboot); msm_otg_probe()
1834 msm_hsusb_ldo_init(motg, 0); msm_otg_probe()
1836 msm_hsusb_init_vddcx(motg, 0); msm_otg_probe()
1838 clk_disable_unprepare(motg->pclk); msm_otg_probe()
1839 clk_disable_unprepare(motg->clk); msm_otg_probe()
1840 if (!IS_ERR(motg->core_clk)) msm_otg_probe()
1841 clk_disable_unprepare(motg->core_clk); msm_otg_probe()
1843 extcon_unregister_notifier(motg->id.extcon, msm_otg_probe()
1844 EXTCON_USB_HOST, &motg->id.nb); msm_otg_probe()
1845 extcon_unregister_notifier(motg->vbus.extcon, msm_otg_probe()
1846 EXTCON_USB, &motg->vbus.nb); msm_otg_probe()
1853 struct msm_otg *motg = platform_get_drvdata(pdev); msm_otg_remove() local
1854 struct usb_phy *phy = &motg->phy; msm_otg_remove()
1860 unregister_reboot_notifier(&motg->reboot); msm_otg_remove()
1866 gpiod_set_value_cansleep(motg->switch_gpio, 0); msm_otg_remove()
1868 extcon_unregister_notifier(motg->id.extcon, EXTCON_USB_HOST, &motg->id.nb); msm_otg_remove()
1869 extcon_unregister_notifier(motg->vbus.extcon, EXTCON_USB, &motg->vbus.nb); msm_otg_remove()
1872 cancel_delayed_work_sync(&motg->chg_work); msm_otg_remove()
1873 cancel_work_sync(&motg->sm_work); msm_otg_remove()
1881 disable_irq(motg->irq); msm_otg_remove()
1899 clk_disable_unprepare(motg->pclk); msm_otg_remove()
1900 clk_disable_unprepare(motg->clk); msm_otg_remove()
1901 if (!IS_ERR(motg->core_clk)) msm_otg_remove()
1902 clk_disable_unprepare(motg->core_clk); msm_otg_remove()
1903 msm_hsusb_ldo_init(motg, 0); msm_otg_remove()
1913 struct msm_otg *motg = dev_get_drvdata(dev); msm_otg_runtime_idle() local
1914 struct usb_otg *otg = motg->phy.otg; msm_otg_runtime_idle()
1932 struct msm_otg *motg = dev_get_drvdata(dev); msm_otg_runtime_suspend() local
1935 return msm_otg_suspend(motg); msm_otg_runtime_suspend()
1940 struct msm_otg *motg = dev_get_drvdata(dev); msm_otg_runtime_resume() local
1943 return msm_otg_resume(motg); msm_otg_runtime_resume()
1950 struct msm_otg *motg = dev_get_drvdata(dev); msm_otg_pm_suspend() local
1953 return msm_otg_suspend(motg); msm_otg_pm_suspend()
1958 struct msm_otg *motg = dev_get_drvdata(dev); msm_otg_pm_resume() local
1963 ret = msm_otg_resume(motg); msm_otg_pm_resume()

Completed in 143 milliseconds