Commit 66a36096 authored by Vardan Mikayelyan's avatar Vardan Mikayelyan Committed by Felipe Balbi

usb: dwc2: Changes in registers backup/restore functions

Move hptxfsiz to host register's backup/restore functions, not
needed to have it in global register's backup/restore functions.

Add backup for glpmcfg, and read/write for gi2cctl and pcgcctl.
As requires programming guide.

Affected functions:
dwc2_backup_host_registers()
dwc2_restore_host_registers()
dwc2_backup_global_registers()
dwc2_restore_global_registers()
Signed-off-by: default avatarVardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarGrigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent fa389a6d
...@@ -79,9 +79,11 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) ...@@ -79,9 +79,11 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
gr->gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); gr->gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
gr->grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ); gr->grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ);
gr->gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); gr->gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ);
gr->hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
gr->gdfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG); gr->gdfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG);
gr->pcgcctl1 = dwc2_readl(hsotg->regs + PCGCCTL1); gr->pcgcctl1 = dwc2_readl(hsotg->regs + PCGCCTL1);
gr->glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG);
gr->gi2cctl = dwc2_readl(hsotg->regs + GI2CCTL);
gr->pcgcctl = dwc2_readl(hsotg->regs + PCGCTL);
gr->valid = true; gr->valid = true;
return 0; return 0;
...@@ -116,9 +118,11 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg) ...@@ -116,9 +118,11 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg)
dwc2_writel(gr->gahbcfg, hsotg->regs + GAHBCFG); dwc2_writel(gr->gahbcfg, hsotg->regs + GAHBCFG);
dwc2_writel(gr->grxfsiz, hsotg->regs + GRXFSIZ); dwc2_writel(gr->grxfsiz, hsotg->regs + GRXFSIZ);
dwc2_writel(gr->gnptxfsiz, hsotg->regs + GNPTXFSIZ); dwc2_writel(gr->gnptxfsiz, hsotg->regs + GNPTXFSIZ);
dwc2_writel(gr->hptxfsiz, hsotg->regs + HPTXFSIZ);
dwc2_writel(gr->gdfifocfg, hsotg->regs + GDFIFOCFG); dwc2_writel(gr->gdfifocfg, hsotg->regs + GDFIFOCFG);
dwc2_writel(gr->pcgcctl1, hsotg->regs + PCGCCTL1); dwc2_writel(gr->pcgcctl1, hsotg->regs + PCGCCTL1);
dwc2_writel(gr->glpmcfg, hsotg->regs + GLPMCFG);
dwc2_writel(gr->pcgcctl, hsotg->regs + PCGCTL);
dwc2_writel(gr->gi2cctl, hsotg->regs + GI2CCTL);
return 0; return 0;
} }
......
...@@ -640,7 +640,7 @@ struct dwc2_hw_params { ...@@ -640,7 +640,7 @@ struct dwc2_hw_params {
* @grxfsiz: Backup of GRXFSIZ register * @grxfsiz: Backup of GRXFSIZ register
* @gnptxfsiz: Backup of GNPTXFSIZ register * @gnptxfsiz: Backup of GNPTXFSIZ register
* @gi2cctl: Backup of GI2CCTL register * @gi2cctl: Backup of GI2CCTL register
* @hptxfsiz: Backup of HPTXFSIZ register * @glpmcfg: Backup of GLPMCFG register
* @gdfifocfg: Backup of GDFIFOCFG register * @gdfifocfg: Backup of GDFIFOCFG register
* @gpwrdn: Backup of GPWRDN register * @gpwrdn: Backup of GPWRDN register
*/ */
...@@ -652,7 +652,7 @@ struct dwc2_gregs_backup { ...@@ -652,7 +652,7 @@ struct dwc2_gregs_backup {
u32 grxfsiz; u32 grxfsiz;
u32 gnptxfsiz; u32 gnptxfsiz;
u32 gi2cctl; u32 gi2cctl;
u32 hptxfsiz; u32 glpmcfg;
u32 pcgcctl; u32 pcgcctl;
u32 pcgcctl1; u32 pcgcctl1;
u32 gdfifocfg; u32 gdfifocfg;
...@@ -700,6 +700,7 @@ struct dwc2_dregs_backup { ...@@ -700,6 +700,7 @@ struct dwc2_dregs_backup {
* @hcintmsk: Backup of HCINTMSK register * @hcintmsk: Backup of HCINTMSK register
* @hptr0: Backup of HPTR0 register * @hptr0: Backup of HPTR0 register
* @hfir: Backup of HFIR register * @hfir: Backup of HFIR register
* @hptxfsiz: Backup of HPTXFSIZ register
*/ */
struct dwc2_hregs_backup { struct dwc2_hregs_backup {
u32 hcfg; u32 hcfg;
...@@ -707,6 +708,7 @@ struct dwc2_hregs_backup { ...@@ -707,6 +708,7 @@ struct dwc2_hregs_backup {
u32 hcintmsk[MAX_EPS_CHANNELS]; u32 hcintmsk[MAX_EPS_CHANNELS];
u32 hprt0; u32 hprt0;
u32 hfir; u32 hfir;
u32 hptxfsiz;
bool valid; bool valid;
}; };
......
...@@ -5318,6 +5318,7 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) ...@@ -5318,6 +5318,7 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
hr->hprt0 = dwc2_read_hprt0(hsotg); hr->hprt0 = dwc2_read_hprt0(hsotg);
hr->hfir = dwc2_readl(hsotg->regs + HFIR); hr->hfir = dwc2_readl(hsotg->regs + HFIR);
hr->hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
hr->valid = true; hr->valid = true;
return 0; return 0;
...@@ -5354,6 +5355,7 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) ...@@ -5354,6 +5355,7 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg)
dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); dwc2_writel(hr->hprt0, hsotg->regs + HPRT0);
dwc2_writel(hr->hfir, hsotg->regs + HFIR); dwc2_writel(hr->hfir, hsotg->regs + HFIR);
dwc2_writel(hr->hptxfsiz, hsotg->regs + HPTXFSIZ);
hsotg->frame_number = 0; hsotg->frame_number = 0;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment