Merge branch 'master' of git://git.denx.de/u-boot-usb
[oweals/u-boot.git] / drivers / usb / musb-new / sunxi.c
index 5eb8d19b740a76f34b6d105ae502ae7ce159756b..3081afca0e28befb2ccb50ee41dfc238de18a8ab 100644 (file)
  *
  * This file is part of the Inventra Controller Driver for Linux.
  *
- * The Inventra Controller Driver for Linux is free software; you
- * can redistribute it and/or modify it under the terms of the GNU
- * General Public License version 2 as published by the Free Software
- * Foundation.
- *
+ * SPDX-License-Identifier:    GPL-2.0
  */
 #include <common.h>
 #include <asm/arch/cpu.h>
@@ -205,6 +201,7 @@ static irqreturn_t sunxi_musb_interrupt(int irq, void *__hci)
 
 /* musb_core does not call enable / disable in a balanced manner <sigh> */
 static bool enabled = false;
+static struct musb *sunxi_musb;
 
 static int sunxi_musb_enable(struct musb *musb)
 {
@@ -324,13 +321,15 @@ int musb_usb_probe(struct udevice *dev)
 
        priv->desc_before_addr = true;
 
-       if (!host->host) {
-               host->host = musb_init_controller(&musb_plat, NULL,
+       if (!sunxi_musb) {
+               sunxi_musb = musb_init_controller(&musb_plat, NULL,
                                                  (void *)SUNXI_USB0_BASE);
-               if (!host->host)
-                       return -EIO;
        }
 
+       host->host = sunxi_musb;
+       if (!host->host)
+               return -EIO;
+
        ret = musb_lowlevel_init(host);
        if (ret == 0)
                printf("MUSB OTG\n");