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 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __LINUX_USB_GADGET_PXA25X_H
24 #define __LINUX_USB_GADGET_PXA25X_H
26 #include <linux/types.h>
27 #include <asm/arch/regs-usb.h>
30 * Prefetching support - only ARMv5.
33 #ifdef ARCH_HAS_PREFETCH
34 static inline void prefetch(const void *ptr)
43 #define prefetchw(ptr) prefetch(ptr)
44 #endif /* ARCH_HAS_PREFETCH */
46 /*-------------------------------------------------------------------------*/
48 #define UDC_REGS ((struct pxa25x_udc_regs *)PXA25X_UDC_BASE)
50 /*-------------------------------------------------------------------------*/
52 struct pxa2xx_udc_mach_info {
53 int (*udc_is_connected)(void); /* do we see host? */
54 void (*udc_command)(int cmd);
55 #define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
56 #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
63 struct pxa25x_udc *dev;
65 const struct usb_endpoint_descriptor *desc;
66 struct list_head queue;
67 unsigned long pio_irqs;
69 unsigned short fifo_size;
75 /* UDCCS = UDC Control/Status for this EP
76 * UBCR = UDC Byte Count Remaining (contents of OUT fifo)
77 * UDDR = UDC Endpoint Data Register (the fifo)
78 * DRCM = DMA Request Channel Map
85 struct pxa25x_request {
86 struct usb_request req;
87 struct list_head queue;
98 #define EP0_FIFO_SIZE 16U
99 #define BULK_FIFO_SIZE 64U
100 #define ISO_FIFO_SIZE 256U
101 #define INT_FIFO_SIZE 8U
111 #ifdef CONFIG_USB_PXA25X_SMALL
112 /* when memory's tight, SMALL config saves code+data. */
113 #define PXA_UDC_NUM_ENDPOINTS 3
116 #ifndef PXA_UDC_NUM_ENDPOINTS
117 #define PXA_UDC_NUM_ENDPOINTS 16
120 struct pxa25x_watchdog {
124 struct pxa25x_udc *udc;
126 void (*function)(struct pxa25x_udc *udc);
130 struct usb_gadget gadget;
131 struct usb_gadget_driver *driver;
132 struct pxa25x_udc_regs *regs;
134 enum ep0_state ep0state;
135 struct udc_stats stats;
145 struct pxa2xx_udc_mach_info *mach;
147 struct pxa25x_ep ep[PXA_UDC_NUM_ENDPOINTS];
149 struct pxa25x_watchdog watchdog;
152 /*-------------------------------------------------------------------------*/
154 static struct pxa25x_udc *the_controller;
156 /*-------------------------------------------------------------------------*/
162 #endif /* __LINUX_USB_GADGET_PXA25X_H */