Patchwork [01/14] usb: dwc2: Fix dwc2_restore_device_registers() function.

login
register
mail settings
Submitter Artur Petrosyan
Date April 12, 2019, 1:38 p.m.
Message ID <b4129291df7b2d061e93c03862c081b6a35b2e7f.1555075927.git.arturp@synopsys.com>
Download mbox | patch
Permalink /patch/771827/
State New
Headers show

Comments

Artur Petrosyan - April 12, 2019, 1:38 p.m.
- Added backup of DCFG register.
- Added Set the Power-On Programming done bit.

Signed-off-by: Artur Petrosyan <arturp@synopsys.com>

---
 drivers/usb/dwc2/gadget.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.11.0

Patch

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c

index 6812a8a3a98b..dcb0fbb8bc42 100644

--- a/drivers/usb/dwc2/gadget.c

+++ b/drivers/usb/dwc2/gadget.c

@@ -5004,6 +5004,7 @@  int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup)

 {
 	struct dwc2_dregs_backup *dr;
 	int i;
+	u32 dctl;

 
 	dev_dbg(hsotg->dev, "%s\n", __func__);
 
@@ -5019,6 +5020,15 @@  int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup)

 	if (!remote_wakeup)
 		dwc2_writel(hsotg, dr->dctl, DCTL);
 
+	if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_PARTIAL) {

+		dwc2_writel(hsotg, dr->dcfg, DCFG);

+

+		/* Set the Power-On Programming done bit */

+		dctl = dwc2_readl(hsotg, DCTL);

+		dctl |= DCTL_PWRONPRGDONE;

+		dwc2_writel(hsotg, dctl, DCTL);

+	}

+

 	dwc2_writel(hsotg, dr->daintmsk, DAINTMSK);
 	dwc2_writel(hsotg, dr->diepmsk, DIEPMSK);
 	dwc2_writel(hsotg, dr->doepmsk, DOEPMSK);