This source file includes following definitions.
- first_qh
- hcd_to_musb
- musb_h_ep0_irq
- musb_host_alloc
- musb_host_setup
- musb_host_cleanup
- musb_host_free
- musb_host_tx
- musb_host_rx
- musb_root_disconnect
- musb_host_resume_root_hub
- musb_host_poll_rh_status
- musb_host_poke_root_hub
- musb_port_suspend
- musb_port_reset
- musb_host_finish_resume
- next_urb
1
2
3
4
5
6
7
8
9
10 #ifndef _MUSB_HOST_H
11 #define _MUSB_HOST_H
12
13 #include <linux/scatterlist.h>
14
15
16 struct musb_qh {
17 struct usb_host_endpoint *hep;
18 struct usb_device *dev;
19 struct musb_hw_ep *hw_ep;
20
21 struct list_head ring;
22
23 u8 mux;
24
25 unsigned offset;
26 unsigned segsize;
27
28 u8 type_reg;
29 u8 intv_reg;
30 u8 addr_reg;
31 u8 h_addr_reg;
32 u8 h_port_reg;
33
34 u8 is_ready;
35 u8 type;
36 u8 epnum;
37 u8 hb_mult;
38 u16 maxpacket;
39 u16 frame;
40 unsigned iso_idx;
41 struct sg_mapping_iter sg_miter;
42 bool use_sg;
43 };
44
45
46 static inline struct musb_qh *first_qh(struct list_head *q)
47 {
48 if (list_empty(q))
49 return NULL;
50 return list_entry(q->next, struct musb_qh, ring);
51 }
52
53
54 #if IS_ENABLED(CONFIG_USB_MUSB_HOST) || IS_ENABLED(CONFIG_USB_MUSB_DUAL_ROLE)
55 extern struct musb *hcd_to_musb(struct usb_hcd *);
56 extern irqreturn_t musb_h_ep0_irq(struct musb *);
57 extern int musb_host_alloc(struct musb *);
58 extern int musb_host_setup(struct musb *, int);
59 extern void musb_host_cleanup(struct musb *);
60 extern void musb_host_tx(struct musb *, u8);
61 extern void musb_host_rx(struct musb *, u8);
62 extern void musb_root_disconnect(struct musb *musb);
63 extern void musb_host_free(struct musb *);
64 extern void musb_host_cleanup(struct musb *);
65 extern void musb_host_tx(struct musb *, u8);
66 extern void musb_host_rx(struct musb *, u8);
67 extern void musb_root_disconnect(struct musb *musb);
68 extern void musb_host_resume_root_hub(struct musb *musb);
69 extern void musb_host_poke_root_hub(struct musb *musb);
70 extern int musb_port_suspend(struct musb *musb, bool do_suspend);
71 extern void musb_port_reset(struct musb *musb, bool do_reset);
72 extern void musb_host_finish_resume(struct work_struct *work);
73 #else
74 static inline struct musb *hcd_to_musb(struct usb_hcd *hcd)
75 {
76 return NULL;
77 }
78
79 static inline irqreturn_t musb_h_ep0_irq(struct musb *musb)
80 {
81 return 0;
82 }
83
84 static inline int musb_host_alloc(struct musb *musb)
85 {
86 return 0;
87 }
88
89 static inline int musb_host_setup(struct musb *musb, int power_budget)
90 {
91 return 0;
92 }
93
94 static inline void musb_host_cleanup(struct musb *musb) {}
95 static inline void musb_host_free(struct musb *musb) {}
96 static inline void musb_host_tx(struct musb *musb, u8 epnum) {}
97 static inline void musb_host_rx(struct musb *musb, u8 epnum) {}
98 static inline void musb_root_disconnect(struct musb *musb) {}
99 static inline void musb_host_resume_root_hub(struct musb *musb) {}
100 static inline void musb_host_poll_rh_status(struct musb *musb) {}
101 static inline void musb_host_poke_root_hub(struct musb *musb) {}
102 static inline int musb_port_suspend(struct musb *musb, bool do_suspend)
103 {
104 return 0;
105 }
106 static inline void musb_port_reset(struct musb *musb, bool do_reset) {}
107 static inline void musb_host_finish_resume(struct work_struct *work) {}
108 #endif
109
110 struct usb_hcd;
111
112 extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf);
113 extern int musb_hub_control(struct usb_hcd *hcd,
114 u16 typeReq, u16 wValue, u16 wIndex,
115 char *buf, u16 wLength);
116
117 static inline struct urb *next_urb(struct musb_qh *qh)
118 {
119 struct list_head *queue;
120
121 if (!qh)
122 return NULL;
123 queue = &qh->hep->urb_list;
124 if (list_empty(queue))
125 return NULL;
126 return list_entry(queue->next, struct urb, urb_list);
127 }
128
129 #endif