upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / usb / host / s3c-otg / s3c-otg-hcdi-hcd.h
1 /****************************************************************************
2  *  (C) Copyright 2008 Samsung Electronics Co., Ltd., All rights reserved
3  *
4  * @file   s3c-otg-hcdi-hcd.h
5  * @brief  header of s3c-otg-hcdi-hcd \n
6  * @version
7  *  -# Jun 9,2008 v1.0 by SeungSoo Yang (ss1.yang@samsung.com) \n
8  *        : Creating the initial version of this code \n
9  *  -# Jul 15,2008 v1.2 by SeungSoo Yang (ss1.yang@samsung.com) \n
10  *        : Optimizing for performance \n
11  *  -# Aug 18,2008 v1.3 by SeungSoo Yang (ss1.yang@samsung.com) \n
12  *        : Modifying for successful rmmod & disconnecting \n
13  * @see None
14  ****************************************************************************/
15 /****************************************************************************
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29  ****************************************************************************/
30
31 #ifndef _S3C_OTG_HCDI_HCD_H_
32 #define _S3C_OTG_HCDI_HCD_H_
33
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38
39 //for IRQ_NONE (0) IRQ_HANDLED (1) IRQ_RETVAL(x)        ((x) != 0)
40 #include <linux/interrupt.h>
41
42 #include <linux/usb.h>
43
44 #include "s3c-otg-hcdi-debug.h"
45 #include "s3c-otg-hcdi-kal.h"
46
47 #include "s3c-otg-common-common.h"
48 #include "s3c-otg-common-datastruct.h"
49 #include "s3c-otg-common-const.h"
50
51 #include "s3c-otg-transfer-transfer.h"
52 #include "s3c-otg-oci.h"
53 #include "s3c-otg-roothub.h"
54
55 //placed in ISR
56 //void  otg_handle_interrupt(struct usb_hcd *hcd);
57
58 irqreturn_t     s5pc110_otghcd_irq(struct usb_hcd *hcd);
59
60 int     s5pc110_otghcd_start(struct usb_hcd *hcd);
61 void    s5pc110_otghcd_stop(struct usb_hcd *hcd);
62 void    s5pc110_otghcd_shutdown(struct usb_hcd *hcd);
63
64 int     s5pc110_otghcd_get_frame_number(struct usb_hcd *hcd);
65
66 int     s5pc110_otghcd_urb_enqueue(
67                         struct usb_hcd *hcd,
68                         struct urb *urb,
69                         gfp_t mem_flags);
70
71 int     s5pc110_otghcd_urb_dequeue(
72                         struct usb_hcd *_hcd,
73                         struct urb *_urb,
74                         int status);
75
76 void    s5pc110_otghcd_endpoint_disable(
77                         struct usb_hcd *hcd,
78                         struct usb_host_endpoint *ep);
79
80 int     s5pc110_otghcd_hub_status_data(
81                         struct usb_hcd *_hcd,
82                         char *_buf);
83
84 int     s5pc110_otghcd_hub_control(
85                         struct usb_hcd *hcd,
86                         u16     type_req,
87                         u16     value,
88                         u16     index,
89                         char *  buf,
90                         u16     length);
91
92 int     s5pc110_otghcd_bus_suspend(struct usb_hcd *hcd);
93 int     s5pc110_otghcd_bus_resume(struct usb_hcd *hcd);
94 int     s5pc110_otghcd_start_port_reset(struct usb_hcd *hcd, unsigned port);
95
96 /**
97  * @struct hc_driver s5pc110_otg_hc_driver
98  *
99  * @brief implementation of hc_driver for OTG HCD
100  *
101  * describe in detail
102  */
103 static const struct hc_driver s5pc110_otg_hc_driver = {
104         .description            =       "EMSP_OTGHCD",
105         .product_desc           =       "S3C OTGHCD",
106         .hcd_priv_size          =       sizeof(struct sec_otghost),
107
108         .irq                    =       s5pc110_otghcd_irq,
109         .flags                  =       HCD_MEMORY | HCD_USB2,
110
111         /** basic lifecycle operations   */
112         //.reset =
113         .start                  =       s5pc110_otghcd_start,
114         //.suspend              =       ,
115         //.resume               =       ,
116         .stop                   =       s5pc110_otghcd_stop,
117         .shutdown               =       s5pc110_otghcd_shutdown,
118
119         /** managing i/o requests and associated device resources        */
120         .urb_enqueue            =       s5pc110_otghcd_urb_enqueue,
121         .urb_dequeue            =       s5pc110_otghcd_urb_dequeue,
122         .endpoint_disable       =       s5pc110_otghcd_endpoint_disable,
123
124         /** scheduling support   */
125         .get_frame_number       =       s5pc110_otghcd_get_frame_number,
126
127         /** root hub support     */
128         .hub_status_data        =       s5pc110_otghcd_hub_status_data,
129         .hub_control            =       s5pc110_otghcd_hub_control,
130         //.hub_irq_enable =
131         .bus_suspend            =       s5pc110_otghcd_bus_suspend,
132         .bus_resume             =       s5pc110_otghcd_bus_resume,
133         .start_port_reset       =       s5pc110_otghcd_start_port_reset,
134 };
135
136 static inline struct sec_otghost *hcd_to_sec_otghost (struct usb_hcd *hcd)
137 {
138         return (struct sec_otghost *) (hcd->hcd_priv);
139 }
140 static inline struct usb_hcd *sec_otghost_to_hcd (struct sec_otghost *otghost)
141 {
142         return container_of ((void *) otghost, struct usb_hcd, hcd_priv);
143 }
144
145 int otg_hcd_init_modules(struct sec_otghost *otghost);
146 void otg_hcd_deinit_modules(struct sec_otghost *otghost);
147
148 #ifdef __cplusplus
149 }
150 #endif
151 #endif /* _S3C_OTG_HCDI_HCD_H_ */
152