common: Drop linux/delay.h from common header
[oweals/u-boot.git] / drivers / usb / musb-new / pic32.c
index ed6da19eecdb52da9f88e4be662ed9d6dee2a71a..66e8e9ce886f7708a2ea84655ec59f99731b5f05 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Microchip PIC32 MUSB "glue layer"
  *
@@ -5,12 +6,12 @@
  *  Cristian Birsan <cristian.birsan@microchip.com>
  *  Purna Chandra Mandal <purna.mandal@microchip.com>
  *
- * SPDX-License-Identifier:     GPL-2.0+
- *
  * Based on the dsps "glue layer" code.
  */
 
 #include <common.h>
+#include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/usb/musb.h>
 #include "linux-compat.h"
 #include "musb_core.h"
@@ -252,9 +253,11 @@ static int musb_usb_probe(struct udevice *dev)
        ret = musb_lowlevel_init(mdata);
 #else
        pic32_musb_plat.mode = MUSB_PERIPHERAL;
-       ret = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+       mdata->host = musb_register(&pic32_musb_plat, &pdata->dev, mregs);
+       if (!mdata->host)
+               return -EIO;
 #endif
-       if (ret == 0)
+       if ((ret == 0) && mdata->host)
                printf("PIC32 MUSB OTG\n");
 
        return ret;