usb: dwc2: Update bit polling functionality
Move dwc2_hsotg_wait_bit_set function to core.c so it can be used anywhere in the code. Added dwc2_hsotg_wait_bit_clear function in core.c. Replace all the parts of register bit polling code with dwc2_hsotg_wait_bit_set or dwc2_hsotg_wait_bit_clear functions calls depends on code logic. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Sevak Arakelyan <sevaka@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Этот коммит содержится в:

коммит произвёл
Felipe Balbi

родитель
d14ccaba8d
Коммит
79d6b8c51c
@@ -2403,24 +2403,18 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
|
||||
|
||||
/* Halt all channels to put them into a known state */
|
||||
for (i = 0; i < num_channels; i++) {
|
||||
int count = 0;
|
||||
|
||||
hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
|
||||
hcchar |= HCCHAR_CHENA | HCCHAR_CHDIS;
|
||||
hcchar &= ~HCCHAR_EPDIR;
|
||||
dwc2_writel(hcchar, hsotg->regs + HCCHAR(i));
|
||||
dev_dbg(hsotg->dev, "%s: Halt channel %d\n",
|
||||
__func__, i);
|
||||
do {
|
||||
hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
|
||||
if (++count > 1000) {
|
||||
dev_err(hsotg->dev,
|
||||
"Unable to clear enable on channel %d\n",
|
||||
i);
|
||||
break;
|
||||
}
|
||||
udelay(1);
|
||||
} while (hcchar & HCCHAR_CHENA);
|
||||
|
||||
if (dwc2_hsotg_wait_bit_clear(hsotg, HCCHAR(i),
|
||||
HCCHAR_CHENA, 1000)) {
|
||||
dev_warn(hsotg->dev, "Unable to clear enable on channel %d\n",
|
||||
i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Ссылка в новой задаче
Block a user