usb: dwc3: Fix core validation in probe, move after clocks are enabled
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Thu, 13 Jun 2019 15:01:07 +0000 (17:01 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 18 Jun 2019 08:58:29 +0000 (11:58 +0300)
commitdc1b5d9aed1794b5a1c6b0da46e372cc09974cbc
tree9ace2f3edb8cb7f320c58b2cc5d74fc93cc9c26d
parent7f5d6a4696170ca7394d9dcecd5a54ebe2b9a067
usb: dwc3: Fix core validation in probe, move after clocks are enabled

The required clocks needs to be enabled before the first register
access. After commit fe8abf332b8f ("usb: dwc3: support clocks and resets
for DWC3 core"), this happens when the dwc3_core_is_valid function is
called, but the mentioned commit adds that call in the wrong place,
before the clocks are enabled. So, move that call after the
clk_bulk_enable() to ensure the clocks are enabled and the reset
deasserted.

I detected this while, as experiment, I tried to move the clocks and resets
from the glue layer to the DWC3 core on a Samsung Chromebook Plus.

That was not detected before because, in most cases, the glue layer
initializes SoC-specific things and then populates the child "snps,dwc3"
with those clocks already enabled.

Fixes: b873e2d0ea1ef ("usb: dwc3: Do core validation early on probe")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.c