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

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

Merge "usb: dwc3: Remove toggling of HSPHY autosuspend"

parents 73b242a0 4e855797
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ Optional properties:
	is used. By default, the half-full setting is used.
 - snps,core-reset-after-phy-init: If present, PHY reset and initialization is
   performed before core reset.
 - snps,hsphy-auto-suspend-disable: If present, auto suspend feature is not enabled with hsusb phy.
 - snps,ssphy-clear-auto-suspend-on-disconnect: If present, clear auto suspend feaure with ssusb phy
   during cable disconnect.
 - snps,usb3-u1u2-disable: If present, disable u1u2 low power modes for DWC3 core controller in SS mode.
+0 −7
Original line number Diff line number Diff line
@@ -108,11 +108,6 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
		reg |= DWC3_GUSB3PIPECTL_SUSPHY;
		dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
	}
	if (!dwc->hsphy_auto_suspend_disable) {
		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
		reg |= DWC3_GUSB2PHYCFG_SUSPHY;
		dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
	}
}

/**
@@ -629,8 +624,6 @@ static int dwc3_probe(struct platform_device *pdev)

	dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
	host_only_mode = of_property_read_bool(node, "snps,host-only-mode");
	dwc->hsphy_auto_suspend_disable = of_property_read_bool(node,
						"snps,hsphy-auto-suspend-disable");
	dwc->ssphy_clear_auto_suspend_on_disconnect =
						of_property_read_bool(node,
						"snps,ssphy-clear-auto-suspend-on-disconnect");
+3 −1
Original line number Diff line number Diff line
@@ -890,7 +890,6 @@ struct dwc3 {
	bool			nominal_elastic_buffer;
	bool			core_reset_after_phy_init;
	bool			err_evt_seen;
	bool			hsphy_auto_suspend_disable;
	bool			ssphy_clear_auto_suspend_on_disconnect;
	bool			usb3_u1u2_disable;
	bool			enable_bus_suspend;
@@ -1071,6 +1070,7 @@ int dwc3_gadget_prepare(struct dwc3 *dwc);
void dwc3_gadget_complete(struct dwc3 *dwc);
int dwc3_gadget_suspend(struct dwc3 *dwc);
int dwc3_gadget_resume(struct dwc3 *dwc);
void dwc3_gadget_usb3_phy_suspend(struct dwc3 *dwc, int suspend);
#else
static inline int dwc3_gadget_prepare(struct dwc3 *dwc)
{
@@ -1090,6 +1090,8 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc)
{
	return 0;
}

static void dwc3_gadget_usb3_phy_suspend(struct dwc3 *dwc, int suspend) { }
#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */

void dwc3_gadget_restart(struct dwc3 *dwc);
+0 −22
Original line number Diff line number Diff line
@@ -2746,27 +2746,6 @@ unreg_chrdev:
	return ret;
}

static int msm_dwc3_hsphy_autosuspend(struct usb_phy *x, struct device *dev,
				int enable_autosuspend)
{
	struct dwc3_msm *mdwc = dev_get_drvdata(dev->parent->parent);
	struct dwc3 *dwc = dev_get_drvdata(dev->parent);
	u32 reg;

	if (dwc->hsphy_auto_suspend_disable)
		return 0;

	reg = dwc3_msm_read_reg(mdwc->base, DWC3_GUSB2PHYCFG(0));
	if (enable_autosuspend)
		reg |= DWC3_GUSB2PHYCFG_SUSPHY;
	else
		reg &= ~(DWC3_GUSB2PHYCFG_SUSPHY);

	dwc3_msm_write_reg(mdwc->base, DWC3_GUSB2PHYCFG(0), reg);

	return 0;
}

static int dwc3_msm_probe(struct platform_device *pdev)
{
	struct device_node *node = pdev->dev.of_node, *dwc3_node;
@@ -3162,7 +3141,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
		ret = PTR_ERR(mdwc->hs_phy);
		goto put_dwc3;
	}
	mdwc->hs_phy->set_phy_autosuspend = msm_dwc3_hsphy_autosuspend;

	mdwc->ss_phy = devm_usb_get_phy_by_phandle(&mdwc->dwc3->dev,
							"usb-phy", 1);
