1
2
3
4
5
6
7
8
9
10 #ifndef _S3C2410_UDC_H
11 #define _S3C2410_UDC_H
12
13 struct s3c2410_ep {
14 struct list_head queue;
15 unsigned long last_io;
16 struct usb_gadget *gadget;
17 struct s3c2410_udc *dev;
18 struct usb_ep ep;
19 u8 num;
20
21 unsigned short fifo_size;
22 u8 bEndpointAddress;
23 u8 bmAttributes;
24
25 unsigned halted : 1;
26 unsigned already_seen : 1;
27 unsigned setup_stage : 1;
28 };
29
30
31
32
33
34
35 #define EP0_FIFO_SIZE 8
36 #define EP_FIFO_SIZE 64
37 #define DEFAULT_POWER_STATE 0x00
38
39 #define S3C2440_EP_FIFO_SIZE 128
40
41 static const char ep0name [] = "ep0";
42
43 static const char *const ep_name[] = {
44 ep0name,
45
46 "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
47 };
48
49 #define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name)
50
51 struct s3c2410_request {
52 struct list_head queue;
53 struct usb_request req;
54 };
55
56 enum ep0_state {
57 EP0_IDLE,
58 EP0_IN_DATA_PHASE,
59 EP0_OUT_DATA_PHASE,
60 EP0_END_XFER,
61 EP0_STALL,
62 };
63
64 static const char *ep0states[]= {
65 "EP0_IDLE",
66 "EP0_IN_DATA_PHASE",
67 "EP0_OUT_DATA_PHASE",
68 "EP0_END_XFER",
69 "EP0_STALL",
70 };
71
72 struct s3c2410_udc {
73 spinlock_t lock;
74
75 struct s3c2410_ep ep[S3C2410_ENDPOINTS];
76 int address;
77 struct usb_gadget gadget;
78 struct usb_gadget_driver *driver;
79 struct s3c2410_request fifo_req;
80 u8 fifo_buf[EP_FIFO_SIZE];
81 u16 devstatus;
82
83 u32 port_status;
84 int ep0state;
85
86 unsigned got_irq : 1;
87
88 unsigned req_std : 1;
89 unsigned req_config : 1;
90 unsigned req_pending : 1;
91 u8 vbus;
92 struct dentry *regs_info;
93 };
94 #define to_s3c2410(g) (container_of((g), struct s3c2410_udc, gadget))
95
96 #endif