usb: dwc2: Fix the write to W1C fields in HPRT register
authorTeik Heng Chong <teik.heng.chong@intel.com>
Wed, 21 Jun 2023 03:13:58 +0000 (11:13 +0800)
committerMarek Vasut <marex@denx.de>
Wed, 21 Jun 2023 11:15:58 +0000 (13:15 +0200)
commit9c9454ac2e4ffd9a8b30744329029f1676d2e7be
treecf8e2042b7ff8b7d9f3b80dc901a1dbed8f03642
parent7a875a8e5c7af1d7c1c7232fbef898d0f18ec7da
usb: dwc2: Fix the write to W1C fields in HPRT register

Fix the write to the HPRT register which treat W1C fields
as if they were mere RW. This leads to unintended clearing of such fields

This bug was found during the testing on Simics model. Referring to
specification DesignWare Cores USB 2.0 Hi-Speed On-The-Go (OTG)
Databook (3.30a)"5.3.4.8 Host Port Control and Status Register (HPRT)", the
HPRT.PrtPwr is cleared by this mistake. In the Linux driver (contrary to
U-Boot), HPRT is always read using dwc2_read_hprt0 helper function which
clears W1C bits. So after write back those bits are zeroes.

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
drivers/usb/host/dwc2.c
drivers/usb/host/dwc2.h