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

Commit 85503c70 authored by Tanya Finkel's avatar Tanya Finkel
Browse files

usb: msm: Add support for the HUB reset for the synopsys core



DB8096 have a HUB on the USB port 1. HUB reset is controlled by GPIO.

Change-Id: I44fe4a91a0f0f7a89ef3b7654051fa7f12075fc1
Signed-off-by: default avatarTanya Finkel <tfinkel@codeaurora.org>
parent 3a88ff89
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ Optional properties :
  after USB is kept into LPM.
- qcom,vbus-present: Indicates that there is no VBUS indication from PMIC. Assume VBUS is
  present if this property is defined.
- qcom,ext-hub-reset-gpio: This corresponds to gpio which is used for HUB reset.
Sub nodes:
- Sub node for "DWC3- USB3 controller".
  This sub node is required property for device node. The properties of this subnode
+18 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/list.h>
#include <linux/uaccess.h>
#include <linux/usb/ch9.h>
@@ -2024,6 +2025,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	u32 tmp;
	bool host_mode;
	int ret = 0;
	int ext_hub_reset_gpio;

	mdwc = devm_kzalloc(&pdev->dev, sizeof(*mdwc), GFP_KERNEL);
	if (!mdwc) {
@@ -2292,6 +2294,22 @@ static int dwc3_msm_probe(struct platform_device *pdev)
		}
	}

	ext_hub_reset_gpio = of_get_named_gpio(node,
					"qcom,ext-hub-reset-gpio", 0);

	if (gpio_is_valid(ext_hub_reset_gpio)
		&& (!devm_gpio_request(&pdev->dev, ext_hub_reset_gpio,
			"qcom,ext-hub-reset-gpio"))) {
		/* reset external hub */
		gpio_direction_output(ext_hub_reset_gpio, 1);
		/*
		 * Hub reset should be asserted for minimum 5microsec
		 * before deasserting.
		 */
		usleep_range(5, 1000);
		gpio_direction_output(ext_hub_reset_gpio, 0);
	}

	if (of_property_read_u32(node, "qcom,dwc-usb3-msm-tx-fifo-size",
				 &mdwc->tx_fifo_size))
		dev_err(&pdev->dev,