xref: /openbmc/u-boot/include/usb/pxa27x_udc.h (revision 8167af14)
1 /*
2  * PXA27x register declarations and HCD data structures
3  *
4  * Copyright (C) 2007 Rodolfo Giometti <giometti@linux.it>
5  * Copyright (C) 2007 Eurotech S.p.A. <info@eurotech.it>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22 
23 
24 #ifndef __PXA270X_UDC_H__
25 #define __PXA270X_UDC_H__
26 
27 #include <asm/byteorder.h>
28 
29 /* Endpoint 0 states */
30 #define EP0_IDLE		0
31 #define EP0_IN_DATA		1
32 #define EP0_OUT_DATA		2
33 #define EP0_XFER_COMPLETE	3
34 
35 
36 /* Endpoint parameters */
37 #define MAX_ENDPOINTS		4
38 #define EP_MAX_PACKET_SIZE	64
39 
40 #define EP0_MAX_PACKET_SIZE     16
41 #define UDC_OUT_ENDPOINT        0x02
42 #define UDC_OUT_PACKET_SIZE     EP_MAX_PACKET_SIZE
43 #define UDC_IN_ENDPOINT         0x01
44 #define UDC_IN_PACKET_SIZE      EP_MAX_PACKET_SIZE
45 #define UDC_INT_ENDPOINT        0x05
46 #define UDC_INT_PACKET_SIZE     EP_MAX_PACKET_SIZE
47 #define UDC_BULK_PACKET_SIZE    EP_MAX_PACKET_SIZE
48 
49 void udc_irq(void);
50 /* Flow control */
51 void udc_set_nak(int epid);
52 void udc_unset_nak(int epid);
53 
54 /* Higher level functions for abstracting away from specific device */
55 int udc_endpoint_write(struct usb_endpoint_instance *endpoint);
56 
57 int  udc_init(void);
58 
59 void udc_enable(struct usb_device_instance *device);
60 void udc_disable(void);
61 
62 void udc_connect(void);
63 void udc_disconnect(void);
64 
65 void udc_startup_events(struct usb_device_instance *device);
66 void udc_setup_ep(struct usb_device_instance *device,
67 	 unsigned int ep, struct usb_endpoint_instance *endpoint);
68 
69 #endif
70