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

Commit 83f8da56 authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Felipe Balbi
Browse files

usb: dwc2: Add reset control to dwc2



Allow for platforms that have a reset controller driver in place to bring
the USB IP out of reset.

Signed-off-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent b74c2d87
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -868,6 +868,7 @@ struct dwc2_hsotg {
	void *priv;
	void *priv;
	int     irq;
	int     irq;
	struct clk *clk;
	struct clk *clk;
	struct reset_control *reset;


	unsigned int queuing_high_bandwidth:1;
	unsigned int queuing_high_bandwidth:1;
	unsigned int srp_success:1;
	unsigned int srp_success:1;
+22 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/phy/phy.h>
#include <linux/phy/phy.h>
#include <linux/platform_data/s3c-hsotg.h>
#include <linux/platform_data/s3c-hsotg.h>
#include <linux/reset.h>


#include <linux/usb/of.h>
#include <linux/usb/of.h>


@@ -337,6 +338,24 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
{
{
	int i, ret;
	int i, ret;


	hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
	if (IS_ERR(hsotg->reset)) {
		ret = PTR_ERR(hsotg->reset);
		switch (ret) {
		case -ENOENT:
		case -ENOTSUPP:
			hsotg->reset = NULL;
			break;
		default:
			dev_err(hsotg->dev, "error getting reset control %d\n",
				ret);
			return ret;
		}
	}

	if (hsotg->reset)
		reset_control_deassert(hsotg->reset);

	/* Set default UTMI width */
	/* Set default UTMI width */
	hsotg->phyif = GUSBCFG_PHYIF16;
	hsotg->phyif = GUSBCFG_PHYIF16;


@@ -434,6 +453,9 @@ static int dwc2_driver_remove(struct platform_device *dev)
	if (hsotg->ll_hw_enabled)
	if (hsotg->ll_hw_enabled)
		dwc2_lowlevel_hw_disable(hsotg);
		dwc2_lowlevel_hw_disable(hsotg);


	if (hsotg->reset)
		reset_control_assert(hsotg->reset);

	return 0;
	return 0;
}
}