2 * Copyright 2011, Marvell Semiconductor Inc.
4 * Licensed under the GPL-2 or later.
6 #ifndef __GADGET__CI_UDC_H__
7 #define __GADGET__CI_UDC_H__
9 #define NUM_ENDPOINTS 6
12 #define MICRO_8FRAME 0x8
13 #define USBCMD_ITC(x) ((((x) > 0xff) ? 0xff : x) << 16)
14 #define USBCMD_FS2 (1 << 15)
15 #define USBCMD_RST (1 << 1)
16 #define USBCMD_RUN (1)
17 u32 usbcmd
; /* 0x140 */
18 #define STS_SLI (1 << 8)
19 #define STS_URI (1 << 6)
20 #define STS_PCI (1 << 2)
21 #define STS_UEI (1 << 1)
22 #define STS_UI (1 << 0)
23 u32 usbsts
; /* 0x144 */
25 u32 devaddr
; /* 0x154 */
26 u32 epinitaddr
; /* 0x158 */
29 #define PTS(x) (((x) & 0x3) << 30)
30 #define PFSC (1 << 24)
31 u32 portsc
; /* 0x184 */
33 #define USBMODE_DEVICE 2
34 u32 usbmode
; /* 0x1a8 */
35 u32 epstat
; /* 0x1ac */
36 #define EPT_TX(x) (1 << (((x) & 0xffff) + 16))
37 #define EPT_RX(x) (1 << ((x) & 0xffff))
38 u32 epprime
; /* 0x1b0 */
39 u32 epflush
; /* 0x1b4 */
41 u32 epcomp
; /* 0x1bc */
42 #define CTRL_TXE (1 << 23)
43 #define CTRL_TXR (1 << 22)
44 #define CTRL_RXE (1 << 7)
45 #define CTRL_RXR (1 << 6)
46 #define CTRL_TXT_BULK (2 << 18)
47 #define CTRL_RXT_BULK (2 << 2)
48 u32 epctrl
[16]; /* 0x1c0 */
53 struct list_head queue
;
54 const struct usb_endpoint_descriptor
*desc
;
56 struct usb_request req
;
59 uint8_t b_fast
[64] __aligned(ARCH_DMA_MINALIGN
);
63 struct usb_gadget gadget
;
64 struct usb_gadget_driver
*driver
;
65 struct ehci_ctrl
*ctrl
;
66 struct ept_queue_head
*epts
;
67 struct ept_queue_item
*items
[2 * NUM_ENDPOINTS
];
69 struct ci_ep ep
[NUM_ENDPOINTS
];
72 struct ept_queue_head
{
74 unsigned current
; /* read-only */
85 unsigned char setup_data
[8];
93 #define CONFIG_MAX_PKT(n) ((n) << 16)
94 #define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */
95 #define CONFIG_IOS (1 << 15) /* IRQ on setup */
97 struct ept_queue_item
{
109 #define INFO_BYTES(n) ((n) << 16)
110 #define INFO_IOC (1 << 15)
111 #define INFO_ACTIVE (1 << 7)
112 #define INFO_HALTED (1 << 6)
113 #define INFO_BUFFER_ERROR (1 << 5)
114 #define INFO_TX_ERROR (1 << 3)