diff options
Diffstat (limited to 'drivers/usb/musb/musb_host.h')
-rw-r--r-- | drivers/usb/musb/musb_host.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h new file mode 100644 index 000000000000..77bcdb9d5b32 --- /dev/null +++ b/drivers/usb/musb/musb_host.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * MUSB OTG driver host defines | ||
3 | * | ||
4 | * Copyright 2005 Mentor Graphics Corporation | ||
5 | * Copyright (C) 2005-2006 by Texas Instruments | ||
6 | * Copyright (C) 2006-2007 Nokia Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED | ||
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
25 | * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
28 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
29 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #ifndef _MUSB_HOST_H | ||
36 | #define _MUSB_HOST_H | ||
37 | |||
38 | static inline struct usb_hcd *musb_to_hcd(struct musb *musb) | ||
39 | { | ||
40 | return container_of((void *) musb, struct usb_hcd, hcd_priv); | ||
41 | } | ||
42 | |||
43 | static inline struct musb *hcd_to_musb(struct usb_hcd *hcd) | ||
44 | { | ||
45 | return (struct musb *) (hcd->hcd_priv); | ||
46 | } | ||
47 | |||
48 | /* stored in "usb_host_endpoint.hcpriv" for scheduled endpoints */ | ||
49 | struct musb_qh { | ||
50 | struct usb_host_endpoint *hep; /* usbcore info */ | ||
51 | struct usb_device *dev; | ||
52 | struct musb_hw_ep *hw_ep; /* current binding */ | ||
53 | |||
54 | struct list_head ring; /* of musb_qh */ | ||
55 | /* struct musb_qh *next; */ /* for periodic tree */ | ||
56 | |||
57 | unsigned offset; /* in urb->transfer_buffer */ | ||
58 | unsigned segsize; /* current xfer fragment */ | ||
59 | |||
60 | u8 type_reg; /* {rx,tx} type register */ | ||
61 | u8 intv_reg; /* {rx,tx} interval register */ | ||
62 | u8 addr_reg; /* device address register */ | ||
63 | u8 h_addr_reg; /* hub address register */ | ||
64 | u8 h_port_reg; /* hub port register */ | ||
65 | |||
66 | u8 is_ready; /* safe to modify hw_ep */ | ||
67 | u8 type; /* XFERTYPE_* */ | ||
68 | u8 epnum; | ||
69 | u16 maxpacket; | ||
70 | u16 frame; /* for periodic schedule */ | ||
71 | unsigned iso_idx; /* in urb->iso_frame_desc[] */ | ||
72 | }; | ||
73 | |||
74 | /* map from control or bulk queue head to the first qh on that ring */ | ||
75 | static inline struct musb_qh *first_qh(struct list_head *q) | ||
76 | { | ||
77 | if (list_empty(q)) | ||
78 | return NULL; | ||
79 | return list_entry(q->next, struct musb_qh, ring); | ||
80 | } | ||
81 | |||
82 | |||
83 | extern void musb_root_disconnect(struct musb *musb); | ||
84 | |||
85 | struct usb_hcd; | ||
86 | |||
87 | extern int musb_hub_status_data(struct usb_hcd *hcd, char *buf); | ||
88 | extern int musb_hub_control(struct usb_hcd *hcd, | ||
89 | u16 typeReq, u16 wValue, u16 wIndex, | ||
90 | char *buf, u16 wLength); | ||
91 | |||
92 | extern const struct hc_driver musb_hc_driver; | ||
93 | |||
94 | static inline struct urb *next_urb(struct musb_qh *qh) | ||
95 | { | ||
96 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
97 | struct list_head *queue; | ||
98 | |||
99 | if (!qh) | ||
100 | return NULL; | ||
101 | queue = &qh->hep->urb_list; | ||
102 | if (list_empty(queue)) | ||
103 | return NULL; | ||
104 | return list_entry(queue->next, struct urb, urb_list); | ||
105 | #else | ||
106 | return NULL; | ||
107 | #endif | ||
108 | } | ||
109 | |||
110 | #endif /* _MUSB_HOST_H */ | ||