diff mbox

[U-Boot,02/21] usb: gadget: ether: Perform board initialization from ethernet gadget driver

Message ID 1438877771-23513-3-git-send-email-kishon@ti.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Kishon Vijay Abraham I Aug. 6, 2015, 4:15 p.m. UTC
Ethernet gadget driver can be used both by both SPL and u-boot. Since
usb_eth_init() is the entry point for ethernet gadget driver, perform
board initialization there. Also perform the cleanup in usb_eth_halt.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/usb/gadget/ether.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Marek Vasut Aug. 6, 2015, 10:26 p.m. UTC | #1
On Thursday, August 06, 2015 at 06:15:52 PM, Kishon Vijay Abraham I wrote:
> Ethernet gadget driver can be used both by both SPL and u-boot. Since
> usb_eth_init() is the entry point for ethernet gadget driver, perform
> board initialization there. Also perform the cleanup in usb_eth_halt.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 141ff8b..850ba02 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -15,6 +15,7 @@ 
 #include <linux/usb/cdc.h>
 #include <linux/usb/gadget.h>
 #include <net.h>
+#include <usb.h>
 #include <malloc.h>
 #include <linux/ctype.h>
 
@@ -2312,6 +2313,8 @@  static int usb_eth_init(struct eth_device *netdev, bd_t *bd)
 		goto fail;
 	}
 
+	board_usb_init(0, USB_INIT_DEVICE);
+
 	/* Configure default mac-addresses for the USB ethernet device */
 #ifdef CONFIG_USBNET_DEV_ADDR
 	strlcpy(dev_addr, CONFIG_USBNET_DEV_ADDR, sizeof(dev_addr));
@@ -2492,6 +2495,7 @@  void usb_eth_halt(struct eth_device *netdev)
 	}
 
 	usb_gadget_unregister_driver(&eth_driver);
+	board_usb_cleanup(0, USB_INIT_DEVICE);
 }
 
 static struct usb_gadget_driver eth_driver = {