]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/dwc3/core.h
musb: Update usb-compat to work with struct usb_device without a parent ptr
[u-boot] / drivers / usb / dwc3 / core.h
index 09cec53714bce0f122b6c7e90c42c404ec5e933b..72d2fcdd3f42ff17538004d295d7d6067d73c956 100644 (file)
 #ifndef __DRIVERS_USB_DWC3_CORE_H
 #define __DRIVERS_USB_DWC3_CORE_H
 
-#include <linux/device.h>
-#include <linux/spinlock.h>
 #include <linux/ioport.h>
-#include <linux/list.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/debugfs.h>
 
 #include <linux/usb/ch9.h>
-#include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
 
-#include <linux/phy/phy.h>
-
 #define DWC3_MSG_MAX   500
 
 /* Global constants */
@@ -401,7 +392,7 @@ struct dwc3_event_buffer {
        unsigned int            count;
        unsigned int            flags;
 
-#define DWC3_EVENT_PENDING     BIT(0)
+#define DWC3_EVENT_PENDING     (1UL << 0)
 
        dma_addr_t              dma;
 
@@ -650,10 +641,6 @@ struct dwc3_scratchpad_array {
  * @maximum_speed: maximum speed requested (mainly for testing purposes)
  * @revision: revision register contents
  * @dr_mode: requested mode of operation
- * @usb2_phy: pointer to USB2 PHY
- * @usb3_phy: pointer to USB3 PHY
- * @usb2_generic_phy: pointer to USB2 PHY
- * @usb3_generic_phy: pointer to USB3 PHY
  * @dcfg: saved contents of DCFG register
  * @gctl: saved contents of GCTL register
  * @isoch_delay: wValue from Set Isochronous Delay request;
@@ -708,6 +695,8 @@ struct dwc3_scratchpad_array {
  *     1       - -3.5dB de-emphasis
  *     2       - No de-emphasis
  *     3       - Reserved
+ * @index: index of _this_ controller
+ * @list: to maintain the list of dwc3 controllers
  */
 struct dwc3 {
        struct usb_ctrlrequest  *ctrl_req;
@@ -735,12 +724,6 @@ struct dwc3 {
        struct usb_gadget       gadget;
        struct usb_gadget_driver *gadget_driver;
 
-       struct usb_phy          *usb2_phy;
-       struct usb_phy          *usb3_phy;
-
-       struct phy              *usb2_generic_phy;
-       struct phy              *usb3_generic_phy;
-
        void __iomem            *regs;
        size_t                  regs_size;
 
@@ -830,6 +813,8 @@ struct dwc3 {
 
        unsigned                tx_de_emphasis_quirk:1;
        unsigned                tx_de_emphasis:2;
+       int                     index;
+       struct list_head        list;
 };
 
 /* -------------------------------------------------------------------------- */
@@ -849,6 +834,30 @@ struct dwc3_event_type {
 #define DWC3_DEPEVT_STREAMEVT          0x06
 #define DWC3_DEPEVT_EPCMDCMPLT         0x07
 
+/**
+ * dwc3_ep_event_string - returns event name
+ * @event: then event code
+ */
+static inline const char *dwc3_ep_event_string(u8 event)
+{
+       switch (event) {
+       case DWC3_DEPEVT_XFERCOMPLETE:
+               return "Transfer Complete";
+       case DWC3_DEPEVT_XFERINPROGRESS:
+               return "Transfer In-Progress";
+       case DWC3_DEPEVT_XFERNOTREADY:
+               return "Transfer Not Ready";
+       case DWC3_DEPEVT_RXTXFIFOEVT:
+               return "FIFO";
+       case DWC3_DEPEVT_STREAMEVT:
+               return "Stream";
+       case DWC3_DEPEVT_EPCMDCMPLT:
+               return "Endpoint Command Complete";
+       }
+
+       return "UNKNOWN";
+}
+
 /**
  * struct dwc3_event_depvt - Device Endpoint Events
  * @one_bit: indicates this is an endpoint event (not used)
@@ -978,10 +987,9 @@ struct dwc3_gadget_ep_cmd_params {
 #define DWC3_HAS_OTG                   BIT(3)
 
 /* prototypes */
-void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
 
-#if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
+#ifdef CONFIG_USB_DWC3_HOST
 int dwc3_host_init(struct dwc3 *dwc);
 void dwc3_host_exit(struct dwc3 *dwc);
 #else
@@ -991,7 +999,7 @@ static inline void dwc3_host_exit(struct dwc3 *dwc)
 { }
 #endif
 
-#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
+#ifdef CONFIG_USB_DWC3_GADGET
 int dwc3_gadget_init(struct dwc3 *dwc);
 void dwc3_gadget_exit(struct dwc3 *dwc);
 int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode);
@@ -1021,20 +1029,4 @@ static inline int dwc3_send_gadget_generic_command(struct dwc3 *dwc,
 { return 0; }
 #endif
 
-/* power management interface */
-#if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
-int dwc3_gadget_suspend(struct dwc3 *dwc);
-int dwc3_gadget_resume(struct dwc3 *dwc);
-#else
-static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
-{
-       return 0;
-}
-
-static inline int dwc3_gadget_resume(struct dwc3 *dwc)
-{
-       return 0;
-}
-#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
-
 #endif /* __DRIVERS_USB_DWC3_CORE_H */