]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/dwc3/core.h
Merge remote-tracking branch 'jc_docs/docs-next'
[karo-tx-linux.git] / drivers / usb / dwc3 / core.h
index c0eafa6fd40314086474f5b7cab8f63361c73d64..0447788845856e57190561b1117253200c1050a6 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
+#include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
 
 /* Global USB2 PHY Configuration Register */
 #define DWC3_GUSB2PHYCFG_PHYSOFTRST    (1 << 31)
 #define DWC3_GUSB2PHYCFG_SUSPHY                (1 << 6)
+#define DWC3_GUSB2PHYCFG_ULPI_UTMI     (1 << 4)
+
+/* Global USB2 PHY Vendor Control Register */
+#define DWC3_GUSB2PHYACC_NEWREGREQ     (1 << 25)
+#define DWC3_GUSB2PHYACC_BUSY          (1 << 23)
+#define DWC3_GUSB2PHYACC_WRITE         (1 << 22)
+#define DWC3_GUSB2PHYACC_ADDR(n)       (n << 16)
+#define DWC3_GUSB2PHYACC_EXTEND_ADDR(n)        (n << 8)
+#define DWC3_GUSB2PHYACC_DATA(n)       (n & 0xff)
 
 /* Global USB3 PIPE Control Register */
 #define DWC3_GUSB3PIPECTL_PHYSOFTRST   (1 << 31)
@@ -652,6 +662,7 @@ struct dwc3_scratchpad_array {
  * @usb3_phy: pointer to USB3 PHY
  * @usb2_generic_phy: pointer to USB2 PHY
  * @usb3_generic_phy: pointer to USB3 PHY
+ * @ulpi: pointer to ulpi interface
  * @dcfg: saved contents of DCFG register
  * @gctl: saved contents of GCTL register
  * @isoch_delay: wValue from Set Isochronous Delay request;
@@ -673,6 +684,7 @@ struct dwc3_scratchpad_array {
  * @test_mode_nr: test feature selector
  * @lpm_nyet_threshold: LPM NYET response threshold
  * @hird_threshold: HIRD threshold
+ * @hsphy_interface: "utmi" or "ulpi"
  * @delayed_status: true when gadget driver asks for delayed status
  * @ep0_bounced: true when we used bounce buffer
  * @ep0_expect_in: true when we expect a DATA IN transfer
@@ -739,6 +751,8 @@ struct dwc3 {
        struct phy              *usb2_generic_phy;
        struct phy              *usb3_generic_phy;
 
+       struct ulpi             *ulpi;
+
        void __iomem            *regs;
        size_t                  regs_size;
 
@@ -800,6 +814,8 @@ struct dwc3 {
        u8                      lpm_nyet_threshold;
        u8                      hird_threshold;
 
+       const char              *hsphy_interface;
+
        unsigned                delayed_status:1;
        unsigned                ep0_bounced:1;
        unsigned                ep0_expect_in:1;
@@ -1035,4 +1051,14 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc)
 }
 #endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
 
+#if IS_ENABLED(CONFIG_USB_DWC3_ULPI)
+int dwc3_ulpi_init(struct dwc3 *dwc);
+void dwc3_ulpi_exit(struct dwc3 *dwc);
+#else
+static inline int dwc3_ulpi_init(struct dwc3 *dwc)
+{ return 0; }
+static inline void dwc3_ulpi_exit(struct dwc3 *dwc)
+{ }
+#endif
+
 #endif /* __DRIVERS_USB_DWC3_CORE_H */