dm: usb: udc: Factor out plain udevice handler functions

Pull the functionality of UDC uclass that operates on plain udevice
and does not use this dev_array array into separate functions and
expose those functions, so that as much code as possible can be
switched over to these functions and the dev_array can be dropped.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marek Vasut 2023-09-01 11:49:47 +02:00
parent 2fe4b54556
commit a1fa8bbb90
3 changed files with 68 additions and 8 deletions

View file

@ -970,6 +970,23 @@ extern void usb_ep_autoconfig_reset(struct usb_gadget *);
extern int usb_gadget_handle_interrupts(int index);
/**
* udc_device_get_by_index() - Get UDC udevice by index
* @index: UDC device index
* @udev: UDC udevice matching the index (if found)
*
* Return: 0 if Ok, -ve on error
*/
int udc_device_get_by_index(int index, struct udevice **udev);
/**
* udc_device_put() - Put UDC udevice
* @udev: UDC udevice
*
* Return: 0 if Ok, -ve on error
*/
int udc_device_put(struct udevice *udev);
#if CONFIG_IS_ENABLED(DM_USB_GADGET)
int usb_gadget_initialize(int index);
int usb_gadget_release(int index);