summaryrefslogtreecommitdiff
path: root/drivers/usb/host/dwc2.h
diff options
context:
space:
mode:
authorTeik Heng Chong <teik.heng.chong@intel.com>2023-06-21 11:13:58 +0800
committerMarek Vasut <marex@denx.de>2023-06-21 13:15:58 +0200
commit9c9454ac2e4ffd9a8b30744329029f1676d2e7be (patch)
treecf8e2042b7ff8b7d9f3b80dc901a1dbed8f03642 /drivers/usb/host/dwc2.h
parent7a875a8e5c7af1d7c1c7232fbef898d0f18ec7da (diff)
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>
Diffstat (limited to 'drivers/usb/host/dwc2.h')
-rw-r--r--drivers/usb/host/dwc2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/dwc2.h b/drivers/usb/host/dwc2.h
index a6f562fe60e..6f022e33a19 100644
--- a/drivers/usb/host/dwc2.h
+++ b/drivers/usb/host/dwc2.h
@@ -543,6 +543,10 @@ struct dwc2_core_regs {
#define DWC2_HPRT0_PRTSPD_LOW (2 << 17)
#define DWC2_HPRT0_PRTSPD_MASK (0x3 << 17)
#define DWC2_HPRT0_PRTSPD_OFFSET 17
+#define DWC2_HPRT0_W1C_MASK (DWC2_HPRT0_PRTCONNDET | \
+ DWC2_HPRT0_PRTENA | \
+ DWC2_HPRT0_PRTENCHNG | \
+ DWC2_HPRT0_PRTOVRCURRCHNG)
#define DWC2_HAINT_CH0 (1 << 0)
#define DWC2_HAINT_CH0_OFFSET 0
#define DWC2_HAINT_CH1 (1 << 1)