1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Intel PXA25x on-chip full speed USB device controller
5 * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
6 * Copyright (C) 2003 David Brownell
7 * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
10 #ifndef __LINUX_USB_GADGET_PXA25X_H
11 #define __LINUX_USB_GADGET_PXA25X_H
13 #include <linux/types.h>
14 #include <asm/arch/regs-usb.h>
17 * Prefetching support - only ARMv5.
20 #ifdef ARCH_HAS_PREFETCH
21 static inline void prefetch(const void *ptr)
30 #define prefetchw(ptr) prefetch(ptr)
31 #endif /* ARCH_HAS_PREFETCH */
33 /*-------------------------------------------------------------------------*/
35 #define UDC_REGS ((struct pxa25x_udc_regs *)PXA25X_UDC_BASE)
37 /*-------------------------------------------------------------------------*/
39 struct pxa2xx_udc_mach_info {
40 int (*udc_is_connected)(void); /* do we see host? */
41 void (*udc_command)(int cmd);
42 #define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
43 #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
50 struct pxa25x_udc *dev;
52 const struct usb_endpoint_descriptor *desc;
53 struct list_head queue;
54 unsigned long pio_irqs;
56 unsigned short fifo_size;
62 /* UDCCS = UDC Control/Status for this EP
63 * UBCR = UDC Byte Count Remaining (contents of OUT fifo)
64 * UDDR = UDC Endpoint Data Register (the fifo)
65 * DRCM = DMA Request Channel Map
72 struct pxa25x_request {
73 struct usb_request req;
74 struct list_head queue;
85 #define EP0_FIFO_SIZE 16U
86 #define BULK_FIFO_SIZE 64U
87 #define ISO_FIFO_SIZE 256U
88 #define INT_FIFO_SIZE 8U
98 #ifdef CONFIG_USB_PXA25X_SMALL
99 /* when memory's tight, SMALL config saves code+data. */
100 #define PXA_UDC_NUM_ENDPOINTS 3
103 #ifndef PXA_UDC_NUM_ENDPOINTS
104 #define PXA_UDC_NUM_ENDPOINTS 16
107 struct pxa25x_watchdog {
111 struct pxa25x_udc *udc;
113 void (*function)(struct pxa25x_udc *udc);
117 struct usb_gadget gadget;
118 struct usb_gadget_driver *driver;
119 struct pxa25x_udc_regs *regs;
121 enum ep0_state ep0state;
122 struct udc_stats stats;
132 struct pxa2xx_udc_mach_info *mach;
134 struct pxa25x_ep ep[PXA_UDC_NUM_ENDPOINTS];
136 struct pxa25x_watchdog watchdog;
139 /*-------------------------------------------------------------------------*/
141 static struct pxa25x_udc *the_controller;
143 /*-------------------------------------------------------------------------*/
149 #endif /* __LINUX_USB_GADGET_PXA25X_H */