Merge branch 'master' of git://git.denx.de/u-boot
[oweals/u-boot.git] / common / spl / spl_net.c
index 33f3b74a970970e36b8d039985280aee2f1af117..30c050c0b3e6c0767bf1d607ab63037f919da7a7 100644 (file)
@@ -1,13 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2000-2004
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
  * (C) Copyright 2012
  * Ilya Yanok <ilya.yanok@gmail.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <env.h>
 #include <errno.h>
 #include <spl.h>
 #include <net.h>
@@ -19,14 +19,14 @@ static ulong spl_net_load_read(struct spl_load_info *load, ulong sector,
 {
        debug("%s: sector %lx, count %lx, buf %lx\n",
              __func__, sector, count, (ulong)buf);
-       memcpy(buf, (void *)(load_addr + sector), count);
+       memcpy(buf, (void *)(image_load_addr + sector), count);
        return count;
 }
 
 static int spl_net_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
-       struct image_header *header = (struct image_header *)load_addr;
+       struct image_header *header = (struct image_header *)image_load_addr;
        int rv;
 
        env_init();
@@ -86,7 +86,9 @@ int spl_net_load_image_usb(struct spl_image_info *spl_image,
                           struct spl_boot_device *bootdev)
 {
        bootdev->boot_device_name = "usb_ether";
-
+#if CONFIG_IS_ENABLED(DM_USB_GADGET)
+       usb_ether_init();
+#endif
        return spl_net_load_image(spl_image, bootdev);
 }
 SPL_LOAD_IMAGE_METHOD("USB eth", 0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);