Linux Audio

Check our new training course

Buildroot integration, development and maintenance

Need a Buildroot system for your embedded project?
Loading...
v4.6
 
  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
 14#ifndef _S3C2410_UDC_H
 15#define _S3C2410_UDC_H
 16
 17struct s3c2410_ep {
 18	struct list_head		queue;
 19	unsigned long			last_io;	/* jiffies timestamp */
 20	struct usb_gadget		*gadget;
 21	struct s3c2410_udc		*dev;
 22	struct usb_ep			ep;
 23	u8				num;
 24
 25	unsigned short			fifo_size;
 26	u8				bEndpointAddress;
 27	u8				bmAttributes;
 28
 29	unsigned			halted : 1;
 30	unsigned			already_seen : 1;
 31	unsigned			setup_stage : 1;
 32};
 33
 34
 35/* Warning : ep0 has a fifo of 16 bytes */
 36/* Don't try to set 32 or 64            */
 37/* also testusb 14 fails  wit 16 but is */
 38/* fine with 8                          */
 39#define EP0_FIFO_SIZE		 8
 40#define EP_FIFO_SIZE		64
 41#define DEFAULT_POWER_STATE	0x00
 42
 43#define S3C2440_EP_FIFO_SIZE	128
 44
 45static const char ep0name [] = "ep0";
 46
 47static const char *const ep_name[] = {
 48	ep0name,                                /* everyone has ep0 */
 49	/* s3c2410 four bidirectional bulk endpoints */
 50	"ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
 51};
 52
 53#define S3C2410_ENDPOINTS       ARRAY_SIZE(ep_name)
 54
 55struct s3c2410_request {
 56	struct list_head		queue;		/* ep's requests */
 57	struct usb_request		req;
 58};
 59
 60enum ep0_state {
 61        EP0_IDLE,
 62        EP0_IN_DATA_PHASE,
 63        EP0_OUT_DATA_PHASE,
 64        EP0_END_XFER,
 65        EP0_STALL,
 66};
 67
 68static const char *ep0states[]= {
 69        "EP0_IDLE",
 70        "EP0_IN_DATA_PHASE",
 71        "EP0_OUT_DATA_PHASE",
 72        "EP0_END_XFER",
 73        "EP0_STALL",
 74};
 75
 76struct s3c2410_udc {
 77	spinlock_t			lock;
 78
 79	struct s3c2410_ep		ep[S3C2410_ENDPOINTS];
 80	int				address;
 81	struct usb_gadget		gadget;
 82	struct usb_gadget_driver	*driver;
 83	struct s3c2410_request		fifo_req;
 84	u8				fifo_buf[EP_FIFO_SIZE];
 85	u16				devstatus;
 86
 87	u32				port_status;
 88	int				ep0state;
 89
 
 
 
 90	unsigned			got_irq : 1;
 91
 92	unsigned			req_std : 1;
 93	unsigned			req_config : 1;
 94	unsigned			req_pending : 1;
 95	u8				vbus;
 96	struct dentry			*regs_info;
 97};
 98#define to_s3c2410(g)	(container_of((g), struct s3c2410_udc, gadget))
 99
100#endif
v6.2
 1// SPDX-License-Identifier: GPL-2.0+
 2/*
 3 * linux/drivers/usb/gadget/s3c2410_udc.h
 4 * Samsung on-chip full speed USB device controllers
 5 *
 6 * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard
 7 *	Additional cleanups by Ben Dooks <ben-linux@fluff.org>
 
 
 
 
 
 8 */
 9
10#ifndef _S3C2410_UDC_H
11#define _S3C2410_UDC_H
12
13struct s3c2410_ep {
14	struct list_head		queue;
15	unsigned long			last_io;	/* jiffies timestamp */
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/* Warning : ep0 has a fifo of 16 bytes */
32/* Don't try to set 32 or 64            */
33/* also testusb 14 fails  wit 16 but is */
34/* fine with 8                          */
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
41static const char ep0name [] = "ep0";
42
43static const char *const ep_name[] = {
44	ep0name,                                /* everyone has ep0 */
45	/* s3c2410 four bidirectional bulk endpoints */
46	"ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
47};
48
49#define S3C2410_ENDPOINTS       ARRAY_SIZE(ep_name)
50
51struct s3c2410_request {
52	struct list_head		queue;		/* ep's requests */
53	struct usb_request		req;
54};
55
56enum ep0_state {
57        EP0_IDLE,
58        EP0_IN_DATA_PHASE,
59        EP0_OUT_DATA_PHASE,
60        EP0_END_XFER,
61        EP0_STALL,
62};
63
64static 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
72struct 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	struct gpio_desc		*vbus_gpiod;
87	struct gpio_desc		*pullup_gpiod;
88
89	unsigned			got_irq : 1;
90
91	unsigned			req_std : 1;
92	unsigned			req_config : 1;
93	unsigned			req_pending : 1;
94	u8				vbus;
95	int				irq;
96};
97#define to_s3c2410(g)	(container_of((g), struct s3c2410_udc, gadget))
98
99#endif