2 * Intel PXA25x on-chip full speed USB device controller
4 * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
5 * Copyright (C) 2003 David Brownell
6 * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
8 * SPDX-License-Identifier: GPL-2.0+
11 #ifndef __LINUX_USB_GADGET_PXA25X_H
12 #define __LINUX_USB_GADGET_PXA25X_H
14 #include <linux/types.h>
15 #include <asm/arch/regs-usb.h>
18 * Prefetching support - only ARMv5.
21 #ifdef ARCH_HAS_PREFETCH
22 static inline void prefetch(const void *ptr)
31 #define prefetchw(ptr) prefetch(ptr)
32 #endif /* ARCH_HAS_PREFETCH */
34 /*-------------------------------------------------------------------------*/
36 #define UDC_REGS ((struct pxa25x_udc_regs *)PXA25X_UDC_BASE)
38 /*-------------------------------------------------------------------------*/
40 struct pxa2xx_udc_mach_info {
41 int (*udc_is_connected)(void); /* do we see host? */
42 void (*udc_command)(int cmd);
43 #define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
44 #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
51 struct pxa25x_udc *dev;
53 const struct usb_endpoint_descriptor *desc;
54 struct list_head queue;
55 unsigned long pio_irqs;
57 unsigned short fifo_size;
63 /* UDCCS = UDC Control/Status for this EP
64 * UBCR = UDC Byte Count Remaining (contents of OUT fifo)
65 * UDDR = UDC Endpoint Data Register (the fifo)
66 * DRCM = DMA Request Channel Map
73 struct pxa25x_request {
74 struct usb_request req;
75 struct list_head queue;
86 #define EP0_FIFO_SIZE 16U
87 #define BULK_FIFO_SIZE 64U
88 #define ISO_FIFO_SIZE 256U
89 #define INT_FIFO_SIZE 8U
99 #ifdef CONFIG_USB_PXA25X_SMALL
100 /* when memory's tight, SMALL config saves code+data. */
101 #define PXA_UDC_NUM_ENDPOINTS 3
104 #ifndef PXA_UDC_NUM_ENDPOINTS
105 #define PXA_UDC_NUM_ENDPOINTS 16
108 struct pxa25x_watchdog {
112 struct pxa25x_udc *udc;
114 void (*function)(struct pxa25x_udc *udc);
118 struct usb_gadget gadget;
119 struct usb_gadget_driver *driver;
120 struct pxa25x_udc_regs *regs;
122 enum ep0_state ep0state;
123 struct udc_stats stats;
133 struct pxa2xx_udc_mach_info *mach;
135 struct pxa25x_ep ep[PXA_UDC_NUM_ENDPOINTS];
137 struct pxa25x_watchdog watchdog;
140 /*-------------------------------------------------------------------------*/
142 static struct pxa25x_udc *the_controller;
144 /*-------------------------------------------------------------------------*/
150 #endif /* __LINUX_USB_GADGET_PXA25X_H */