Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0929b3bf authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: phy: msm: Add support to reset on board USB devices"

parents e04b4f07 0d20e740
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -183,6 +183,9 @@ Optional properties :
	User can bump it up using 'perf_mode' sysfs attribute for gadget.
- qcom,vbus-low-as-hostmode: If present, specifies USB_VBUS to switch to host mode
	if USB_VBUS is low or device mode if USB_VBUS is high.
- qcom,usbeth-reset-gpio: If present then an external usb-to-eth is connected to
	the USB host controller and its RESET_N signal is connected to this
	usbeth-reset-gpio GPIO. It should be driven LOW to RESET the usb-to-eth.

Example HSUSB OTG controller device node :
	usb@f9690000 {
+37 −0
Original line number Diff line number Diff line
@@ -4232,6 +4232,11 @@ struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev)
	if (pdata->hub_reset_gpio < 0)
		pr_debug("hub_reset_gpio is not available\n");

	pdata->usbeth_reset_gpio = of_get_named_gpio(
			node, "qcom,usbeth-reset-gpio", 0);
	if (pdata->usbeth_reset_gpio < 0)
		pr_debug("usbeth_reset_gpio is not available\n");

	pdata->switch_sel_gpio =
			of_get_named_gpio(node, "qcom,sw-sel-gpio", 0);
	if (pdata->switch_sel_gpio < 0)
@@ -4923,6 +4928,38 @@ static int msm_otg_probe(struct platform_device *pdev)
		}
	}

	if (gpio_is_valid(motg->pdata->hub_reset_gpio)) {
		ret = devm_gpio_request(&pdev->dev,
				motg->pdata->hub_reset_gpio,
				"HUB_RESET");
		if (ret < 0) {
			dev_err(&pdev->dev, "gpio req failed for hub_reset\n");
		} else {
			gpio_direction_output(
				motg->pdata->hub_reset_gpio, 0);
			/* 5 microsecs reset signaling to usb hub */
			usleep_range(5, 10);
			gpio_direction_output(
				motg->pdata->hub_reset_gpio, 1);
		}
	}

	if (gpio_is_valid(motg->pdata->usbeth_reset_gpio)) {
		ret = devm_gpio_request(&pdev->dev,
				motg->pdata->usbeth_reset_gpio,
				"ETH_RESET");
		if (ret < 0) {
			dev_err(&pdev->dev, "gpio req failed for usbeth_reset\n");
		} else {
			gpio_direction_output(
				motg->pdata->usbeth_reset_gpio, 0);
			/* 100 microsecs reset signaling to usb-to-eth */
			usleep_range(100, 110);
			gpio_direction_output(
				motg->pdata->usbeth_reset_gpio, 1);
		}
	}

	motg->pm_notify.notifier_call = msm_otg_pm_notify;
	register_pm_notifier(&motg->pm_notify);
	msm_otg_dbg_log_event(phy, "OTG PROBE", motg->caps, motg->lpm_flags);
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ enum usb_id_state {
		for improving data performance.
 * @bool enable_sdp_typec_current_limit: Indicates whether type-c current for
		sdp charger to be limited.
 * @usbeth_reset_gpio: Gpio used for external usb-to-eth reset.
 */
struct msm_otg_platform_data {
	int *phy_init_seq;
@@ -321,6 +322,7 @@ struct msm_otg_platform_data {
	bool enable_phy_id_pullup;
	int usb_id_gpio;
	int hub_reset_gpio;
	int usbeth_reset_gpio;
	int switch_sel_gpio;
	bool phy_dvdd_always_on;
	bool emulation;