From 0131162439508801b9f8a330fa731f04273c9337 Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Thu, 29 Nov 2018 10:52:46 +0100 Subject: dm: usb: create a new UCLASS ID for USB gadget devices UCLASS_USB_DEV_GENERIC was meant for USB devices connected to host controllers, not gadget devices. Adding a new UCLASS for gadget devices alone. Also move the generic DM code for USB gadgets in a separate file for clarity. Signed-off-by: Jean-Jacques Hiblot --- drivers/usb/gadget/udc/udc-core.c | 41 --------------------------------------- 1 file changed, 41 deletions(-) (limited to 'drivers/usb/gadget/udc/udc-core.c') diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 34bea27ad8..62b47781dd 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -352,44 +352,3 @@ EXPORT_SYMBOL_GPL(usb_gadget_unregister_driver); MODULE_DESCRIPTION("UDC Framework"); MODULE_AUTHOR("Felipe Balbi "); MODULE_LICENSE("GPL v2"); - -#if CONFIG_IS_ENABLED(DM_USB_GADGET) -#define MAX_UDC_DEVICES 4 -static struct udevice *dev_array[MAX_UDC_DEVICES]; -int usb_gadget_initialize(int index) -{ - int ret; - struct udevice *dev = NULL; - - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - if (dev_array[index]) - return 0; - ret = uclass_get_device(UCLASS_USB_DEV_GENERIC, index, &dev); - if (!dev || ret) { - pr_err("No USB device found\n"); - return -ENODEV; - } - dev_array[index] = dev; - return 0; -} - -int usb_gadget_release(int index) -{ - int ret; - - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - ret = device_remove(dev_array[index], DM_REMOVE_NORMAL); - if (!ret) - dev_array[index] = NULL; - return ret; -} - -int usb_gadget_handle_interrupts(int index) -{ - if (index < 0 || index >= ARRAY_SIZE(dev_array)) - return -EINVAL; - return dm_usb_gadget_handle_interrupts(dev_array[index]); -} -#endif -- cgit