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

Commit 438c0416 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: dwc3: Add support to disable hsphy auto suspend feature



Currently hsphy auto suspend is enabled by default. There are few
issues using this feature as it is required to disable this
functionality before sending different endpoint and generic commands
to core and re-enable after the same. Hence this change adds support
to disable hsphy auto suspend feature if it is required.

CRs-Fixed: 625668
Change-Id: Iec585aefe83fb5710152dd6e4627fcba767cd262
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 8be3261b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ Optional properties:
	is used. By default, the half-full setting is used.
 - 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.

This is usually a subnode to DWC3 glue to which it is connected.

+7 −3
Original line number Diff line number Diff line
@@ -104,10 +104,12 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
	reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
	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);
	}
}

/**
 * dwc3_core_soft_reset_after_phy_init - Issues core soft reset
@@ -594,6 +596,8 @@ 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, "host-only-mode");
	dwc->hsphy_auto_suspend_disable = of_property_read_bool(node,
						"snps,hsphy-auto-suspend-disable");
	dwc->maximum_speed = of_usb_get_maximum_speed(node);

	if (node) {
+1 −0
Original line number Diff line number Diff line
@@ -833,6 +833,7 @@ struct dwc3 {
	bool			nominal_elastic_buffer;
	bool			core_reset_after_phy_init;
	bool			err_evt_seen;
	bool			hsphy_auto_suspend_disable;
};

/* -------------------------------------------------------------------------- */
+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ 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;
+3 −0
Original line number Diff line number Diff line
@@ -2503,6 +2503,9 @@ static void dwc3_gadget_usb2_phy_suspend(struct dwc3 *dwc, int suspend)
{
	u32			reg;

	if (dwc->hsphy_auto_suspend_disable)
		return;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));

	if (suspend)