Lines Matching +full:hs +full:- +full:usb +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0
4 * Inspired by dwc3-of-simple.c
20 #include <linux/usb/of.h>
23 #include <linux/usb/hcd.h>
24 #include <linux/usb.h>
27 /* USB QSCRATCH Hardware registers */
122 if (enable) { in dwc3_qcom_vbus_override_enable()
123 dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_SS_PHY_CTRL, in dwc3_qcom_vbus_override_enable()
125 dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_HS_PHY_CTRL, in dwc3_qcom_vbus_override_enable()
128 dwc3_qcom_clrbits(qcom->qscratch_base, QSCRATCH_SS_PHY_CTRL, in dwc3_qcom_vbus_override_enable()
130 dwc3_qcom_clrbits(qcom->qscratch_base, QSCRATCH_HS_PHY_CTRL, in dwc3_qcom_vbus_override_enable()
142 qcom->mode = event ? USB_DR_MODE_PERIPHERAL : USB_DR_MODE_HOST; in dwc3_qcom_vbus_notifier()
154 qcom->mode = event ? USB_DR_MODE_HOST : USB_DR_MODE_PERIPHERAL; in dwc3_qcom_host_notifier()
161 struct device *dev = qcom->dev; in dwc3_qcom_register_extcon()
165 if (!of_property_read_bool(dev->of_node, "extcon")) in dwc3_qcom_register_extcon()
168 qcom->edev = extcon_get_edev_by_phandle(dev, 0); in dwc3_qcom_register_extcon()
169 if (IS_ERR(qcom->edev)) in dwc3_qcom_register_extcon()
170 return PTR_ERR(qcom->edev); in dwc3_qcom_register_extcon()
172 qcom->vbus_nb.notifier_call = dwc3_qcom_vbus_notifier; in dwc3_qcom_register_extcon()
174 qcom->host_edev = extcon_get_edev_by_phandle(dev, 1); in dwc3_qcom_register_extcon()
175 if (IS_ERR(qcom->host_edev)) in dwc3_qcom_register_extcon()
176 qcom->host_edev = NULL; in dwc3_qcom_register_extcon()
178 ret = devm_extcon_register_notifier(dev, qcom->edev, EXTCON_USB, in dwc3_qcom_register_extcon()
179 &qcom->vbus_nb); in dwc3_qcom_register_extcon()
180 if (ret < 0) { in dwc3_qcom_register_extcon()
185 if (qcom->host_edev) in dwc3_qcom_register_extcon()
186 host_edev = qcom->host_edev; in dwc3_qcom_register_extcon()
188 host_edev = qcom->edev; in dwc3_qcom_register_extcon()
190 qcom->host_nb.notifier_call = dwc3_qcom_host_notifier; in dwc3_qcom_register_extcon()
192 &qcom->host_nb); in dwc3_qcom_register_extcon()
193 if (ret < 0) { in dwc3_qcom_register_extcon()
199 if (extcon_get_state(qcom->edev, EXTCON_USB) || in dwc3_qcom_register_extcon()
201 dwc3_qcom_vbus_notifier(&qcom->vbus_nb, true, qcom->edev); in dwc3_qcom_register_extcon()
203 dwc3_qcom_vbus_notifier(&qcom->vbus_nb, false, qcom->edev); in dwc3_qcom_register_extcon()
212 ret = icc_enable(qcom->icc_path_ddr); in dwc3_qcom_interconnect_enable()
213 if (ret) in dwc3_qcom_interconnect_enable()
216 ret = icc_enable(qcom->icc_path_apps); in dwc3_qcom_interconnect_enable()
217 if (ret) in dwc3_qcom_interconnect_enable()
218 icc_disable(qcom->icc_path_ddr); in dwc3_qcom_interconnect_enable()
227 ret = icc_disable(qcom->icc_path_ddr); in dwc3_qcom_interconnect_disable()
228 if (ret) in dwc3_qcom_interconnect_disable()
231 ret = icc_disable(qcom->icc_path_apps); in dwc3_qcom_interconnect_disable()
232 if (ret) in dwc3_qcom_interconnect_disable()
233 icc_enable(qcom->icc_path_ddr); in dwc3_qcom_interconnect_disable()
239 * dwc3_qcom_interconnect_init() - Get interconnect path handles
241 * @qcom: Pointer to the concerned usb core.
247 struct device *dev = qcom->dev; in dwc3_qcom_interconnect_init()
250 if (has_acpi_companion(dev)) in dwc3_qcom_interconnect_init()
253 qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr"); in dwc3_qcom_interconnect_init()
254 if (IS_ERR(qcom->icc_path_ddr)) { in dwc3_qcom_interconnect_init()
255 dev_err(dev, "failed to get usb-ddr path: %ld\n", in dwc3_qcom_interconnect_init()
256 PTR_ERR(qcom->icc_path_ddr)); in dwc3_qcom_interconnect_init()
257 return PTR_ERR(qcom->icc_path_ddr); in dwc3_qcom_interconnect_init()
260 qcom->icc_path_apps = of_icc_get(dev, "apps-usb"); in dwc3_qcom_interconnect_init()
261 if (IS_ERR(qcom->icc_path_apps)) { in dwc3_qcom_interconnect_init()
262 dev_err(dev, "failed to get apps-usb path: %ld\n", in dwc3_qcom_interconnect_init()
263 PTR_ERR(qcom->icc_path_apps)); in dwc3_qcom_interconnect_init()
264 return PTR_ERR(qcom->icc_path_apps); in dwc3_qcom_interconnect_init()
267 max_speed = usb_get_maximum_speed(&qcom->dwc3->dev); in dwc3_qcom_interconnect_init()
268 if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN) { in dwc3_qcom_interconnect_init()
269 ret = icc_set_bw(qcom->icc_path_ddr, in dwc3_qcom_interconnect_init()
272 ret = icc_set_bw(qcom->icc_path_ddr, in dwc3_qcom_interconnect_init()
275 if (ret) { in dwc3_qcom_interconnect_init()
276 dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret); in dwc3_qcom_interconnect_init()
280 ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW); in dwc3_qcom_interconnect_init()
281 if (ret) { in dwc3_qcom_interconnect_init()
282 dev_err(dev, "failed to set bandwidth for apps-usb path: %d\n", ret); in dwc3_qcom_interconnect_init()
290 * dwc3_qcom_interconnect_exit() - Release interconnect path handles
291 * @qcom: Pointer to the concerned usb core.
297 icc_put(qcom->icc_path_ddr); in dwc3_qcom_interconnect_exit()
298 icc_put(qcom->icc_path_apps); in dwc3_qcom_interconnect_exit()
304 struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); in dwc3_qcom_is_host()
306 return dwc->xhci; in dwc3_qcom_is_host()
311 struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); in dwc3_qcom_read_usb2_speed()
318 hcd = platform_get_drvdata(dwc->xhci); in dwc3_qcom_read_usb2_speed()
327 udev = usb_hub_find_child(hcd->self.root_hub, 1); in dwc3_qcom_read_usb2_speed()
331 if (!udev) in dwc3_qcom_read_usb2_speed()
334 return udev->speed; in dwc3_qcom_read_usb2_speed()
339 if (!irq) in dwc3_qcom_enable_wakeup_irq()
342 if (polarity) in dwc3_qcom_enable_wakeup_irq()
351 if (!irq) in dwc3_qcom_disable_wakeup_irq()
360 dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq); in dwc3_qcom_disable_interrupts()
362 if (qcom->usb2_speed == USB_SPEED_LOW) { in dwc3_qcom_disable_interrupts()
363 dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq); in dwc3_qcom_disable_interrupts()
364 } else if ((qcom->usb2_speed == USB_SPEED_HIGH) || in dwc3_qcom_disable_interrupts()
365 (qcom->usb2_speed == USB_SPEED_FULL)) { in dwc3_qcom_disable_interrupts()
366 dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq); in dwc3_qcom_disable_interrupts()
368 dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq); in dwc3_qcom_disable_interrupts()
369 dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq); in dwc3_qcom_disable_interrupts()
372 dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq); in dwc3_qcom_disable_interrupts()
377 dwc3_qcom_enable_wakeup_irq(qcom->hs_phy_irq, 0); in dwc3_qcom_enable_interrupts()
381 * the root hub port. When HS/FS device is connected, configure the DP line in dwc3_qcom_enable_interrupts()
385 * DP and DM lines as rising edge to detect HS/HS/LS device connect scenario. in dwc3_qcom_enable_interrupts()
388 if (qcom->usb2_speed == USB_SPEED_LOW) { in dwc3_qcom_enable_interrupts()
389 dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq, in dwc3_qcom_enable_interrupts()
391 } else if ((qcom->usb2_speed == USB_SPEED_HIGH) || in dwc3_qcom_enable_interrupts()
392 (qcom->usb2_speed == USB_SPEED_FULL)) { in dwc3_qcom_enable_interrupts()
393 dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq, in dwc3_qcom_enable_interrupts()
396 dwc3_qcom_enable_wakeup_irq(qcom->dp_hs_phy_irq, in dwc3_qcom_enable_interrupts()
398 dwc3_qcom_enable_wakeup_irq(qcom->dm_hs_phy_irq, in dwc3_qcom_enable_interrupts()
402 dwc3_qcom_enable_wakeup_irq(qcom->ss_phy_irq, 0); in dwc3_qcom_enable_interrupts()
410 if (qcom->is_suspended) in dwc3_qcom_suspend()
413 val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG); in dwc3_qcom_suspend()
414 if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) in dwc3_qcom_suspend()
415 dev_err(qcom->dev, "HS-PHY not in L2\n"); in dwc3_qcom_suspend()
417 for (i = qcom->num_clocks - 1; i >= 0; i--) in dwc3_qcom_suspend()
418 clk_disable_unprepare(qcom->clks[i]); in dwc3_qcom_suspend()
421 if (ret) in dwc3_qcom_suspend()
422 dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret); in dwc3_qcom_suspend()
428 if (dwc3_qcom_is_host(qcom) && wakeup) { in dwc3_qcom_suspend()
429 qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom); in dwc3_qcom_suspend()
433 qcom->is_suspended = true; in dwc3_qcom_suspend()
443 if (!qcom->is_suspended) in dwc3_qcom_resume()
446 if (dwc3_qcom_is_host(qcom) && wakeup) in dwc3_qcom_resume()
449 for (i = 0; i < qcom->num_clocks; i++) { in dwc3_qcom_resume()
450 ret = clk_prepare_enable(qcom->clks[i]); in dwc3_qcom_resume()
451 if (ret < 0) { in dwc3_qcom_resume()
452 while (--i >= 0) in dwc3_qcom_resume()
453 clk_disable_unprepare(qcom->clks[i]); in dwc3_qcom_resume()
459 if (ret) in dwc3_qcom_resume()
460 dev_warn(qcom->dev, "failed to enable interconnect: %d\n", ret); in dwc3_qcom_resume()
463 dwc3_qcom_setbits(qcom->qscratch_base, PWR_EVNT_IRQ_STAT_REG, in dwc3_qcom_resume()
466 qcom->is_suspended = false; in dwc3_qcom_resume()
474 struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); in qcom_dwc3_resume_irq()
476 /* If pm_suspended then let pm_resume take care of resuming h/w */ in qcom_dwc3_resume_irq()
477 if (qcom->pm_suspended) in qcom_dwc3_resume_irq()
484 if (dwc3_qcom_is_host(qcom)) in qcom_dwc3_resume_irq()
485 pm_runtime_resume(&dwc->xhci->dev); in qcom_dwc3_resume_irq()
493 dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_GENERAL_CFG, in dwc3_qcom_select_utmi_clk()
498 dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_GENERAL_CFG, in dwc3_qcom_select_utmi_clk()
503 dwc3_qcom_clrbits(qcom->qscratch_base, QSCRATCH_GENERAL_CFG, in dwc3_qcom_select_utmi_clk()
511 struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : pdev; in dwc3_qcom_get_irq()
512 struct device_node *np = pdev->dev.of_node; in dwc3_qcom_get_irq()
515 if (np) in dwc3_qcom_get_irq()
526 const struct dwc3_acpi_pdata *pdata = qcom->acpi_pdata; in dwc3_qcom_setup_irq()
531 pdata ? pdata->hs_phy_irq_index : -1); in dwc3_qcom_setup_irq()
532 if (irq > 0) { in dwc3_qcom_setup_irq()
535 ret = devm_request_threaded_irq(qcom->dev, irq, NULL, in dwc3_qcom_setup_irq()
538 "qcom_dwc3 HS", qcom); in dwc3_qcom_setup_irq()
539 if (ret) { in dwc3_qcom_setup_irq()
540 dev_err(qcom->dev, "hs_phy_irq failed: %d\n", ret); in dwc3_qcom_setup_irq()
543 qcom->hs_phy_irq = irq; in dwc3_qcom_setup_irq()
547 pdata ? pdata->dp_hs_phy_irq_index : -1); in dwc3_qcom_setup_irq()
548 if (irq > 0) { in dwc3_qcom_setup_irq()
550 ret = devm_request_threaded_irq(qcom->dev, irq, NULL, in dwc3_qcom_setup_irq()
554 if (ret) { in dwc3_qcom_setup_irq()
555 dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret); in dwc3_qcom_setup_irq()
558 qcom->dp_hs_phy_irq = irq; in dwc3_qcom_setup_irq()
562 pdata ? pdata->dm_hs_phy_irq_index : -1); in dwc3_qcom_setup_irq()
563 if (irq > 0) { in dwc3_qcom_setup_irq()
565 ret = devm_request_threaded_irq(qcom->dev, irq, NULL, in dwc3_qcom_setup_irq()
569 if (ret) { in dwc3_qcom_setup_irq()
570 dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret); in dwc3_qcom_setup_irq()
573 qcom->dm_hs_phy_irq = irq; in dwc3_qcom_setup_irq()
577 pdata ? pdata->ss_phy_irq_index : -1); in dwc3_qcom_setup_irq()
578 if (irq > 0) { in dwc3_qcom_setup_irq()
580 ret = devm_request_threaded_irq(qcom->dev, irq, NULL, in dwc3_qcom_setup_irq()
584 if (ret) { in dwc3_qcom_setup_irq()
585 dev_err(qcom->dev, "ss_phy_irq failed: %d\n", ret); in dwc3_qcom_setup_irq()
588 qcom->ss_phy_irq = irq; in dwc3_qcom_setup_irq()
596 struct device *dev = qcom->dev; in dwc3_qcom_clk_init()
597 struct device_node *np = dev->of_node; in dwc3_qcom_clk_init()
600 if (!np || !count) in dwc3_qcom_clk_init()
603 if (count < 0) in dwc3_qcom_clk_init()
606 qcom->num_clocks = count; in dwc3_qcom_clk_init()
608 qcom->clks = devm_kcalloc(dev, qcom->num_clocks, in dwc3_qcom_clk_init()
610 if (!qcom->clks) in dwc3_qcom_clk_init()
611 return -ENOMEM; in dwc3_qcom_clk_init()
613 for (i = 0; i < qcom->num_clocks; i++) { in dwc3_qcom_clk_init()
618 if (IS_ERR(clk)) { in dwc3_qcom_clk_init()
619 while (--i >= 0) in dwc3_qcom_clk_init()
620 clk_put(qcom->clks[i]); in dwc3_qcom_clk_init()
625 if (ret < 0) { in dwc3_qcom_clk_init()
626 while (--i >= 0) { in dwc3_qcom_clk_init()
627 clk_disable_unprepare(qcom->clks[i]); in dwc3_qcom_clk_init()
628 clk_put(qcom->clks[i]); in dwc3_qcom_clk_init()
635 qcom->clks[i] = clk; in dwc3_qcom_clk_init()
653 struct device *dev = &pdev->dev; in dwc3_qcom_acpi_register_core()
655 struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : in dwc3_qcom_acpi_register_core()
660 qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); in dwc3_qcom_acpi_register_core()
661 if (!qcom->dwc3) in dwc3_qcom_acpi_register_core()
662 return -ENOMEM; in dwc3_qcom_acpi_register_core()
664 qcom->dwc3->dev.parent = dev; in dwc3_qcom_acpi_register_core()
665 qcom->dwc3->dev.type = dev->type; in dwc3_qcom_acpi_register_core()
666 qcom->dwc3->dev.dma_mask = dev->dma_mask; in dwc3_qcom_acpi_register_core()
667 qcom->dwc3->dev.dma_parms = dev->dma_parms; in dwc3_qcom_acpi_register_core()
668 qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; in dwc3_qcom_acpi_register_core()
671 if (!child_res) { in dwc3_qcom_acpi_register_core()
672 platform_device_put(qcom->dwc3); in dwc3_qcom_acpi_register_core()
673 return -ENOMEM; in dwc3_qcom_acpi_register_core()
677 if (!res) { in dwc3_qcom_acpi_register_core()
678 dev_err(&pdev->dev, "failed to get memory resource\n"); in dwc3_qcom_acpi_register_core()
679 ret = -ENODEV; in dwc3_qcom_acpi_register_core()
683 child_res[0].flags = res->flags; in dwc3_qcom_acpi_register_core()
684 child_res[0].start = res->start; in dwc3_qcom_acpi_register_core()
686 qcom->acpi_pdata->dwc3_core_base_size; in dwc3_qcom_acpi_register_core()
689 if (irq < 0) { in dwc3_qcom_acpi_register_core()
696 ret = platform_device_add_resources(qcom->dwc3, child_res, 2); in dwc3_qcom_acpi_register_core()
697 if (ret) { in dwc3_qcom_acpi_register_core()
698 dev_err(&pdev->dev, "failed to add resources\n"); in dwc3_qcom_acpi_register_core()
702 ret = device_add_software_node(&qcom->dwc3->dev, &dwc3_qcom_swnode); in dwc3_qcom_acpi_register_core()
703 if (ret < 0) { in dwc3_qcom_acpi_register_core()
704 dev_err(&pdev->dev, "failed to add properties\n"); in dwc3_qcom_acpi_register_core()
708 ret = platform_device_add(qcom->dwc3); in dwc3_qcom_acpi_register_core()
709 if (ret) { in dwc3_qcom_acpi_register_core()
710 dev_err(&pdev->dev, "failed to add device\n"); in dwc3_qcom_acpi_register_core()
711 device_remove_software_node(&qcom->dwc3->dev); in dwc3_qcom_acpi_register_core()
718 platform_device_put(qcom->dwc3); in dwc3_qcom_acpi_register_core()
726 struct device_node *np = pdev->dev.of_node, *dwc3_np; in dwc3_qcom_of_register_core()
727 struct device *dev = &pdev->dev; in dwc3_qcom_of_register_core()
731 if (!dwc3_np) { in dwc3_qcom_of_register_core()
733 return -ENODEV; in dwc3_qcom_of_register_core()
737 if (ret) { in dwc3_qcom_of_register_core()
738 dev_err(dev, "failed to register dwc3 core - %d\n", ret); in dwc3_qcom_of_register_core()
742 qcom->dwc3 = of_find_device_by_node(dwc3_np); in dwc3_qcom_of_register_core()
743 if (!qcom->dwc3) { in dwc3_qcom_of_register_core()
744 ret = -ENODEV; in dwc3_qcom_of_register_core()
764 ret = sscanf(fwnode_get_name(dev->fwnode), "URS%d", &id); in dwc3_qcom_create_urs_usb_platdev()
765 if (!ret) in dwc3_qcom_create_urs_usb_platdev()
769 snprintf(name, sizeof(name), "USB%d", id); in dwc3_qcom_create_urs_usb_platdev()
770 fwh = fwnode_get_named_child_node(dev->fwnode, name); in dwc3_qcom_create_urs_usb_platdev()
771 if (!fwh) in dwc3_qcom_create_urs_usb_platdev()
775 if (!adev) in dwc3_qcom_create_urs_usb_platdev()
783 struct device_node *np = pdev->dev.of_node; in dwc3_qcom_probe()
784 struct device *dev = &pdev->dev; in dwc3_qcom_probe()
791 qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); in dwc3_qcom_probe()
792 if (!qcom) in dwc3_qcom_probe()
793 return -ENOMEM; in dwc3_qcom_probe()
796 qcom->dev = &pdev->dev; in dwc3_qcom_probe()
798 if (has_acpi_companion(dev)) { in dwc3_qcom_probe()
799 qcom->acpi_pdata = acpi_device_get_match_data(dev); in dwc3_qcom_probe()
800 if (!qcom->acpi_pdata) { in dwc3_qcom_probe()
801 dev_err(&pdev->dev, "no supporting ACPI device data\n"); in dwc3_qcom_probe()
802 return -EINVAL; in dwc3_qcom_probe()
806 qcom->resets = devm_reset_control_array_get_optional_exclusive(dev); in dwc3_qcom_probe()
807 if (IS_ERR(qcom->resets)) { in dwc3_qcom_probe()
808 ret = PTR_ERR(qcom->resets); in dwc3_qcom_probe()
809 dev_err(&pdev->dev, "failed to get resets, err=%d\n", ret); in dwc3_qcom_probe()
813 ret = reset_control_assert(qcom->resets); in dwc3_qcom_probe()
814 if (ret) { in dwc3_qcom_probe()
815 dev_err(&pdev->dev, "failed to assert resets, err=%d\n", ret); in dwc3_qcom_probe()
821 ret = reset_control_deassert(qcom->resets); in dwc3_qcom_probe()
822 if (ret) { in dwc3_qcom_probe()
823 dev_err(&pdev->dev, "failed to deassert resets, err=%d\n", ret); in dwc3_qcom_probe()
828 if (ret) { in dwc3_qcom_probe()
835 if (np) { in dwc3_qcom_probe()
839 if (!parent_res) in dwc3_qcom_probe()
840 return -ENOMEM; in dwc3_qcom_probe()
842 parent_res->start = res->start + in dwc3_qcom_probe()
843 qcom->acpi_pdata->qscratch_base_offset; in dwc3_qcom_probe()
844 parent_res->end = parent_res->start + in dwc3_qcom_probe()
845 qcom->acpi_pdata->qscratch_base_size; in dwc3_qcom_probe()
847 if (qcom->acpi_pdata->is_urs) { in dwc3_qcom_probe()
848 qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev); in dwc3_qcom_probe()
849 if (IS_ERR_OR_NULL(qcom->urs_usb)) { in dwc3_qcom_probe()
850 dev_err(dev, "failed to create URS USB platdev\n"); in dwc3_qcom_probe()
851 if (!qcom->urs_usb) in dwc3_qcom_probe()
852 return -ENODEV; in dwc3_qcom_probe()
854 return PTR_ERR(qcom->urs_usb); in dwc3_qcom_probe()
859 qcom->qscratch_base = devm_ioremap_resource(dev, parent_res); in dwc3_qcom_probe()
860 if (IS_ERR(qcom->qscratch_base)) { in dwc3_qcom_probe()
861 ret = PTR_ERR(qcom->qscratch_base); in dwc3_qcom_probe()
866 if (ret) { in dwc3_qcom_probe()
872 * Disable pipe_clk requirement if specified. Used when dwc3 in dwc3_qcom_probe()
873 * operates without SSPHY and only HS/FS/LS modes are supported. in dwc3_qcom_probe()
876 "qcom,select-utmi-as-pipe-clk"); in dwc3_qcom_probe()
877 if (ignore_pipe_clk) in dwc3_qcom_probe()
880 if (np) in dwc3_qcom_probe()
885 if (ret) { in dwc3_qcom_probe()
891 if (ret) in dwc3_qcom_probe()
894 qcom->mode = usb_get_dr_mode(&qcom->dwc3->dev); in dwc3_qcom_probe()
897 if (qcom->mode == USB_DR_MODE_PERIPHERAL) in dwc3_qcom_probe()
902 if (ret) in dwc3_qcom_probe()
905 wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source"); in dwc3_qcom_probe()
906 device_init_wakeup(&pdev->dev, wakeup_source); in dwc3_qcom_probe()
907 device_init_wakeup(&qcom->dwc3->dev, wakeup_source); in dwc3_qcom_probe()
909 qcom->is_suspended = false; in dwc3_qcom_probe()
919 if (np) in dwc3_qcom_probe()
920 of_platform_depopulate(&pdev->dev); in dwc3_qcom_probe()
924 for (i = qcom->num_clocks - 1; i >= 0; i--) { in dwc3_qcom_probe()
925 clk_disable_unprepare(qcom->clks[i]); in dwc3_qcom_probe()
926 clk_put(qcom->clks[i]); in dwc3_qcom_probe()
929 reset_control_assert(qcom->resets); in dwc3_qcom_probe()
937 struct device *dev = &pdev->dev; in dwc3_qcom_remove()
940 device_remove_software_node(&qcom->dwc3->dev); in dwc3_qcom_remove()
943 for (i = qcom->num_clocks - 1; i >= 0; i--) { in dwc3_qcom_remove()
944 clk_disable_unprepare(qcom->clks[i]); in dwc3_qcom_remove()
945 clk_put(qcom->clks[i]); in dwc3_qcom_remove()
947 qcom->num_clocks = 0; in dwc3_qcom_remove()
950 reset_control_assert(qcom->resets); in dwc3_qcom_remove()
965 if (ret) in dwc3_qcom_pm_suspend()
968 qcom->pm_suspended = true; in dwc3_qcom_pm_suspend()
980 if (ret) in dwc3_qcom_pm_resume()
983 qcom->pm_suspended = false; in dwc3_qcom_pm_resume()
1050 .name = "dwc3-qcom",