]>
git.ipfire.org Git - people/ms/u-boot.git/blob - include/usb/mv_udc.h
2 * Copyright 2011, Marvell Semiconductor Inc.
3 * Lei Wen <leiwen@marvell.com>
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/byteorder.h>
13 #include <asm/errno.h>
14 #include <linux/usb/ch9.h>
15 #include <linux/usb/gadget.h>
17 #include "../../drivers/usb/host/ehci.h"
19 #define NUM_ENDPOINTS 6
21 /* Endpoint parameters */
22 #define MAX_ENDPOINTS 4
24 #define EP_MAX_PACKET_SIZE 0x200
25 #define EP0_MAX_PACKET_SIZE 64
28 #define MICRO_8FRAME 0x8
29 #define USBCMD_ITC(x) ((((x) > 0xff) ? 0xff : x) << 16)
30 #define USBCMD_FS2 (1 << 15)
31 #define USBCMD_RST (1 << 1)
32 #define USBCMD_RUN (1)
33 u32 usbcmd
; /* 0x140 */
34 #define STS_SLI (1 << 8)
35 #define STS_URI (1 << 6)
36 #define STS_PCI (1 << 2)
37 #define STS_UEI (1 << 1)
38 #define STS_UI (1 << 0)
39 u32 usbsts
; /* 0x144 */
41 u32 devaddr
; /* 0x154 */
42 u32 epinitaddr
; /* 0x158 */
45 #define PTS(x) (((x) & 0x3) << 30)
46 #define PFSC (1 << 24)
47 u32 portsc
; /* 0x184 */
49 #define USBMODE_DEVICE 2
50 u32 usbmode
; /* 0x1a8 */
51 u32 epstat
; /* 0x1ac */
52 #define EPT_TX(x) (1 << (((x) & 0xffff) + 16))
53 #define EPT_RX(x) (1 << ((x) & 0xffff))
54 u32 epprime
; /* 0x1b0 */
55 u32 epflush
; /* 0x1b4 */
57 u32 epcomp
; /* 0x1bc */
58 #define CTRL_TXE (1 << 23)
59 #define CTRL_TXR (1 << 22)
60 #define CTRL_RXE (1 << 7)
61 #define CTRL_RXR (1 << 6)
62 #define CTRL_TXT_BULK (2 << 18)
63 #define CTRL_RXT_BULK (2 << 2)
64 u32 epctrl
[16]; /* 0x1c0 */
69 struct list_head queue
;
70 const struct usb_endpoint_descriptor
*desc
;
72 struct usb_request req
;
75 uint8_t b_fast
[64] __aligned(ARCH_DMA_MINALIGN
);
79 struct usb_gadget gadget
;
80 struct usb_gadget_driver
*driver
;
81 struct ehci_ctrl
*ctrl
;
82 struct ept_queue_head
*epts
;
83 struct ept_queue_item
*items
[2 * NUM_ENDPOINTS
];
85 struct mv_ep ep
[NUM_ENDPOINTS
];
88 struct ept_queue_head
{
90 unsigned current
; /* read-only */
101 unsigned char setup_data
[8];
109 #define CONFIG_MAX_PKT(n) ((n) << 16)
110 #define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */
111 #define CONFIG_IOS (1 << 15) /* IRQ on setup */
113 struct ept_queue_item
{
125 #define INFO_BYTES(n) ((n) << 16)
126 #define INFO_IOC (1 << 15)
127 #define INFO_ACTIVE (1 << 7)
128 #define INFO_HALTED (1 << 6)
129 #define INFO_BUFFER_ERROR (1 << 5)
130 #define INFO_TX_ERROR (1 << 3)
132 #endif /* __MV_UDC_H__ */