aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/ci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/chipidea/ci.h')
-rw-r--r--drivers/usb/chipidea/ci.h156
1 files changed, 103 insertions, 53 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 0f226b0d4761..0ab83411d800 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -27,25 +27,38 @@
27/****************************************************************************** 27/******************************************************************************
28 * STRUCTURES 28 * STRUCTURES
29 *****************************************************************************/ 29 *****************************************************************************/
30/* Extension of usb_ep */ 30/**
31 * struct ci13xxx_ep - endpoint representation
32 * @ep: endpoint structure for gadget drivers
33 * @dir: endpoint direction (TX/RX)
34 * @num: endpoint number
35 * @type: endpoint type
36 * @name: string description of the endpoint
37 * @qh: queue head for this endpoint
38 * @wedge: is the endpoint wedged
39 * @udc: pointer to the controller
40 * @lock: pointer to controller's spinlock
41 * @device: pointer to gadget's struct device
42 * @td_pool: pointer to controller's TD pool
43 */
31struct ci13xxx_ep { 44struct ci13xxx_ep {
32 struct usb_ep ep; 45 struct usb_ep ep;
33 u8 dir; 46 u8 dir;
34 u8 num; 47 u8 num;
35 u8 type; 48 u8 type;
36 char name[16]; 49 char name[16];
37 struct { 50 struct {
38 struct list_head queue; 51 struct list_head queue;
39 struct ci13xxx_qh *ptr; 52 struct ci13xxx_qh *ptr;
40 dma_addr_t dma; 53 dma_addr_t dma;
41 } qh; 54 } qh;
42 int wedge; 55 int wedge;
43 56
44 /* global resources */ 57 /* global resources */
45 struct ci13xxx *udc; 58 struct ci13xxx *udc;
46 spinlock_t *lock; 59 spinlock_t *lock;
47 struct device *device; 60 struct device *device;
48 struct dma_pool *td_pool; 61 struct dma_pool *td_pool;
49}; 62};
50 63
51enum ci_role { 64enum ci_role {
@@ -68,48 +81,85 @@ struct ci_role_driver {
68 const char *name; 81 const char *name;
69}; 82};
70 83
84/**
85 * struct hw_bank - hardware register mapping representation
86 * @lpm: set if the device is LPM capable
87 * @abs: absolute address of the beginning of register window
88 * @cap: capability registers
89 * @op: operational registers
90 * @size: size of the register window
91 * @regmap: register lookup table
92 */
71struct hw_bank { 93struct hw_bank {
72 unsigned lpm; /* is LPM? */ 94 unsigned lpm;
73 void __iomem *abs; /* bus map offset */ 95 void __iomem *abs;
74 void __iomem *cap; /* bus map offset + CAP offset */ 96 void __iomem *cap;
75 void __iomem *op; /* bus map offset + OP offset */ 97 void __iomem *op;
76 size_t size; /* bank size */ 98 size_t size;
77 void __iomem **regmap; 99 void __iomem **regmap;
78}; 100};
79 101
80/* CI13XXX UDC descriptor & global resources */ 102/**
103 * struct ci13xxx - chipidea device representation
104 * @dev: pointer to parent device
105 * @lock: access synchronization
106 * @hw_bank: hardware register mapping
107 * @irq: IRQ number
108 * @roles: array of supported roles for this controller
109 * @role: current role
110 * @is_otg: if the device is otg-capable
111 * @work: work for role changing
112 * @wq: workqueue thread
113 * @qh_pool: allocation pool for queue heads
114 * @td_pool: allocation pool for transfer descriptors
115 * @gadget: device side representation for peripheral controller
116 * @driver: gadget driver
117 * @hw_ep_max: total number of endpoints supported by hardware
118 * @ci13xxx_ep: array of endpoints
119 * @ep0_dir: ep0 direction
120 * @ep0out: pointer to ep0 OUT endpoint
121 * @ep0in: pointer to ep0 IN endpoint
122 * @status: ep0 status request
123 * @setaddr: if we should set the address on status completion
124 * @address: usb address received from the host
125 * @remote_wakeup: host-enabled remote wakeup
126 * @suspended: suspended by host
127 * @test_mode: the selected test mode
128 * @udc_driver: platform specific information supplied by parent device
129 * @vbus_active: is VBUS active
130 * @transceiver: pointer to USB PHY, if any
131 */
81struct ci13xxx { 132struct ci13xxx {
82 spinlock_t lock; /* ctrl register bank access */ 133 struct device *dev;
83 134 spinlock_t lock;
84 struct dma_pool *qh_pool; /* DMA pool for queue heads */ 135 struct hw_bank hw_bank;
85 struct dma_pool *td_pool; /* DMA pool for transfer descs */ 136 int irq;
86 struct usb_request *status; /* ep0 status request */ 137 struct ci_role_driver *roles[CI_ROLE_END];
87 138 enum ci_role role;
88 struct device *dev; 139 bool is_otg;
89 struct usb_gadget gadget; /* USB slave device */ 140 struct work_struct work;
90 struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */ 141 struct workqueue_struct *wq;
91 u32 ep0_dir; /* ep0 direction */ 142
92 struct ci13xxx_ep *ep0out, *ep0in; 143 struct dma_pool *qh_pool;
93 unsigned hw_ep_max; /* number of hw endpoints */ 144 struct dma_pool *td_pool;
94 145
95 bool setaddr; 146 struct usb_gadget gadget;
96 u8 address; 147 struct usb_gadget_driver *driver;
97 u8 remote_wakeup; /* Is remote wakeup feature 148 unsigned hw_ep_max;
98 enabled by the host? */ 149 struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX];
99 u8 suspended; /* suspended by the host */ 150 u32 ep0_dir;
100 u8 test_mode; /* the selected test mode */ 151 struct ci13xxx_ep *ep0out, *ep0in;
101 152
102 struct hw_bank hw_bank; 153 struct usb_request *status;
103 int irq; 154 bool setaddr;
104 struct usb_gadget_driver *driver; /* 3rd party gadget driver */ 155 u8 address;
105 struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ 156 u8 remote_wakeup;
106 int vbus_active; /* is VBUS active */ 157 u8 suspended;
107 struct usb_phy *transceiver; /* Transceiver struct */ 158 u8 test_mode;
108 struct ci_role_driver *roles[CI_ROLE_END]; 159
109 enum ci_role role; 160 struct ci13xxx_udc_driver *udc_driver;
110 bool is_otg; 161 int vbus_active;
111 struct work_struct work; 162 struct usb_phy *transceiver;
112 struct workqueue_struct *wq;
113}; 163};
114 164
115static inline struct ci_role_driver *ci_role(struct ci13xxx *ci) 165static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)