Commit 3c7b9856 authored by Minas Harutyunyan's avatar Minas Harutyunyan Committed by Greg Kroah-Hartman

usb: dwc2: host: Fix hibernation flow

Added to backup/restore registers HFLBADDR, HCCHARi, HCSPLTi,
HCTSIZi, HCDMAi and HCDMABi.

Fixes: 58e52ff6 ("usb: dwc2: Move register save and restore functions")
Fixes: d17ee77b ("usb: dwc2: add controller hibernation support")
CC: stable@vger.kernel.org
Signed-off-by: default avatarMinas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Link: https://lore.kernel.org/r/c2d10ee6098b9b009a8e94191e046004747d3bdd.1708945444.git.Minas.Harutyunyan@synopsys.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 80ba43e9
......@@ -729,8 +729,14 @@ struct dwc2_dregs_backup {
* struct dwc2_hregs_backup - Holds host registers state before
* entering partial power down
* @hcfg: Backup of HCFG register
* @hflbaddr: Backup of HFLBADDR register
* @haintmsk: Backup of HAINTMSK register
* @hcchar: Backup of HCCHAR register
* @hcsplt: Backup of HCSPLT register
* @hcintmsk: Backup of HCINTMSK register
* @hctsiz: Backup of HCTSIZ register
* @hdma: Backup of HCDMA register
* @hcdmab: Backup of HCDMAB register
* @hprt0: Backup of HPTR0 register
* @hfir: Backup of HFIR register
* @hptxfsiz: Backup of HPTXFSIZ register
......@@ -738,8 +744,14 @@ struct dwc2_dregs_backup {
*/
struct dwc2_hregs_backup {
u32 hcfg;
u32 hflbaddr;
u32 haintmsk;
u32 hcchar[MAX_EPS_CHANNELS];
u32 hcsplt[MAX_EPS_CHANNELS];
u32 hcintmsk[MAX_EPS_CHANNELS];
u32 hctsiz[MAX_EPS_CHANNELS];
u32 hcidma[MAX_EPS_CHANNELS];
u32 hcidmab[MAX_EPS_CHANNELS];
u32 hprt0;
u32 hfir;
u32 hptxfsiz;
......
......@@ -5406,9 +5406,16 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
/* Backup Host regs */
hr = &hsotg->hr_backup;
hr->hcfg = dwc2_readl(hsotg, HCFG);
hr->hflbaddr = dwc2_readl(hsotg, HFLBADDR);
hr->haintmsk = dwc2_readl(hsotg, HAINTMSK);
for (i = 0; i < hsotg->params.host_channels; ++i)
for (i = 0; i < hsotg->params.host_channels; ++i) {
hr->hcchar[i] = dwc2_readl(hsotg, HCCHAR(i));
hr->hcsplt[i] = dwc2_readl(hsotg, HCSPLT(i));
hr->hcintmsk[i] = dwc2_readl(hsotg, HCINTMSK(i));
hr->hctsiz[i] = dwc2_readl(hsotg, HCTSIZ(i));
hr->hcidma[i] = dwc2_readl(hsotg, HCDMA(i));
hr->hcidmab[i] = dwc2_readl(hsotg, HCDMAB(i));
}
hr->hprt0 = dwc2_read_hprt0(hsotg);
hr->hfir = dwc2_readl(hsotg, HFIR);
......@@ -5442,10 +5449,17 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg)
hr->valid = false;
dwc2_writel(hsotg, hr->hcfg, HCFG);
dwc2_writel(hsotg, hr->hflbaddr, HFLBADDR);
dwc2_writel(hsotg, hr->haintmsk, HAINTMSK);
for (i = 0; i < hsotg->params.host_channels; ++i)
for (i = 0; i < hsotg->params.host_channels; ++i) {
dwc2_writel(hsotg, hr->hcchar[i], HCCHAR(i));
dwc2_writel(hsotg, hr->hcsplt[i], HCSPLT(i));
dwc2_writel(hsotg, hr->hcintmsk[i], HCINTMSK(i));
dwc2_writel(hsotg, hr->hctsiz[i], HCTSIZ(i));
dwc2_writel(hsotg, hr->hcidma[i], HCDMA(i));
dwc2_writel(hsotg, hr->hcidmab[i], HCDMAB(i));
}
dwc2_writel(hsotg, hr->hprt0, HPRT0);
dwc2_writel(hsotg, hr->hfir, HFIR);
......
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