[kernel] pwm: export the generic pwm api as module
[openwrt.git] / target / linux / xburst / files-2.6.32 / drivers / usb / gadget / jz4740_udc.h
1 /*
2 * linux/drivers/usb/gadget/jz4740_udc.h
3 *
4 * Ingenic JZ4740 on-chip high speed USB device controller
5 *
6 * Copyright (C) 2006 Ingenic Semiconductor Inc.
7 * Author: <jlwei@ingenic.cn>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15 #ifndef __USB_GADGET_JZ4740_H__
16 #define __USB_GADGET_JZ4740_H__
17
18 /*-------------------------------------------------------------------------*/
19
20 // Max packet size
21 #define EP0_MAXPACKETSIZE 64
22 #define EPBULK_MAXPACKETSIZE 512
23 #define EPINTR_MAXPACKETSIZE 64
24
25 #define UDC_MAX_ENDPOINTS 4
26
27 /*-------------------------------------------------------------------------*/
28
29 typedef enum ep_type {
30 ep_control, ep_bulk_in, ep_bulk_out, ep_interrupt
31 } ep_type_t;
32
33 struct jz4740_ep {
34 struct usb_ep ep;
35 struct jz4740_udc *dev;
36
37 const struct usb_endpoint_descriptor *desc;
38 unsigned long pio_irqs;
39
40 uint8_t stopped;
41 uint8_t bEndpointAddress;
42 uint8_t bmAttributes;
43
44 ep_type_t type;
45 size_t fifo;
46 u32 csr;
47
48 uint32_t reg_addr;
49 struct list_head queue;
50 };
51
52 struct jz4740_request {
53 struct usb_request req;
54 struct list_head queue;
55 };
56
57 enum ep0state {
58 WAIT_FOR_SETUP, /* between STATUS ack and SETUP report */
59 DATA_STATE_XMIT, /* data tx stage */
60 DATA_STATE_NEED_ZLP, /* data tx zlp stage */
61 WAIT_FOR_OUT_STATUS, /* status stages */
62 DATA_STATE_RECV, /* data rx stage */
63 };
64
65 /* For function binding with UDC Disable - Added by River */
66 typedef enum {
67 UDC_STATE_ENABLE = 0,
68 UDC_STATE_DISABLE,
69 }udc_state_t;
70
71 struct jz4740_udc {
72 struct usb_gadget gadget;
73 struct usb_gadget_driver *driver;
74 struct device *dev;
75 spinlock_t lock;
76
77 enum ep0state ep0state;
78 struct jz4740_ep ep[UDC_MAX_ENDPOINTS];
79
80 unsigned char usb_address;
81
82 udc_state_t state;
83
84 struct resource *mem;
85 void __iomem *base;
86 int irq;
87 uint32_t in_mask;
88 uint32_t out_mask;
89
90 struct clk *clk;
91 };
92
93 extern struct jz4740_udc *the_controller;
94
95 #define ep_is_in(EP) (((EP)->bEndpointAddress&USB_DIR_IN)==USB_DIR_IN)
96 #define ep_maxpacket(EP) ((EP)->ep.maxpacket)
97 #define ep_index(EP) ((EP)->bEndpointAddress&0xF)
98
99 #endif /* __USB_GADGET_JZ4740_H__ */
This page took 0.047892 seconds and 5 git commands to generate.