aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/s3c2410_udc.h
diff options
context:
space:
mode:
authorArnaud Patard <arnaud.patard@rtp-net.org>2007-06-07 00:05:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:30 -0400
commit3fc154b6b8134b98bb94d60cad9a46ec1ffbe372 (patch)
tree1c6d47aa4f4b43836513ede0976d47c6bd13f0de /drivers/usb/gadget/s3c2410_udc.h
parent7a4eb7fd50d4df99fc1f623e6d90680d9fca3d82 (diff)
USB Gadget driver for Samsung s3c2410 ARM SoC
This patch adds the support for the Usb Device Controller on Samsung S3C24xx SoCs. This driver passes all tests from testusb (including #13) and has been tested on S3C2410, S3C24212, and S3C2440 SoCs. Whitespace updates, minor cleanups by David Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Cc: Herbert Pötzl <herbert@13thfloor.at> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/s3c2410_udc.h')
-rw-r--r--drivers/usb/gadget/s3c2410_udc.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/drivers/usb/gadget/s3c2410_udc.h b/drivers/usb/gadget/s3c2410_udc.h
new file mode 100644
index 000000000000..9e0bece4f241
--- /dev/null
+++ b/drivers/usb/gadget/s3c2410_udc.h
@@ -0,0 +1,110 @@
1/*
2 * linux/drivers/usb/gadget/s3c2410_udc.h
3 * Samsung on-chip full speed USB device controllers
4 *
5 * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard
6 * Additional cleanups by Ben Dooks <ben-linux@fluff.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef _S3C2410_UDC_H
25#define _S3C2410_UDC_H
26
27struct s3c2410_ep {
28 struct list_head queue;
29 unsigned long last_io; /* jiffies timestamp */
30 struct usb_gadget *gadget;
31 struct s3c2410_udc *dev;
32 const struct usb_endpoint_descriptor *desc;
33 struct usb_ep ep;
34 u8 num;
35
36 unsigned short fifo_size;
37 u8 bEndpointAddress;
38 u8 bmAttributes;
39
40 unsigned halted : 1;
41 unsigned already_seen : 1;
42 unsigned setup_stage : 1;
43};
44
45
46/* Warning : ep0 has a fifo of 16 bytes */
47/* Don't try to set 32 or 64 */
48/* also testusb 14 fails wit 16 but is */
49/* fine with 8 */
50#define EP0_FIFO_SIZE 8
51#define EP_FIFO_SIZE 64
52#define DEFAULT_POWER_STATE 0x00
53
54#define S3C2440_EP_FIFO_SIZE 128
55
56static const char ep0name [] = "ep0";
57
58static const char *const ep_name[] = {
59 ep0name, /* everyone has ep0 */
60 /* s3c2410 four bidirectional bulk endpoints */
61 "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
62};
63
64#define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name)
65
66struct s3c2410_request {
67 struct list_head queue; /* ep's requests */
68 struct usb_request req;
69};
70
71enum ep0_state {
72 EP0_IDLE,
73 EP0_IN_DATA_PHASE,
74 EP0_OUT_DATA_PHASE,
75 EP0_END_XFER,
76 EP0_STALL,
77};
78
79static const char *ep0states[]= {
80 "EP0_IDLE",
81 "EP0_IN_DATA_PHASE",
82 "EP0_OUT_DATA_PHASE",
83 "EP0_END_XFER",
84 "EP0_STALL",
85};
86
87struct s3c2410_udc {
88 spinlock_t lock;
89
90 struct s3c2410_ep ep[S3C2410_ENDPOINTS];
91 int address;
92 struct usb_gadget gadget;
93 struct usb_gadget_driver *driver;
94 struct s3c2410_request fifo_req;
95 u8 fifo_buf[EP_FIFO_SIZE];
96 u16 devstatus;
97
98 u32 port_status;
99 int ep0state;
100
101 unsigned got_irq : 1;
102
103 unsigned req_std : 1;
104 unsigned req_config : 1;
105 unsigned req_pending : 1;
106 u8 vbus;
107 struct dentry *regs_info;
108};
109
110#endif