Commit 5799aecd authored by Minas Harutyunyan's avatar Minas Harutyunyan Committed by Felipe Balbi

usb: dwc2: Fix channel disable flow

Channel disabling/halting should performed for enabled only channels
to avoid warnings "Unable to clear enable on channel N" which seen
if host works in Slave mode.
Signed-off-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent c8006f67
...@@ -2247,25 +2247,31 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) ...@@ -2247,25 +2247,31 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
num_channels = hsotg->params.host_channels; num_channels = hsotg->params.host_channels;
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
hcchar = dwc2_readl(hsotg, HCCHAR(i)); hcchar = dwc2_readl(hsotg, HCCHAR(i));
hcchar &= ~HCCHAR_CHENA; if (hcchar & HCCHAR_CHENA) {
hcchar |= HCCHAR_CHDIS; hcchar &= ~HCCHAR_CHENA;
hcchar &= ~HCCHAR_EPDIR; hcchar |= HCCHAR_CHDIS;
dwc2_writel(hsotg, hcchar, HCCHAR(i)); hcchar &= ~HCCHAR_EPDIR;
dwc2_writel(hsotg, hcchar, HCCHAR(i));
}
} }
/* Halt all channels to put them into a known state */ /* Halt all channels to put them into a known state */
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
hcchar = dwc2_readl(hsotg, HCCHAR(i)); hcchar = dwc2_readl(hsotg, HCCHAR(i));
hcchar |= HCCHAR_CHENA | HCCHAR_CHDIS; if (hcchar & HCCHAR_CHENA) {
hcchar &= ~HCCHAR_EPDIR; hcchar |= HCCHAR_CHENA | HCCHAR_CHDIS;
dwc2_writel(hsotg, hcchar, HCCHAR(i)); hcchar &= ~HCCHAR_EPDIR;
dev_dbg(hsotg->dev, "%s: Halt channel %d\n", dwc2_writel(hsotg, hcchar, HCCHAR(i));
__func__, i); dev_dbg(hsotg->dev, "%s: Halt channel %d\n",
__func__, i);
if (dwc2_hsotg_wait_bit_clear(hsotg, HCCHAR(i),
HCCHAR_CHENA, 1000)) { if (dwc2_hsotg_wait_bit_clear(hsotg, HCCHAR(i),
dev_warn(hsotg->dev, "Unable to clear enable on channel %d\n", HCCHAR_CHENA,
i); 1000)) {
dev_warn(hsotg->dev,
"Unable to clear enable on channel %d\n",
i);
}
} }
} }
} }
......
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