+7 −39
Original line number Diff line number Diff line
@@ -76,38 +76,6 @@ static void dwc3_otg_set_host_regs(struct dwc3_otg *dotg)
	}
}

static void dwc3_otg_set_hsphy_auto_suspend(struct dwc3_otg *dotg, bool susp)
{
	struct dwc3 *dwc = dotg->dwc;
	u32 reg;

	if (dotg->dwc->hsphy_auto_suspend_disable)
		return;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
	if (susp)
		reg |= DWC3_GUSB2PHYCFG_SUSPHY;
	else
		reg &= ~(DWC3_GUSB2PHYCFG_SUSPHY);
	dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

static void dwc3_otg_set_ssphy_auto_suspend(struct dwc3_otg *dotg, bool susp)
{
	struct dwc3 *dwc = dotg->dwc;
	u32 reg;

	if (!dwc->ssphy_clear_auto_suspend_on_disconnect)
		return;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
	if (susp)
		reg |= DWC3_GUSB3PIPECTL_SUSPHY;
	else
		reg &= ~(DWC3_GUSB3PIPECTL_SUSPHY);
	dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
}

/**
 * dwc3_otg_set_host_power - Enable port power control for host operation
 *
@@ -208,6 +176,9 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
			return ret;
		}

		if (dwc->ssphy_clear_auto_suspend_on_disconnect)
			dwc3_gadget_usb3_phy_suspend(dwc, true);

		/*
		 * This should be revisited for more testing post-silicon.
		 * In worst case we may need to disconnect the root hub
@@ -218,8 +189,6 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
		 * remove_hcd, But we may not use standard set_host method
		 * anymore.
		 */
		dwc3_otg_set_hsphy_auto_suspend(dotg, true);
		dwc3_otg_set_ssphy_auto_suspend(dotg, true);
		dwc3_otg_set_host_regs(dotg);
		/*
		 * FIXME If micro A cable is disconnected during system suspend,
@@ -269,8 +238,8 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
						ext_xceiv->ext_block_reset)
			ext_xceiv->ext_block_reset(ext_xceiv, true);

		dwc3_otg_set_hsphy_auto_suspend(dotg, false);
		dwc3_otg_set_ssphy_auto_suspend(dotg, false);
		if (dwc->ssphy_clear_auto_suspend_on_disconnect)
			dwc3_gadget_usb3_phy_suspend(dwc, false);
		dwc3_otg_set_peripheral_regs(dotg);

		/* re-init core and OTG registers as block reset clears these */
@@ -343,7 +312,6 @@ static int dwc3_otg_start_peripheral(struct usb_otg *otg, int on)
						ext_xceiv->ext_block_reset)
			ext_xceiv->ext_block_reset(ext_xceiv, false);

		dwc3_otg_set_hsphy_auto_suspend(dotg, true);
		dwc3_otg_set_peripheral_regs(dotg);
		usb_gadget_vbus_connect(otg->gadget);
	} else {
@@ -352,8 +320,8 @@ static int dwc3_otg_start_peripheral(struct usb_otg *otg, int on)
		usb_gadget_vbus_disconnect(otg->gadget);
		usb_phy_notify_disconnect(dotg->dwc->usb2_phy, USB_SPEED_HIGH);
		usb_phy_notify_disconnect(dotg->dwc->usb3_phy, USB_SPEED_SUPER);
		dwc3_otg_set_hsphy_auto_suspend(dotg, false);
		dwc3_otg_set_ssphy_auto_suspend(dotg, false);
		if (dotg->dwc->ssphy_clear_auto_suspend_on_disconnect)
			dwc3_gadget_usb3_phy_suspend(dotg->dwc, false);
	}

	return 0;
Loading