board: mediatek: pumpkin: initialize usb device
authorFabien Parent <fparent@baylibre.com>
Fri, 16 Oct 2020 15:40:07 +0000 (17:40 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 18 Jan 2021 19:59:19 +0000 (14:59 -0500)
Initialize USB device on pumpkin if it is enabled in the config.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
board/mediatek/pumpkin/pumpkin.c

index 666e4d6a26fee87b8a259851087207120e42313e..37daf1c51b92f27a17a91a7ba97c068296a24300 100644 (file)
@@ -4,8 +4,25 @@
  */
 
 #include <common.h>
+#include <dm.h>
 
 int board_init(void)
 {
        return 0;
 }
+
+int board_late_init(void)
+{
+       struct udevice *dev;
+       int ret;
+
+       if (CONFIG_IS_ENABLED(USB_GADGET)) {
+               ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev);
+               if (ret) {
+                       pr_err("%s: Cannot find USB device\n", __func__);
+                       return ret;
+               }
+       }
+
+       return 0;
+}