usb: dwc2: gadget: Moved dtxfsiz backup array place
authorVardan Mikayelyan <mvardan@synopsys.com>
Fri, 16 Feb 2018 10:07:33 +0000 (14:07 +0400)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 13 Mar 2018 08:47:54 +0000 (10:47 +0200)
Moved dtxfsiz from dwc2_gregs_backup to dwc2_dregs_backup,
because it is device register.

Signed-off-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc2/core.c
drivers/usb/dwc2/core.h
drivers/usb/dwc2/gadget.c

index 915fe6752b8dfa5760fcf9b2e75848dd11ff22d3..84990a82363b86cba972571c961628281f41ece0 100644 (file)
@@ -67,7 +67,8 @@
 static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
 {
        struct dwc2_gregs_backup *gr;
-       int i;
+
+       dev_dbg(hsotg->dev, "%s\n", __func__);
 
        /* Backup global regs */
        gr = &hsotg->gr_backup;
@@ -81,8 +82,6 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
        gr->hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
        gr->gdfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG);
        gr->pcgcctl1 = dwc2_readl(hsotg->regs + PCGCCTL1);
-       for (i = 0; i < MAX_EPS_CHANNELS; i++)
-               gr->dtxfsiz[i] = dwc2_readl(hsotg->regs + DPTXFSIZN(i));
 
        gr->valid = true;
        return 0;
@@ -98,7 +97,6 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
 static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg)
 {
        struct dwc2_gregs_backup *gr;
-       int i;
 
        dev_dbg(hsotg->dev, "%s\n", __func__);
 
@@ -121,8 +119,6 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg)
        dwc2_writel(gr->hptxfsiz, hsotg->regs + HPTXFSIZ);
        dwc2_writel(gr->gdfifocfg, hsotg->regs + GDFIFOCFG);
        dwc2_writel(gr->pcgcctl1, hsotg->regs + PCGCCTL1);
-       for (i = 0; i < MAX_EPS_CHANNELS; i++)
-               dwc2_writel(gr->dtxfsiz[i], hsotg->regs + DPTXFSIZN(i));
 
        return 0;
 }
index 386a03056763b16a924d75bde80661e102851777..aa69f2838fcd3ad26a25a34c8e3a01e7ade7bca6 100644 (file)
@@ -642,7 +642,6 @@ struct dwc2_hw_params {
  * @gi2cctl:           Backup of GI2CCTL register
  * @hptxfsiz:          Backup of HPTXFSIZ register
  * @gdfifocfg:         Backup of GDFIFOCFG register
- * @dtxfsiz:           Backup of DTXFSIZ registers for each endpoint
  * @gpwrdn:            Backup of GPWRDN register
  */
 struct dwc2_gregs_backup {
@@ -657,7 +656,6 @@ struct dwc2_gregs_backup {
        u32 pcgcctl;
        u32 pcgcctl1;
        u32 gdfifocfg;
-       u32 dtxfsiz[MAX_EPS_CHANNELS];
        u32 gpwrdn;
        bool valid;
 };
@@ -676,6 +674,7 @@ struct dwc2_gregs_backup {
  * @doepctl:           Backup of DOEPCTL register
  * @doeptsiz:          Backup of DOEPTSIZ register
  * @doepdma:           Backup of DOEPDMA register
+ * @dtxfsiz:           Backup of DTXFSIZ registers for each endpoint
  */
 struct dwc2_dregs_backup {
        u32 dcfg;
@@ -689,6 +688,7 @@ struct dwc2_dregs_backup {
        u32 doepctl[MAX_EPS_CHANNELS];
        u32 doeptsiz[MAX_EPS_CHANNELS];
        u32 doepdma[MAX_EPS_CHANNELS];
+       u32 dtxfsiz[MAX_EPS_CHANNELS];
        bool valid;
 };
 
index a43478d65b3fdc60d70205c8e1d06313f0a4d7ba..89c6714241ee5ce9770ecacc744ea0d8d0881db6 100644 (file)
@@ -4815,6 +4815,7 @@ int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg)
 
                dr->doeptsiz[i] = dwc2_readl(hsotg->regs + DOEPTSIZ(i));
                dr->doepdma[i] = dwc2_readl(hsotg->regs + DOEPDMA(i));
+               dr->dtxfsiz[i] = dwc2_readl(hsotg->regs + DPTXFSIZN(i));
        }
        dr->valid = true;
        return 0;
@@ -4855,6 +4856,7 @@ int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg)
                dwc2_writel(dr->diepctl[i], hsotg->regs + DIEPCTL(i));
                dwc2_writel(dr->dieptsiz[i], hsotg->regs + DIEPTSIZ(i));
                dwc2_writel(dr->diepdma[i], hsotg->regs + DIEPDMA(i));
+               dwc2_writel(dr->dtxfsiz[i], hsotg->regs + DPTXFSIZN(i));
 
                /* Restore OUT EPs */
                dwc2_writel(dr->doepctl[i], hsotg->regs + DOEPCTL(i));