--- zzzz-none-000/linux-4.4.271/drivers/usb/dwc3/core.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/drivers/usb/dwc3/core.h 2023-04-19 10:22:29.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -105,6 +106,7 @@ #define DWC3_GPRTBIMAP_HS1 0xc184 #define DWC3_GPRTBIMAP_FS0 0xc188 #define DWC3_GPRTBIMAP_FS1 0xc18c +#define DWC3_GUCTL2 0xc19c #define DWC3_VER_NUMBER 0xc1a0 #define DWC3_VER_TYPE 0xc1a4 @@ -125,6 +127,7 @@ #define DWC3_GEVNTCOUNT(n) (0xc40c + (n * 0x10)) #define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GUCTL 0xc12c #define DWC3_GFLADJ 0xc630 /* Device Registers */ @@ -172,6 +175,7 @@ #define DWC3_GCTL_U2EXIT_LFPS (1 << 2) #define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1) #define DWC3_GCTL_DSBLCLKGTNG (1 << 0) +#define DWC3_GCTL2_ENABLEEPCACHEEVICT (1 << 12) /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) @@ -239,9 +243,18 @@ /* Global HWPARAMS6 Register */ #define DWC3_GHWPARAMS6_EN_FPGA (1 << 7) +/* Global User Control Register*/ +#define DWC3_GUCTL_REFCLKPER_MASK 0xffc00000 +#define DWC3_GUCTL_REFCLKPER_SEL 22 + +/* Global reference clock Adjustment Register */ +#define DWC3_GFLADJ_REFCLK_MASK 0xffffff00 +#define DWC3_GFLADJ_REFCLK_SEL 8 + /* Global Frame Length Adjustment Register */ #define DWC3_GFLADJ_30MHZ_SDBND_SEL (1 << 7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f +#define DWC3_GFLADJ_30MHZ_SDBND_SEL_MASK 0x80 /* Device Configuration Register */ #define DWC3_DCFG_DEVADDR(addr) ((addr) << 3) @@ -642,6 +655,20 @@ __le64 dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS]; }; +#define DWC3_CONTROLLER_ERROR_EVENT 0 +#define DWC3_CONTROLLER_RESET_EVENT 1 +#define DWC3_CONTROLLER_POST_RESET_EVENT 2 +#define DWC3_CORE_PM_PREPARE_EVENT 3 +#define DWC3_CORE_PM_COMPLETE_EVENT 4 +#define DWC3_CORE_PM_SUSPEND_EVENT 5 +#define DWC3_CORE_PM_RESUME_EVENT 6 +#define DWC3_CONTROLLER_POST_INITIALIZATION_EVENT 7 +#define DWC3_CONTROLLER_CONNDONE_EVENT 8 +#define DWC3_CONTROLLER_NOTIFY_OTG_EVENT 9 +#define DWC3_CONTROLLER_SET_CURRENT_DRAW_EVENT 10 +#define DWC3_CONTROLLER_RESTART_USB_SESSION 11 + +#define MAX_INTR_STATS 10 /** * struct dwc3 - representation of our controller * @ctrl_req: usb control request which is used for ep0 @@ -729,6 +756,10 @@ * 1 - -3.5dB de-emphasis * 2 - No de-emphasis * 3 - Reserved + * @is_drd: device supports dual-role or not + * @vbus_active: Indicate if the gadget was powered by the otg driver + * @soft_connect: Indicate if software connect was issued + * by the usb_gadget_driver */ struct dwc3 { struct usb_ctrlrequest *ctrl_req; @@ -806,6 +837,8 @@ #define DWC3_REVISION_260A 0x5533260a #define DWC3_REVISION_270A 0x5533270a #define DWC3_REVISION_280A 0x5533280a +#define DWC3_REVISION_300A 0x5533300a + /* * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really @@ -842,6 +875,9 @@ const char *hsphy_interface; + /* emulation targets specific */ + bool emulation; + unsigned delayed_status:1; unsigned ep0_bounced:1; unsigned ep0_expect_in:1; @@ -867,9 +903,22 @@ unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; unsigned dis_enblslpm_quirk:1; + unsigned usb3_dev_reset_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; + atomic_t in_lpm; + + unsigned enable_usb2susphy_quirk:1; + struct usb_susphy susphy; + + unsigned enable_usb2_host_discon_quirk:1; + u32 phy_misc_reg; + u32 phy_host_disc_on; + unsigned is_drd:1; + unsigned vbus_active:1; + unsigned softconnect:1; + unsigned disable_ep_cache_eviction_quirk:1; }; /* -------------------------------------------------------------------------- */ @@ -1087,4 +1136,6 @@ { } #endif +int dwc3_event_buffers_setup(struct dwc3 *dwc); + #endif /* __DRIVERS_USB_DWC3_CORE_H */