Lines Matching +full:usb +full:- +full:sdp
1 // SPDX-License-Identifier: GPL-2.0+
11 #include <linux/usb/otg.h>
86 /* For imx6dql, it is host-only controller, for later imx6, it is otg's */
104 /* The default DM/DP value is pull-down */
141 /* It's called once when probe a usb device */
143 /* It's called once after adding a usb device */
145 /* It's called when we need to enable/disable usb wakeup */
151 /* usb charger detection */
165 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx25_init()
169 if (data->index > 1) in usbmisc_imx25_init()
170 return -EINVAL; in usbmisc_imx25_init()
172 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx25_init()
173 switch (data->index) { in usbmisc_imx25_init()
175 val = readl(usbmisc->base); in usbmisc_imx25_init()
184 if (data->oc_pol_configured && data->oc_pol_active_low) in usbmisc_imx25_init()
187 writel(val, usbmisc->base); in usbmisc_imx25_init()
190 val = readl(usbmisc->base); in usbmisc_imx25_init()
200 if (data->oc_pol_configured && data->oc_pol_active_low) in usbmisc_imx25_init()
203 writel(val, usbmisc->base); in usbmisc_imx25_init()
207 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx25_init()
214 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx25_post()
219 if (data->index > 2) in usbmisc_imx25_post()
220 return -EINVAL; in usbmisc_imx25_post()
222 if (data->index) in usbmisc_imx25_post()
225 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx25_post()
226 reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET; in usbmisc_imx25_post()
229 if (data->evdo) in usbmisc_imx25_post()
235 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx25_post()
243 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx27_init()
247 switch (data->index) { in usbmisc_imx27_init()
258 return -EINVAL; in usbmisc_imx27_init()
261 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx27_init()
262 if (data->disable_oc) in usbmisc_imx27_init()
263 val = readl(usbmisc->base) | val; in usbmisc_imx27_init()
265 val = readl(usbmisc->base) & ~val; in usbmisc_imx27_init()
266 writel(val, usbmisc->base); in usbmisc_imx27_init()
267 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx27_init()
274 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx53_init()
279 if (data->index > 3) in usbmisc_imx53_init()
280 return -EINVAL; in usbmisc_imx53_init()
283 val = readl(usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET); in usbmisc_imx53_init()
286 writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET); in usbmisc_imx53_init()
288 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx53_init()
290 switch (data->index) { in usbmisc_imx53_init()
292 if (data->disable_oc) { in usbmisc_imx53_init()
293 reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET; in usbmisc_imx53_init()
299 if (data->disable_oc) { in usbmisc_imx53_init()
300 reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET; in usbmisc_imx53_init()
306 if (data->ulpi) { in usbmisc_imx53_init()
307 /* set USBH2 into ULPI-mode. */ in usbmisc_imx53_init()
308 reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET; in usbmisc_imx53_init()
315 reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET; in usbmisc_imx53_init()
321 reg = usbmisc->base + in usbmisc_imx53_init()
329 if (data->disable_oc) { in usbmisc_imx53_init()
330 reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET; in usbmisc_imx53_init()
336 if (data->ulpi) { in usbmisc_imx53_init()
337 /* set USBH3 into ULPI-mode. */ in usbmisc_imx53_init()
338 reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET; in usbmisc_imx53_init()
345 reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET; in usbmisc_imx53_init()
352 reg = usbmisc->base + in usbmisc_imx53_init()
359 if (data->disable_oc) { in usbmisc_imx53_init()
360 reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET; in usbmisc_imx53_init()
367 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx53_init()
376 if (data->ext_id || data->available_role != USB_DR_MODE_OTG) in usbmisc_wakeup_setting()
379 if (data->ext_vbus || data->available_role == USB_DR_MODE_HOST) in usbmisc_wakeup_setting()
388 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx6q_set_wakeup()
393 if (data->index > 3) in usbmisc_imx6q_set_wakeup()
394 return -EINVAL; in usbmisc_imx6q_set_wakeup()
396 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx6q_set_wakeup()
397 val = readl(usbmisc->base + data->index * 4); in usbmisc_imx6q_set_wakeup()
403 pr_debug("wakeup int at ci_hdrc.%d\n", data->index); in usbmisc_imx6q_set_wakeup()
406 writel(val, usbmisc->base + data->index * 4); in usbmisc_imx6q_set_wakeup()
407 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6q_set_wakeup()
414 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx6q_init()
418 if (data->index > 3) in usbmisc_imx6q_init()
419 return -EINVAL; in usbmisc_imx6q_init()
421 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx6q_init()
423 reg = readl(usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
424 if (data->disable_oc) { in usbmisc_imx6q_init()
433 if (data->oc_pol_configured && data->oc_pol_active_low) in usbmisc_imx6q_init()
435 else if (data->oc_pol_configured) in usbmisc_imx6q_init()
439 if (data->pwr_pol == 1) in usbmisc_imx6q_init()
441 writel(reg, usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
443 /* SoC non-burst setting */ in usbmisc_imx6q_init()
444 reg = readl(usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
446 usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
449 if (data->hsic) { in usbmisc_imx6q_init()
450 reg = readl(usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
452 usbmisc->base + data->index * 4); in usbmisc_imx6q_init()
453 reg = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET in usbmisc_imx6q_init()
454 + (data->index - 2) * 4); in usbmisc_imx6q_init()
456 writel(reg, usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET in usbmisc_imx6q_init()
457 + (data->index - 2) * 4); in usbmisc_imx6q_init()
460 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6q_init()
471 if (data->index == 2 || data->index == 3) { in usbmisc_imx6_hsic_get_reg_offset()
472 offset = (data->index - 2) * 4; in usbmisc_imx6_hsic_get_reg_offset()
473 } else if (data->index == 0) { in usbmisc_imx6_hsic_get_reg_offset()
475 * For SoCs like i.MX7D and later, each USB controller has in usbmisc_imx6_hsic_get_reg_offset()
476 * its own non-core register region. For SoCs before i.MX7D, in usbmisc_imx6_hsic_get_reg_offset()
477 * the first two USB controllers are non-HSIC controllers. in usbmisc_imx6_hsic_get_reg_offset()
481 dev_err(data->dev, "index is error for usbmisc\n"); in usbmisc_imx6_hsic_get_reg_offset()
482 ret = -EINVAL; in usbmisc_imx6_hsic_get_reg_offset()
492 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx6_hsic_set_connect()
495 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_connect()
498 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_connect()
502 val = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET + offset); in usbmisc_imx6_hsic_set_connect()
505 usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET + offset); in usbmisc_imx6_hsic_set_connect()
507 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_connect()
516 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx6_hsic_set_clk()
519 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_clk()
522 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_clk()
526 val = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET + offset); in usbmisc_imx6_hsic_set_clk()
533 writel(val, usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET + offset); in usbmisc_imx6_hsic_set_clk()
534 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6_hsic_set_clk()
544 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx6sx_init()
549 if (data->index == 0 || data->index == 1) { in usbmisc_imx6sx_init()
550 reg = usbmisc->base + MX6_USB_OTG1_PHY_CTRL + data->index * 4; in usbmisc_imx6sx_init()
551 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx6sx_init()
559 val = readl(usbmisc->base + data->index * 4); in usbmisc_imx6sx_init()
561 usbmisc->base + data->index * 4); in usbmisc_imx6sx_init()
562 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx6sx_init()
566 if (data->hsic) { in usbmisc_imx6sx_init()
567 val = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET); in usbmisc_imx6sx_init()
569 writel(val, usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET); in usbmisc_imx6sx_init()
577 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_vf610_init()
584 if (data->index >= 1) in usbmisc_vf610_init()
585 return -EINVAL; in usbmisc_vf610_init()
587 if (data->disable_oc) { in usbmisc_vf610_init()
588 reg = readl(usbmisc->base); in usbmisc_vf610_init()
589 writel(reg | VF610_OVER_CUR_DIS, usbmisc->base); in usbmisc_vf610_init()
598 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx7d_set_wakeup()
602 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx7d_set_wakeup()
603 val = readl(usbmisc->base); in usbmisc_imx7d_set_wakeup()
607 writel(val, usbmisc->base); in usbmisc_imx7d_set_wakeup()
610 dev_dbg(data->dev, "wakeup int\n"); in usbmisc_imx7d_set_wakeup()
611 writel(val & ~MX6_USB_OTG_WAKEUP_BITS, usbmisc->base); in usbmisc_imx7d_set_wakeup()
613 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx7d_set_wakeup()
620 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx7d_init()
624 if (data->index >= 1) in usbmisc_imx7d_init()
625 return -EINVAL; in usbmisc_imx7d_init()
627 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx7d_init()
628 reg = readl(usbmisc->base); in usbmisc_imx7d_init()
629 if (data->disable_oc) { in usbmisc_imx7d_init()
638 if (data->oc_pol_configured && data->oc_pol_active_low) in usbmisc_imx7d_init()
640 else if (data->oc_pol_configured) in usbmisc_imx7d_init()
644 if (data->pwr_pol == 1) in usbmisc_imx7d_init()
646 writel(reg, usbmisc->base); in usbmisc_imx7d_init()
648 /* SoC non-burst setting */ in usbmisc_imx7d_init()
649 reg = readl(usbmisc->base); in usbmisc_imx7d_init()
650 writel(reg | MX6_BM_NON_BURST_SETTING, usbmisc->base); in usbmisc_imx7d_init()
652 if (!data->hsic) { in usbmisc_imx7d_init()
653 reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7d_init()
657 usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7d_init()
659 reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1); in usbmisc_imx7d_init()
660 if (data->emp_curr_control && data->emp_curr_control <= in usbmisc_imx7d_init()
663 reg |= (data->emp_curr_control << TXPREEMPAMPTUNE0_BIT); in usbmisc_imx7d_init()
666 if (data->dc_vol_level_adjust && data->dc_vol_level_adjust <= in usbmisc_imx7d_init()
669 reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT); in usbmisc_imx7d_init()
672 writel(reg, usbmisc->base + MX7D_USB_OTG_PHY_CFG1); in usbmisc_imx7d_init()
675 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx7d_init()
684 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in imx7d_charger_secondary_detection()
685 struct usb_phy *usb_phy = data->usb_phy; in imx7d_charger_secondary_detection()
689 /* VDM_SRC is connected to D- and IDP_SINK is connected to D+ */ in imx7d_charger_secondary_detection()
690 spin_lock_irqsave(&usbmisc->lock, flags); in imx7d_charger_secondary_detection()
691 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_secondary_detection()
695 usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_secondary_detection()
696 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7d_charger_secondary_detection()
705 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS); in imx7d_charger_secondary_detection()
707 dev_dbg(data->dev, "It is a dedicate charging port\n"); in imx7d_charger_secondary_detection()
708 usb_phy->chg_type = DCP_TYPE; in imx7d_charger_secondary_detection()
710 dev_dbg(data->dev, "It is a charging downstream port\n"); in imx7d_charger_secondary_detection()
711 usb_phy->chg_type = CDP_TYPE; in imx7d_charger_secondary_detection()
719 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in imx7_disable_charger_detector()
723 spin_lock_irqsave(&usbmisc->lock, flags); in imx7_disable_charger_detector()
724 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7_disable_charger_detector()
729 writel(val, usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7_disable_charger_detector()
732 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7_disable_charger_detector()
734 writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7_disable_charger_detector()
736 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7_disable_charger_detector()
738 usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7_disable_charger_detector()
739 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7_disable_charger_detector()
744 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in imx7d_charger_data_contact_detect()
749 /* Enable Data Contact Detect (DCD) per the USB BC 1.2 */ in imx7d_charger_data_contact_detect()
750 spin_lock_irqsave(&usbmisc->lock, flags); in imx7d_charger_data_contact_detect()
751 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_data_contact_detect()
753 usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_data_contact_detect()
754 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7d_charger_data_contact_detect()
757 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS); in imx7d_charger_data_contact_detect()
770 spin_lock_irqsave(&usbmisc->lock, flags); in imx7d_charger_data_contact_detect()
771 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_data_contact_detect()
773 usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_data_contact_detect()
774 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7d_charger_data_contact_detect()
777 dev_err(data->dev, in imx7d_charger_data_contact_detect()
779 return -ENXIO; in imx7d_charger_data_contact_detect()
787 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in imx7d_charger_primary_detection()
788 struct usb_phy *usb_phy = data->usb_phy; in imx7d_charger_primary_detection()
792 /* VDP_SRC is connected to D+ and IDM_SINK is connected to D- */ in imx7d_charger_primary_detection()
793 spin_lock_irqsave(&usbmisc->lock, flags); in imx7d_charger_primary_detection()
794 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_primary_detection()
798 usbmisc->base + MX7D_USB_OTG_PHY_CFG2); in imx7d_charger_primary_detection()
799 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7d_charger_primary_detection()
803 /* Check if D- is less than VDAT_REF to determine an SDP per BC 1.2 */ in imx7d_charger_primary_detection()
804 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS); in imx7d_charger_primary_detection()
806 dev_dbg(data->dev, "It is a standard downstream port\n"); in imx7d_charger_primary_detection()
807 usb_phy->chg_type = SDP_TYPE; in imx7d_charger_primary_detection()
815 * 1. OPMODE override to be non-driving
823 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in imx7d_charger_detection()
824 struct usb_phy *usb_phy = data->usb_phy; in imx7d_charger_detection()
830 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS); in imx7d_charger_detection()
832 dev_err(data->dev, "vbus is error\n"); in imx7d_charger_detection()
833 return -EINVAL; in imx7d_charger_detection()
837 * Keep OPMODE to be non-driving mode during the whole in imx7d_charger_detection()
840 spin_lock_irqsave(&usbmisc->lock, flags); in imx7d_charger_detection()
841 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7d_charger_detection()
844 writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7d_charger_detection()
846 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7d_charger_detection()
848 usbmisc->base + MX7D_USBNC_USB_CTRL2); in imx7d_charger_detection()
849 spin_unlock_irqrestore(&usbmisc->lock, flags); in imx7d_charger_detection()
856 if (!ret && usb_phy->chg_type != SDP_TYPE) in imx7d_charger_detection()
866 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in usbmisc_imx7ulp_init()
870 if (data->index >= 1) in usbmisc_imx7ulp_init()
871 return -EINVAL; in usbmisc_imx7ulp_init()
873 spin_lock_irqsave(&usbmisc->lock, flags); in usbmisc_imx7ulp_init()
874 reg = readl(usbmisc->base); in usbmisc_imx7ulp_init()
875 if (data->disable_oc) { in usbmisc_imx7ulp_init()
884 if (data->oc_pol_configured && data->oc_pol_active_low) in usbmisc_imx7ulp_init()
886 else if (data->oc_pol_configured) in usbmisc_imx7ulp_init()
890 if (data->pwr_pol == 1) in usbmisc_imx7ulp_init()
893 writel(reg, usbmisc->base); in usbmisc_imx7ulp_init()
895 /* SoC non-burst setting */ in usbmisc_imx7ulp_init()
896 reg = readl(usbmisc->base); in usbmisc_imx7ulp_init()
897 writel(reg | MX6_BM_NON_BURST_SETTING, usbmisc->base); in usbmisc_imx7ulp_init()
899 if (data->hsic) { in usbmisc_imx7ulp_init()
900 reg = readl(usbmisc->base); in usbmisc_imx7ulp_init()
901 writel(reg | MX6_BM_UTMI_ON_CLOCK, usbmisc->base); in usbmisc_imx7ulp_init()
903 reg = readl(usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET); in usbmisc_imx7ulp_init()
905 writel(reg, usbmisc->base + MX6_USB_HSIC_CTRL_OFFSET); in usbmisc_imx7ulp_init()
908 * For non-HSIC controller, the autoresume is enabled in usbmisc_imx7ulp_init()
911 reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7ulp_init()
913 usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7ulp_init()
915 reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7ulp_init()
918 usbmisc->base + MX7D_USBNC_USB_CTRL2); in usbmisc_imx7ulp_init()
921 spin_unlock_irqrestore(&usbmisc->lock, flags); in usbmisc_imx7ulp_init()
978 struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); in is_imx53_usbmisc()
980 return usbmisc->ops == &imx53_usbmisc_ops; in is_imx53_usbmisc()
990 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_init()
991 if (!usbmisc->ops->init) in imx_usbmisc_init()
993 return usbmisc->ops->init(data); in imx_usbmisc_init()
1004 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_init_post()
1005 if (!usbmisc->ops->post) in imx_usbmisc_init_post()
1007 return usbmisc->ops->post(data); in imx_usbmisc_init_post()
1018 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_set_wakeup()
1019 if (!usbmisc->ops->set_wakeup) in imx_usbmisc_set_wakeup()
1021 return usbmisc->ops->set_wakeup(data, enabled); in imx_usbmisc_set_wakeup()
1032 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_hsic_set_connect()
1033 if (!usbmisc->ops->hsic_set_connect || !data->hsic) in imx_usbmisc_hsic_set_connect()
1035 return usbmisc->ops->hsic_set_connect(data); in imx_usbmisc_hsic_set_connect()
1046 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_hsic_set_clk()
1047 if (!usbmisc->ops->hsic_set_clk || !data->hsic) in imx_usbmisc_hsic_set_clk()
1049 return usbmisc->ops->hsic_set_clk(data, on); in imx_usbmisc_hsic_set_clk()
1060 return -EINVAL; in imx_usbmisc_charger_detection()
1062 usbmisc = dev_get_drvdata(data->dev); in imx_usbmisc_charger_detection()
1063 usb_phy = data->usb_phy; in imx_usbmisc_charger_detection()
1064 if (!usbmisc->ops->charger_detection) in imx_usbmisc_charger_detection()
1065 return -ENOTSUPP; in imx_usbmisc_charger_detection()
1068 ret = usbmisc->ops->charger_detection(data); in imx_usbmisc_charger_detection()
1070 dev_err(data->dev, in imx_usbmisc_charger_detection()
1073 usb_phy->chg_state = USB_CHARGER_ABSENT; in imx_usbmisc_charger_detection()
1075 usb_phy->chg_state = USB_CHARGER_PRESENT; in imx_usbmisc_charger_detection()
1078 usb_phy->chg_state = USB_CHARGER_ABSENT; in imx_usbmisc_charger_detection()
1079 usb_phy->chg_type = UNKNOWN_TYPE; in imx_usbmisc_charger_detection()
1087 .compatible = "fsl,imx25-usbmisc",
1091 .compatible = "fsl,imx35-usbmisc",
1095 .compatible = "fsl,imx27-usbmisc",
1099 .compatible = "fsl,imx51-usbmisc",
1103 .compatible = "fsl,imx53-usbmisc",
1107 .compatible = "fsl,imx6q-usbmisc",
1111 .compatible = "fsl,vf610-usbmisc",
1115 .compatible = "fsl,imx6sx-usbmisc",
1119 .compatible = "fsl,imx6ul-usbmisc",
1123 .compatible = "fsl,imx7d-usbmisc",
1127 .compatible = "fsl,imx7ulp-usbmisc",
1139 of_id = of_match_device(usbmisc_imx_dt_ids, &pdev->dev); in usbmisc_imx_probe()
1141 return -ENODEV; in usbmisc_imx_probe()
1143 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); in usbmisc_imx_probe()
1145 return -ENOMEM; in usbmisc_imx_probe()
1147 spin_lock_init(&data->lock); in usbmisc_imx_probe()
1149 data->base = devm_platform_ioremap_resource(pdev, 0); in usbmisc_imx_probe()
1150 if (IS_ERR(data->base)) in usbmisc_imx_probe()
1151 return PTR_ERR(data->base); in usbmisc_imx_probe()
1153 data->ops = (const struct usbmisc_ops *)of_id->data; in usbmisc_imx_probe()
1175 MODULE_ALIAS("platform:usbmisc-imx");
1177 MODULE_DESCRIPTION("driver for imx usb non-core registers");