diff options
author | Marek Vasut | 2020-04-06 14:29:44 +0200 |
---|---|---|
committer | Tom Rini | 2020-04-09 15:26:59 -0400 |
commit | 31232de07ef2bd97ff67625976eecd97eeb1bd3d (patch) | |
tree | a2c2b13d0321e29a09435d664c8a8c960a935e62 /include/usb.h | |
parent | 0db0ba6141f402b1d496ef53d9fa69978f75ec61 (diff) |
usb: Keep async schedule running only across mass storage xfers
Rather than keeping the asynchronous schedule running always, keep it
running only across USB mass storage transfers for now, as it seems
that keeping it running all the time interferes with certain control
transfers during device enumeration.
Note that running the async schedule all the time should not be an
issue, especially on EHCI HCD, as that one implements most of the
transfers using async schedule.
Note that we have usb_disable_asynch(), which however is utterly broken.
The usb_disable_asynch() blocks the USB core from doing async transfers
by setting a global flag. The async schedule should however be disabled
per USB controller. Moreover, setting a global flag does not prevent the
controller from using the async schedule, which e.g. the EHCI HCD does.
This patch implements additional callback to the controller, which
permits it to lock the async schedule and keep it running across
multiple transfers. Once the schedule is unlocked, it must also be
disabled. This thus prevents the async schedule from running outside
of the USB mass storage transfers.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> [omap3_beagle, previously failing]
Diffstat (limited to 'include/usb.h')
-rw-r--r-- | include/usb.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/usb.h b/include/usb.h index efb67ea33ff..22f6088fe66 100644 --- a/include/usb.h +++ b/include/usb.h @@ -269,6 +269,7 @@ 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, bool nonblock); +int usb_lock_async(struct usb_device *dev, int lock); 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, @@ -791,6 +792,16 @@ struct dm_usb_ops { * in a USB transfer. USB class driver needs to be aware of this. */ int (*get_max_xfer_size)(struct udevice *bus, size_t *size); + + /** + * lock_async() - Keep async schedule after a transfer + * + * It may be desired to keep the asynchronous schedule running even + * after a transfer finishes, usually when doing multiple transfers + * back-to-back. This callback allows signalling the USB controller + * driver to do just that. + */ + int (*lock_async)(struct udevice *udev, int lock); }; #define usb_get_ops(dev) ((struct dm_usb_ops *)(dev)->driver->ops) |