2 * Driver for the NXP ISP1761 device controller
4 * Copyright 2014 Ideas on Board Oy
7 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
14 #ifndef _ISP1760_UDC_H_
15 #define _ISP1760_UDC_H_
17 #include <linux/ioport.h>
18 #include <linux/list.h>
19 #include <linux/spinlock.h>
20 #include <linux/timer.h>
21 #include <linux/usb/gadget.h>
23 struct isp1760_device
;
26 enum isp1760_ctrl_state
{
27 ISP1760_CTRL_SETUP
, /* Waiting for a SETUP transaction */
28 ISP1760_CTRL_DATA_IN
, /* Setup received, data IN stage */
29 ISP1760_CTRL_DATA_OUT
, /* Setup received, data OUT stage */
30 ISP1760_CTRL_STATUS
, /* 0-length request in status stage */
34 struct isp1760_udc
*udc
;
37 struct list_head queue
;
40 unsigned int maxpacket
;
43 const struct usb_endpoint_descriptor
*desc
;
51 * struct isp1760_udc - UDC state information
53 * irqname: IRQ name (as passed to request_irq)
54 * regs: Base address of the UDC registers
55 * driver: Gadget driver
56 * gadget: Gadget device
57 * lock: Protects driver, vbus_timer, ep, ep0_*, DC_EPINDEX register
58 * ep: Array of endpoints
59 * ep0_state: Control request state for endpoint 0
60 * ep0_dir: Direction of the current control request
61 * ep0_length: Length of the current control request
62 * connected: Tracks gadget driver bus connection state
65 #ifdef CONFIG_USB_ISP1761_UDC
66 struct isp1760_device
*isp
;
72 struct usb_gadget_driver
*driver
;
73 struct usb_gadget gadget
;
76 struct timer_list vbus_timer
;
78 struct isp1760_ep ep
[15];
80 enum isp1760_ctrl_state ep0_state
;
86 unsigned int devstatus
;
90 #ifdef CONFIG_USB_ISP1761_UDC
91 int isp1760_udc_register(struct isp1760_device
*isp
, int irq
,
92 unsigned long irqflags
);
93 void isp1760_udc_unregister(struct isp1760_device
*isp
);
95 static inline int isp1760_udc_register(struct isp1760_device
*isp
, int irq
,
96 unsigned long irqflags
)
101 static inline void isp1760_udc_unregister(struct isp1760_device
*isp
)