]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc3: ulpi: Fix USB2.0 HS/FS/LS PHY suspend regression
authorBaikal Electronics <support@baikalelectronics.ru>
Thu, 10 Dec 2020 08:50:08 +0000 (11:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Dec 2020 14:55:44 +0000 (15:55 +0100)
commitc7aa49d161c7403d8292175e5f34472c2336c49f
treef25a38e9c7880a694fec9728628132e62c6c862f
parent5d00a33d0902e61b2aeca1ef49495058f1135595
usb: dwc3: ulpi: Fix USB2.0 HS/FS/LS PHY suspend regression

First of all the commit e26fbb298e34 ("usb: dwc3: ulpi: conditionally
resume ULPI PHY") introduced the Suspend USB2.0 HS/FS/LS PHY regression,
as by design of the fix any attempt to read/write from/to the PHY control
registers will completely disable the PHY suspension, which consequently
will increase the USB bus power consumption. Secondly the fix won't work
well for the very first attempt of the ULPI PHY control registers IO,
because after disabling the USB2.0 PHY suspension functionality it will
still take some time for the bus to resume from the sleep state if one has
been reached before it. So the very first PHY register read/write
operation will take more time than the busy-loop provides and the IO
timeout error might be returned anyway.

Here we suggest to fix the denoted problems in the following way. First of
all let's not disable the Suspend USB2.0 HS/FS/LS PHY functionality so to
make the controller and the USB2.0 bus more power efficient. Secondly
instead of that we'll extend the PHY IO op wait procedure with 1 - 1.2 ms
sleep if the PHY suspension is enabled (1ms should be enough as by LPM
specification it is at most how long it takes for the USB2.0 bus to resume
from L1 (Sleep) state). Finally in case if the USB2.0 PHY suspension
functionality has been disabled on the DWC USB3 controller setup procedure
we'll compensate the USB bus resume process latency by extending the
busy-loop attempts counter.

Fixes: e26fbb298e34 ("usb: dwc3: ulpi: conditionally resume ULPI PHY")
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201210085008.13264-4-Sergey.Semin@baikalelectronics.ru
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/ulpi.c