*/
/*
- * submits an Interrupt Message
+ * submits an Interrupt Message. Some drivers may implement non-blocking
+ * polling: when non-block is true and the device is not responding return
+ * -EAGAIN instead of waiting for device to respond.
*/
int usb_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int transfer_len, int interval)
+ void *buffer, int transfer_len, int interval, bool nonblock)
{
- return submit_int_msg(dev, pipe, buffer, transfer_len, interval);
+ return submit_int_msg(dev, pipe, buffer, transfer_len, interval,
+ nonblock);
}
/*
/* Submit a interrupt transfer request */
if (usb_int_msg(dev, data->intpipe, &data->new[0],
- data->intpktsize, data->intinterval) >= 0)
+ data->intpktsize, data->intinterval, true) >= 0)
usb_kbd_irq_worker(dev);
#elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) || \
defined(CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE)
1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE) < 0) {
#else
if (usb_int_msg(dev, data->intpipe, data->new, data->intpktsize,
- data->intinterval) < 0) {
+ data->intinterval, false) < 0) {
#endif
printf("Failed to get keyboard state from device %04x:%04x\n",
dev->descriptor.idVendor, dev->descriptor.idProduct);
us->ip_wanted = 1;
usb_int_msg(us->pusb_dev, us->irqpipe,
- (void *)&us->ip_data, us->irqmaxp, us->irqinterval);
+ (void *)&us->ip_data, us->irqmaxp, us->irqinterval, false);
timeout = 1000;
while (timeout--) {
if (us->ip_wanted == 0)
}
static int sandbox_keyb_interrupt(struct udevice *dev, struct usb_device *udev,
- unsigned long pipe, void *buffer, int length, int interval)
+ unsigned long pipe, void *buffer, int length, int interval,
+ bool nonblock)
{
struct sandbox_keyb_priv *priv = dev_get_priv(dev);
uint8_t *data = buffer;
}
int usb_emul_int(struct udevice *emul, struct usb_device *udev,
- unsigned long pipe, void *buffer, int length, int interval)
+ unsigned long pipe, void *buffer, int length, int interval,
+ bool nonblock)
{
struct dm_usb_ops *ops = usb_get_emul_ops(emul);
return -ENOSYS;
debug("%s: dev=%s\n", __func__, emul->name);
- return ops->interrupt(emul, udev, pipe, buffer, length, interval);
+ return ops->interrupt(emul, udev, pipe, buffer, length, interval,
+ nonblock);
}
int usb_emul_setup_device(struct udevice *dev, struct usb_string *strings,
}
int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
- unsigned long pipe, void *buffer, int len, int interval)
+ unsigned long pipe, void *buffer, int len, int interval,
+ bool nonblock)
{
unsigned long timeout;
int ret;
}
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
- int len, int interval)
+ int len, int interval, bool nonblock)
{
- return _submit_int_msg(&local, dev, pipe, buffer, len, interval);
+ return _submit_int_msg(&local, dev, pipe, buffer, len, interval,
+ nonblock);
}
/* U-Boot USB control interface */
static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
struct dwc2_priv *priv = dev_get_priv(dev);
debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
- return _submit_int_msg(priv, udev, pipe, buffer, length, interval);
+ return _submit_int_msg(priv, udev, pipe, buffer, length, interval,
+ nonblock);
}
static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
}
static int _ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int length, int interval)
+ void *buffer, int length, int interval,
+ bool nonblock)
{
void *backbuffer;
struct int_queue *queue;
}
int submit_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int length, int interval)
+ void *buffer, int length, int interval, bool nonblock)
{
- return _ehci_submit_int_msg(dev, pipe, buffer, length, interval);
+ return _ehci_submit_int_msg(dev, pipe, buffer, length, interval,
+ nonblock);
}
struct int_queue *create_int_queue(struct usb_device *dev,
static int ehci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
- return _ehci_submit_int_msg(udev, pipe, buffer, length, interval);
+ return _ehci_submit_int_msg(udev, pipe, buffer, length, interval,
+ nonblock);
}
static struct int_queue *ehci_create_int_queue(struct udevice *dev,
}
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
- int transfer_len, int interval)
+ int transfer_len, int interval, bool nonblock)
{
info("submit_int_msg");
return submit_common_msg(&gohci, dev, pipe, buffer, transfer_len, NULL,
static int ohci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
}
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
- int len, int interval)
+ int len, int interval, bool nonblock)
{
PDEBUG(0, "dev = %p pipe = %#lx buf = %p size = %d int = %d\n", dev, pipe,
buffer, len, interval);
static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
struct udevice *emul;
int ret;
usbmon_trace(bus, pipe, NULL, emul);
if (ret)
return ret;
- ret = usb_emul_int(emul, udev, pipe, buffer, length, interval);
+ ret = usb_emul_int(emul, udev, pipe, buffer, length, interval,
+ nonblock);
return ret;
}
}
int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
- int length, int interval)
+ int length, int interval, bool nonblock)
{
struct udevice *bus = udev->controller_dev;
struct dm_usb_ops *ops = usb_get_ops(bus);
if (!ops->interrupt)
return -ENOSYS;
- return ops->interrupt(bus, udev, pipe, buffer, length, interval);
+ return ops->interrupt(bus, udev, pipe, buffer, length, interval,
+ nonblock);
}
int submit_control_msg(struct usb_device *udev, unsigned long pipe,
* @return 0
*/
static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
- void *buffer, int length, int interval)
+ void *buffer, int length, int interval,
+ bool nonblock)
{
if (usb_pipetype(pipe) != PIPE_INTERRUPT) {
printf("non-interrupt pipe (type=%lu)", usb_pipetype(pipe));
}
int submit_int_msg(struct usb_device *udev, unsigned long pipe, void *buffer,
- int length, int interval)
+ int length, int interval, bool nonblock)
{
- return _xhci_submit_int_msg(udev, pipe, buffer, length, interval);
+ return _xhci_submit_int_msg(udev, pipe, buffer, length, interval,
+ nonblock);
}
/**
static int xhci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
debug("%s: dev='%s', udev=%p\n", __func__, dev->name, udev);
- return _xhci_submit_int_msg(udev, pipe, buffer, length, interval);
+ return _xhci_submit_int_msg(udev, pipe, buffer, length, interval,
+ nonblock);
}
static int xhci_alloc_device(struct udevice *dev, struct usb_device *udev)
static int _musb_submit_int_msg(struct musb_host_data *host,
struct usb_device *dev, unsigned long pipe,
- void *buffer, int len, int interval)
+ void *buffer, int len, int interval, bool nonblock)
{
construct_urb(&host->urb, &host->hep, dev, USB_ENDPOINT_XFER_INT, pipe,
buffer, len, NULL, interval);
}
int submit_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int length, int interval)
+ void *buffer, int length, int interval, bool nonblock)
{
- return _musb_submit_int_msg(&musb_host, dev, pipe, buffer, length, interval);
+ return _musb_submit_int_msg(&musb_host, dev, pipe, buffer, length,
+ interval, nonblock);
}
struct int_queue *create_int_queue(struct usb_device *dev,
static int musb_submit_int_msg(struct udevice *dev, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval)
+ int interval, bool nonblock)
{
struct musb_host_data *host = dev_get_priv(dev);
- return _musb_submit_int_msg(host, udev, pipe, buffer, length, interval);
+ return _musb_submit_int_msg(host, udev, pipe, buffer, length, interval,
+ nonblock);
}
static struct int_queue *musb_create_int_queue(struct udevice *dev,
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int transfer_len, struct devrequest *setup);
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
- int transfer_len, int interval);
+ int transfer_len, int interval, bool nonblock);
#if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST \
|| CONFIG_IS_ENABLED(DM_USB)
int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
void *data, int len, int *actual_length, int timeout);
int usb_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int transfer_len, int interval);
+ void *buffer, int transfer_len, int interval, bool nonblock);
int usb_disable_asynch(int disable);
int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
int usb_get_configuration_no(struct usb_device *dev, int cfgno,
*/
int (*interrupt)(struct udevice *bus, struct usb_device *udev,
unsigned long pipe, void *buffer, int length,
- int interval);
+ int interval, bool nonblock);
/**
* create_int_queue() - Create and queue interrupt packets
* @return 0 if OK, -ve on error
*/
int usb_emul_int(struct udevice *emul, struct usb_device *udev,
- unsigned long pipe, void *buffer, int length, int interval);
+ unsigned long pipe, void *buffer, int length, int interval,
+ bool nonblock);
/**
* usb_emul_find() - Find an emulator for a particular device