fastboot: Move fastboot to drivers/fastboot

Separate CMD_FASTBOOT from FASTBOOT and move code and configuration to
drivers/fastboot.

Switch dependencies on FASTBOOT to USB_FUNCTION_FASTBOOT as anyone who wants
FASTBOOT before this series wants USB_FUNCTION_FASTBOOT. Split
USB_FUNCTION_FASTBOOT from FASTBOOT so they retain their existing
behaviour.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/cmd/Kconfig b/cmd/Kconfig
index d532c9f..9848c06 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -137,8 +137,6 @@
 
 endmenu
 
-source "cmd/fastboot/Kconfig"
-
 config BUILD_BIN2C
 	bool
 
@@ -650,6 +648,18 @@
 	  can be useful to see the state of driver model for debugging or
 	  interest.
 
+config CMD_FASTBOOT
+	bool "fastboot - Android fastboot support"
+	depends on FASTBOOT
+	help
+	  This enables the command "fastboot" which enables the Android
+	  fastboot mode for the platform. Fastboot is a protocol for
+	  downloading images, flashing and device control used on
+	  Android devices. Fastboot requires support for acting as a USB
+	  device.
+
+	  See doc/README.android-fastboot for more information.
+
 config CMD_FDC
 	bool "fdcboot - Boot from floppy device"
 	help
diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig
deleted file mode 100644
index 0d2c2f1..0000000
--- a/cmd/fastboot/Kconfig
+++ /dev/null
@@ -1,134 +0,0 @@
-comment "FASTBOOT"
-
-menuconfig FASTBOOT
-	bool "Fastboot support"
-	depends on USB_GADGET
-	default y if ARCH_SUNXI && USB_MUSB_GADGET
-
-if FASTBOOT
-
-config USB_FUNCTION_FASTBOOT
-	bool "Enable USB fastboot gadget"
-	default y
-	select USB_GADGET_DOWNLOAD
-	imply ANDROID_BOOT_IMAGE
-	imply CMD_FASTBOOT
-	help
-	  This enables the USB part of the fastboot gadget.
-
-config CMD_FASTBOOT
-	bool "Enable FASTBOOT command"
-	help
-	  This enables the command "fastboot" which enables the Android
-	  fastboot mode for the platform's USB device. Fastboot is a USB
-	  protocol for downloading images, flashing and device control
-	  used on Android devices.
-
-	  See doc/README.android-fastboot for more information.
-
-if USB_FUNCTION_FASTBOOT
-
-config FASTBOOT_BUF_ADDR
-	hex "Define FASTBOOT buffer address"
-	default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
-	default 0x81000000 if ARCH_OMAP2PLUS
-	default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
-	default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
-	default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
-				ROCKCHIP_RK322X
-	default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
-				ROCKCHIP_RK3399
-	default 0x280000 if ROCKCHIP_RK3368
-	default 0x100000 if ARCH_ZYNQMP
-	help
-	  The fastboot protocol requires a large memory buffer for
-	  downloads. Define this to the starting RAM address to use for
-	  downloaded images.
-
-config FASTBOOT_BUF_SIZE
-	hex "Define FASTBOOT buffer size"
-	default 0x8000000 if ARCH_ROCKCHIP
-	default 0x6000000 if ARCH_ZYNQMP
-	default 0x2000000 if ARCH_SUNXI
-	default 0x7000000
-	help
-	  The fastboot protocol requires a large memory buffer for
-	  downloads. This buffer should be as large as possible for a
-	  platform. Define this to the size available RAM for fastboot.
-
-config FASTBOOT_USB_DEV
-	int "USB controller number"
-	default 0
-	help
-	  Some boards have USB OTG controller other than 0. Define this
-	  option so it can be used in compiled environment (e.g. in
-	  CONFIG_BOOTCOMMAND).
-
-config FASTBOOT_FLASH
-	bool "Enable FASTBOOT FLASH command"
-	default y if ARCH_SUNXI
-	help
-	  The fastboot protocol includes a "flash" command for writing
-	  the downloaded image to a non-volatile storage device. Define
-	  this to enable the "fastboot flash" command.
-
-choice
-	prompt "Flash provider for FASTBOOT"
-	depends on FASTBOOT_FLASH
-
-config FASTBOOT_FLASH_MMC
-	bool "FASTBOOT on MMC"
-	depends on MMC
-
-config FASTBOOT_FLASH_NAND
-	bool "FASTBOOT on NAND"
-	depends on NAND
-
-endchoice
-
-config FASTBOOT_FLASH_MMC_DEV
-	int "Define FASTBOOT MMC FLASH default device"
-	depends on FASTBOOT_FLASH_MMC
-	default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
-	default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
-	help
-	  The fastboot "flash" command requires additional information
-	  regarding the non-volatile storage device. Define this to
-	  the eMMC device that fastboot should use to store the image.
-
-config FASTBOOT_FLASH_NAND_DEV
-	int "Define FASTBOOT NAND FLASH default device"
-	depends on FASTBOOT_FLASH_NAND
-	depends on CMD_MTDPARTS
-	default 0 if ARCH_SUNXI && NAND_SUNXI
-	help
-	  The fastboot "flash" command requires additional information
-	  regarding the non-volatile storage device. Define this to
-	  the NAND device that fastboot should use to store the image.
-
-config FASTBOOT_GPT_NAME
-	string "Target name for updating GPT"
-	depends on FASTBOOT_FLASH
-	default "gpt"
-	help
-	  The fastboot "flash" command supports writing the downloaded
-	  image to the Protective MBR and the Primary GUID Partition
-	  Table. (Additionally, this downloaded image is post-processed
-	  to generate and write the Backup GUID Partition Table.)
-	  This occurs when the specified "partition name" on the
-	  "fastboot flash" command line matches the value defined here.
-	  The default target name for updating GPT is "gpt".
-
-config FASTBOOT_MBR_NAME
-	string "Target name for updating MBR"
-	depends on FASTBOOT_FLASH
-	default "mbr"
-	help
-	  The fastboot "flash" command allows to write the downloaded image
-	  to the Master Boot Record. This occurs when the "partition name"
-	  specified on the "fastboot flash" command line matches the value
-	  defined here. The default target name for updating MBR is "mbr".
-
-endif # USB_FUNCTION_FASTBOOT
-
-endif # FASTBOOT