1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for the NXP ISP1761 device controller
5 * Copyright 2014 Ideas on Board Oy
8 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 #ifndef _ISP1760_UDC_H_
12 #define _ISP1760_UDC_H_
14 #include <linux/ioport.h>
15 #include <linux/list.h>
16 #include <linux/spinlock.h>
17 #include <linux/timer.h>
18 #include <linux/usb/gadget.h>
20 struct isp1760_device
;
23 enum isp1760_ctrl_state
{
24 ISP1760_CTRL_SETUP
, /* Waiting for a SETUP transaction */
25 ISP1760_CTRL_DATA_IN
, /* Setup received, data IN stage */
26 ISP1760_CTRL_DATA_OUT
, /* Setup received, data OUT stage */
27 ISP1760_CTRL_STATUS
, /* 0-length request in status stage */
31 struct isp1760_udc
*udc
;
34 struct list_head queue
;
37 unsigned int maxpacket
;
40 const struct usb_endpoint_descriptor
*desc
;
48 * struct isp1760_udc - UDC state information
50 * irqname: IRQ name (as passed to request_irq)
51 * regs: Base address of the UDC registers
52 * driver: Gadget driver
53 * gadget: Gadget device
54 * lock: Protects driver, vbus_timer, ep, ep0_*, DC_EPINDEX register
55 * ep: Array of endpoints
56 * ep0_state: Control request state for endpoint 0
57 * ep0_dir: Direction of the current control request
58 * ep0_length: Length of the current control request
59 * connected: Tracks gadget driver bus connection state
62 #ifdef CONFIG_USB_ISP1761_UDC
63 struct isp1760_device
*isp
;
69 struct usb_gadget_driver
*driver
;
70 struct usb_gadget gadget
;
73 struct timer_list vbus_timer
;
75 struct isp1760_ep ep
[15];
77 enum isp1760_ctrl_state ep0_state
;
83 unsigned int devstatus
;
87 #ifdef CONFIG_USB_ISP1761_UDC
88 int isp1760_udc_register(struct isp1760_device
*isp
, int irq
,
89 unsigned long irqflags
);
90 void isp1760_udc_unregister(struct isp1760_device
*isp
);
92 static inline int isp1760_udc_register(struct isp1760_device
*isp
, int irq
,
93 unsigned long irqflags
)
98 static inline void isp1760_udc_unregister(struct isp1760_device
*isp
)