injected into the FIT creation (i.e. the blobs would have been pre-
          processed before being added to the FIT image).
 
-config SPL_DFU_SUPPORT
-       bool "Enable SPL with DFU to load binaries to memory device"
-       depends on USB
-       help
-         Currently the SPL does not have capability to load the
-         binaries or boot images to boot devices like ram,eMMC,SPI,etc.
-         This feature enables the DFU (Device Firmware Upgarde) in SPL with
-         RAM memory device support. The ROM code will load and execute
-         the SPL built with dfu. The user can load binaries (u-boot/kernel) to
-         selected device partition from host-pc using dfu-utils.
-               This feature will be useful to flash the binaries to factory
-         or bare-metal boards using USB interface.
-
-choice
-       bool "DFU device selection"
-       depends on SPL_DFU_SUPPORT
-
-config SPL_DFU_RAM
-       bool "RAM device"
-       depends on SPL_DFU_SUPPORT
-       help
-        select RAM/DDR memory device for loading binary images
-        (u-boot/kernel) to the selected device partition using
-        DFU and execute the u-boot/kernel from RAM.
-
-endchoice
-
 config SYS_CLK_FREQ
        depends on ARC || ARCH_SUNXI
        int "CPU clock frequency"
 
          config options. This enables loading from USB using a configured
          device.
 
+config SPL_DFU_SUPPORT
+       bool "Support DFU (Device Firmware Upgarde)"
+       depends on SPL
+       select SPL_HASH_SUPPORT
+       help
+         This feature enables the DFU (Device Firmware Upgarde) in SPL with
+         RAM memory device support. The ROM code will load and execute
+         the SPL built with dfu. The user can load binaries (u-boot/kernel) to
+         selected device partition from host-pc using dfu-utils.
+         This feature is useful to flash the binaries to factory or bare-metal
+         boards using USB interface.
+
+choice
+       bool "DFU device selection"
+       depends on SPL_DFU_SUPPORT
+
+config SPL_DFU_RAM
+       bool "RAM device"
+       depends on SPL_DFU_SUPPORT
+       help
+        select RAM/DDR memory device for loading binary images
+        (u-boot/kernel) to the selected device partition using
+        DFU and execute the u-boot/kernel from RAM.
+
+endchoice
+
 config SPL_WATCHDOG_SUPPORT
        bool "Support watchdog drivers"
        depends on SPL
 
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
 obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
 obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
 
 obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
 obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
+endif
+
 # new USB gadget layer dependencies
 ifdef CONFIG_USB_GADGET
 obj-$(CONFIG_USB_GADGET_AT91) += at91_udc.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
 obj-$(CONFIG_CI_UDC)   += ci_udc.o
 obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
-obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
-endif
 obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
 obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
 endif
+endif
 ifdef CONFIG_USB_ETHER
 obj-y += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
 
 #undef CONFIG_CMD_BOOTD
 #ifdef CONFIG_SPL_DFU_SUPPORT
 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
-#define CONFIG_SPL_HASH_SUPPORT
 #define DFU_ALT_INFO_RAM \
        "dfu_alt_info_ram=" \
        "kernel ram 0x80200000 0x4000000;" \
 
 
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/
 libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/