diff options
author | Jean-Jacques Hiblot <jjhiblot@ti.com> | 2018-11-29 10:52:41 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-12-07 16:31:45 +0100 |
commit | a06955ae1ef2a942f18025d4fefceea2c638a76f (patch) | |
tree | 2796cd005202d59118724ce82b10f348b52e9654 /drivers | |
parent | 57dbc151437b36cc1105857d222df28b095236d7 (diff) |
usb: gadget: Do not call board_usb_xxx() directly in USB gadget drivers
Add 2 functions to wrap the calls to board_usb_init() and
board_usb_cleanup().
This is a preparatory work for DM support for UDC drivers (DM_USB_GADGET).
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/ether.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 193583b437..5a9ffd7120 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -100,9 +100,6 @@ struct eth_dev { struct usb_gadget *gadget; struct usb_request *req; /* for control responses */ struct usb_request *stat_req; /* for cdc & rndis status */ -#if CONFIG_IS_ENABLED(DM_USB) - struct udevice *usb_udev; -#endif u8 config; struct usb_ep *in_ep, *out_ep, *status_ep; @@ -2336,40 +2333,17 @@ fail: } /*-------------------------------------------------------------------------*/ - -#if CONFIG_IS_ENABLED(DM_USB) -int dm_usb_init(struct eth_dev *e_dev) -{ - struct udevice *dev = NULL; - int ret; - - ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &dev); - if (!dev || ret) { - pr_err("No USB device found\n"); - return -ENODEV; - } - - e_dev->usb_udev = dev; - - return ret; -} -#endif - static int _usb_eth_init(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev; struct usb_gadget *gadget; unsigned long ts; + int ret; unsigned long timeout = USB_CONNECT_TIMEOUT; -#if CONFIG_IS_ENABLED(DM_USB) - if (dm_usb_init(dev)) { - pr_err("USB ether not found\n"); - return -ENODEV; - } -#else - board_usb_init(0, USB_INIT_DEVICE); -#endif + ret = usb_gadget_initialize(0); + if (ret) + return ret; /* Configure default mac-addresses for the USB ethernet device */ #ifdef CONFIG_USBNET_DEV_ADDR @@ -2541,9 +2515,7 @@ void _usb_eth_halt(struct ether_priv *priv) } usb_gadget_unregister_driver(&priv->eth_driver); -#if !CONFIG_IS_ENABLED(DM_USB) - board_usb_cleanup(0, USB_INIT_DEVICE); -#endif + usb_gadget_release(0); } #ifndef CONFIG_DM_ETH |