]> git.sur5r.net Git - u-boot/commitdiff
usb: fastboot: Convert USB f_fastboot to shared fastboot
authorAlex Kiernan <alex.kiernan@gmail.com>
Tue, 29 May 2018 15:30:55 +0000 (15:30 +0000)
committerMarek Vasut <marex@denx.de>
Wed, 30 May 2018 09:59:21 +0000 (11:59 +0200)
Convert USB fastboot code to use shared fastboot protocol.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
39 files changed:
configs/A13-OLinuXino_defconfig
configs/A20-OLinuXino-Lime2-eMMC_defconfig
configs/A20-OLinuXino-Lime2_defconfig
configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
configs/A20-Olimex-SOM204-EVB_defconfig
configs/Bananapi_m2m_defconfig
configs/Cubietruck_defconfig
configs/Sinlinx_SinA33_defconfig
configs/am335x_boneblack_defconfig
configs/am57xx_evm_defconfig
configs/am57xx_hs_evm_defconfig
configs/chromebit_mickey_defconfig
configs/chromebook_jerry_defconfig
configs/chromebook_minnie_defconfig
configs/dra7xx_evm_defconfig
configs/dra7xx_hs_evm_defconfig
configs/evb-rk3036_defconfig
configs/evb-rk3128_defconfig
configs/evb-rk3229_defconfig
configs/evb-rk3288_defconfig
configs/evb-rk3328_defconfig
configs/fennec-rk3288_defconfig
configs/firefly-rk3288_defconfig
configs/kylin-rk3036_defconfig
configs/miqi-rk3288_defconfig
configs/parrot_r16_defconfig
configs/phycore-rk3288_defconfig
configs/popmetal-rk3288_defconfig
configs/rock2_defconfig
configs/stih410-b2260_defconfig
configs/tbs_a711_defconfig
configs/tinker-rk3288_defconfig
configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
configs/xilinx_zynqmp_zcu102_revA_defconfig
configs/xilinx_zynqmp_zcu102_revB_defconfig
configs/xilinx_zynqmp_zcu106_revA_defconfig
drivers/fastboot/Makefile
drivers/usb/gadget/f_fastboot.c

index 8e160d7cc4a8feb46b994f0908b357d43cdbaf4b..b8ec1e54dbcb4b83858632ced0872f8d30a8c314 100644 (file)
@@ -22,6 +22,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_AXP_ALDO3_VOLT=3300
 CONFIG_CONS_INDEX=2
 CONFIG_USB_EHCI_HCD=y
index 9d043e856a424403b57721cbd042bfa611f92e65..5657fc2594c2db153026824317f270893ad2bc3f 100644 (file)
@@ -20,6 +20,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index f2997c6fe54ca0567716b8a8f278de3a7fb917b2..134d1d3fef69add316087f88976d5a0b00e04209 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index 847945b6490801d09c38c808a265240188747939..3bb8c4c7e66702ef75d18e23564db3ad4e90c725 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_PHY_ADDR=3
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
index e56f2c71109b4da390cbed4ad6f002e1d592e303..cfb7ffa556f2c4c4bd07572e43c75a5d8ce35e1e 100644 (file)
@@ -17,6 +17,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_PHY_ADDR=3
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
index 2032a4aef8d9034a4cb53cc3d94fb98daeb7ec2a..2316437c9441c0b03662b67343cbdd4edf96f4c8 100644 (file)
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-r16-bananapi-m2m"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
index f0bb4c9d5ce7155b73721c625fb91dfab5b14c06..601eb3ca0c0c4fb474b55afff6ae1d93d3de4bd3 100644 (file)
@@ -21,6 +21,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_SCSI_AHCI=y
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_SUN7I_GMAC=y
index 9e6267200b75ae36f74f830cca5b5e519ed533c8..394534b8b55ecd6e7365414c4f1461af84ab93e4 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_CMD_DFU=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
index bd3a37427df84fa18442b478cedb57334e51a847..31d2fe9cbfd19bece231a45262b2dc1a71483589 100644 (file)
@@ -16,9 +16,6 @@ CONFIG_AUTOBOOT_KEYED=y
 CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n"
 CONFIG_AUTOBOOT_DELAY_STR="d"
 CONFIG_AUTOBOOT_STOP_STR=" "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -28,6 +25,10 @@ CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_DFU_TFTP=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
index 3b83b69e5f41b6e070199e09fca924cd57150e41..2d8e64e613aab3f03b34f7fff88d74eeb65a3e4e 100644 (file)
@@ -24,12 +24,6 @@ CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_USB_DEV=1
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -45,6 +39,13 @@ CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_USB_DEV=1
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
index 9c2aef482f7ff757fb8b85bc0c0a118f887a07c5..3a73fdb2ca9d276d16cb0898b09eff6de73ded08 100644 (file)
@@ -29,12 +29,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_USB_DEV=1
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
@@ -48,6 +42,13 @@ CONFIG_SCSI_AHCI=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_USB_DEV=1
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_MMC=y
index d1728ef6395ca67d891dc8efdd012de1445f8fa1..72ecdc69f6bfba160b7d8b4eacf86e8c24bb6f42 100644 (file)
@@ -16,8 +16,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -44,6 +42,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index 43d93f4637ad5ad74d4f9a7136c142254756cc0a..fb8400d06ef879ff8986216755e1c3733180fdc1 100644 (file)
@@ -18,8 +18,6 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -46,6 +44,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index 706809ca53fb8d70f8b1e699ba808acbef32c93b..a8776c9adfb80dd8fcaae2e91f10213bde793b3e 100644 (file)
@@ -17,8 +17,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -45,6 +43,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
index b766ba27cda0c39ba0489342f48385a396dd552c..182f9a9ebfab6daf8838c5b9b52e8f5c1de96c8a 100644 (file)
@@ -25,11 +25,6 @@ CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
@@ -50,6 +45,12 @@ CONFIG_DWC_AHCI=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
index 39a6801216f927ac8d9b42db971b2941601cd3f5..8584d41f1aa4100dd938329b07cc06b631492996 100644 (file)
@@ -30,11 +30,6 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x82000000
-CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
@@ -50,6 +45,12 @@ CONFIG_DWC_AHCI=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x82000000
+CONFIG_FASTBOOT_BUF_SIZE=0x2F000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_DM_GPIO=y
 CONFIG_PCF8575_GPIO=y
 CONFIG_DM_I2C=y
index 33775e8cdddbf1592aaf375a0b67f9c730dc6d8c..b9242e83e0a24501750ec20dcad59f6bad96d05e 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -31,6 +29,9 @@ CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index 796d0ec92e67110a50af9c8f174980d4b84412ad..9c8252e95f6bae3b5a2452f7d11d7fdbe6530432 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_FASTBOOT_BUF_ADDR=0x60800800
-CONFIG_FASTBOOT_BUF_SIZE=0x04000000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -20,6 +16,11 @@ CONFIG_CMD_TIME=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_BUF_ADDR=0x60800800
+CONFIG_FASTBOOT_BUF_SIZE=0x04000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 710b0b4e1a99afc8eab17d3a4eab88a849c9b333..7298bf1963ee7c6e6bcb94c9a441bc72b328947e 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
@@ -30,6 +28,9 @@ CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 7695277daf350427d1b3b20688ba5a1fbb423ad8..a7beaa67288494f6124fd3ea14e608da3f641d31 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -41,6 +39,9 @@ CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index 78ae24b56b27fecf4e2d5c14c47ab317e72b6b9a..59bf9e519787fd429844e9d24d6ef60b5eb3959b 100644 (file)
@@ -8,9 +8,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_FASTBOOT_BUF_ADDR=0x800800
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=1
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
@@ -23,6 +20,10 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_BUF_ADDR=0x800800
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=1
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index efdd583cf6e5b34786aeea37cc55a27eeb8880b8..dbd6be55e240721f392af91c2fa6c4a0918310a7 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index b252d2746403e16cbaa1fb072945c50749ff8b00..83b4968c4a7fa3f3adaeae876ecb8edb6e9a8ef2 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_DM_KEYBOARD=y
index ca53005ecb3de0fad14fd90c07121abf839948eb..373764aaf18e3831ee96b020e9cbd876d69a88ef 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
@@ -31,6 +29,9 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
index f44537c88f40d7dc4d8ceaa1edf69df09ce6cd6d..5bfcb0c90bf14fdaa65e0b815de0215fba6dcc4f 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 991e9b99aaba75eef2ff2051366cdb48cda39fdc..553a8d6572886519c9e5b899672f786148b15959 100644 (file)
@@ -15,6 +15,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-r16-parrot"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_PARTITION_UUIDS is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_CONS_INDEX=5
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
index d78b6d57b6b87a9fc315bff0258db1b35bff1013..fc3b81c43c11ec114a65e39ab02afdd9d0139995 100644 (file)
@@ -17,8 +17,6 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_POWER_SUPPORT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -44,6 +42,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
index 2670b4b75aef890af8add7d19bdf55ee4a5ee55c..84c099560fa19c0b296581e00a33ccfac54290f4 100644 (file)
@@ -15,8 +15,6 @@ CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index cd9a82197464f7ed87091355e95be54719512b11..01d53ac1c394b81393c06a5050be189e604f2afd 100644 (file)
@@ -14,8 +14,6 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -42,6 +40,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
index 7d990f9a34f338b1d07f676e3d292a30a4f4dbf2..ba1ff25d355487e3c3329eb6e34dd072572a5ed3 100644 (file)
@@ -10,11 +10,6 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAS1,115200 CONSOLE=/dev/ttyAS1 consoleblank=0 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait mem=992M@0x40000000 vmalloc=256m"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SYS_PROMPT="stih410-b2260 => "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_BUF_ADDR=0x40000000
-CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
@@ -26,6 +21,12 @@ CONFIG_OF_CONTROL=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x40000000
+CONFIG_FASTBOOT_BUF_SIZE=0x3DF00000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_MISC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_STI=y
index 3e3de4fbb30906a80af685ae067c387aeff1251e..5d58f5ceb4e24b4b5dc39f3696a764fd6e062007 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-tbs-a711"
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_AXP_DCDC5_VOLT=1200
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
index fb6bfa57ad7f917008020650cace9dadc371dc5f..e1c99c3828d7662abdd9903df131f852c21719de 100644 (file)
@@ -16,8 +16,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_SPL_I2C_SUPPORT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -43,6 +41,9 @@ CONFIG_SPL_SYSCON=y
 # CONFIG_SPL_SIMPLE_BUS is not set
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MISC=y
index 9e4886d0647ed5b56220150ba193f208e6971001..b4521aab43e5d519d3bce629c8c82bc991b10fb5 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_SYS_ALT_MEMTEST=y
@@ -47,6 +44,10 @@ CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index 29743bdb1e65386be632022506da2be9a8365053..976640cae06f6190c906cf26d65d18e94ea05bfb 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -50,6 +47,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index cc4118230e65d4654edd6f0222f729dceac74652..3420ce5dc34aab6639c7c5c058e9a674f8410db7 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -50,6 +47,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index ae791c356781d8aa2b357df10674afa344e6350e..a9ba4a17e9a3acb17a487d3c0f206811cfed2a39 100644 (file)
@@ -19,9 +19,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -50,6 +47,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index 34e3c857e2169ed0106e47e69118f8508161a071..32c6f232106c675e80947b150d2fc7e00bc3077f 100644 (file)
@@ -18,9 +18,6 @@ CONFIG_SPL_RAM_SUPPORT=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="ZynqMP> "
-CONFIG_USB_FUNCTION_FASTBOOT=y
-CONFIG_FASTBOOT_FLASH=y
-CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_CMD_THOR_DOWNLOAD=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_MEMTEST=y
@@ -48,6 +45,10 @@ CONFIG_SCSI_AHCI=y
 CONFIG_SATA_CEVA=y
 CONFIG_CLK_ZYNQMP=y
 CONFIG_DFU_RAM=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_FPGA_XILINX=y
 CONFIG_FPGA_ZYNQMPPL=y
 CONFIG_DM_GPIO=y
index 8831096181488059f892377f0ba270fe0d0199ec..a2421565e238bc10d7bceccbf6a9f305b5ba6a4b 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier:      GPL-2.0+
 
 obj-y += fb_common.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_getvar.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_command.o
+obj-y += fb_getvar.o
+obj-y += fb_command.o
 obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
 obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
index 07d6a6215546c7f5ba2c41935d3daf91adf155ca..3ad4346f2d099b77a243dc88394b24f409408473 100644 (file)
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <linux/compiler.h>
-#include <version.h>
 #include <g_dnl.h>
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-#include <fb_mmc.h>
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND
-#include <fb_nand.h>
-#endif
 
 #define FASTBOOT_INTERFACE_CLASS       0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
@@ -56,8 +49,6 @@ static inline struct f_fastboot *func_to_fastboot(struct usb_function *f)
 }
 
 static struct f_fastboot *fastboot_func;
-static unsigned int download_size;
-static unsigned int download_bytes;
 
 static struct usb_endpoint_descriptor fs_ep_in = {
        .bLength            = USB_DT_ENDPOINT_SIZE,
@@ -145,7 +136,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
-static int strcmp_l1(const char *s1, const char *s2);
 
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
@@ -355,85 +345,9 @@ static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
        do_reset(NULL, 0, 0, NULL);
 }
 
-static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       if (!strcmp_l1("reboot-bootloader", cmd)) {
-               if (fastboot_set_reboot_flag()) {
-                       fastboot_tx_write_str("FAILCannot set reboot flag");
-                       return;
-               }
-       }
-       fastboot_func->in_req->complete = compl_do_reset;
-       fastboot_tx_write_str("OKAY");
-}
-
-static int strcmp_l1(const char *s1, const char *s2)
-{
-       if (!s1 || !s2)
-               return -1;
-       return strncmp(s1, s2, strlen(s1));
-}
-
-static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
-       const char *s;
-       size_t chars_left;
-
-       strcpy(response, "OKAY");
-       chars_left = sizeof(response) - strlen(response) - 1;
-
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing variable");
-               fastboot_tx_write_str("FAILmissing var");
-               return;
-       }
-
-       if (!strcmp_l1("version", cmd)) {
-               strncat(response, FASTBOOT_VERSION, chars_left);
-       } else if (!strcmp_l1("bootloader-version", cmd)) {
-               strncat(response, U_BOOT_VERSION, chars_left);
-       } else if (!strcmp_l1("downloadsize", cmd) ||
-               !strcmp_l1("max-download-size", cmd)) {
-               char str_num[12];
-
-               sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
-               strncat(response, str_num, chars_left);
-       } else if (!strcmp_l1("serialno", cmd)) {
-               s = env_get("serial#");
-               if (s)
-                       strncat(response, s, chars_left);
-               else
-                       strcpy(response, "FAILValue not set");
-       } else {
-               char *envstr;
-
-               envstr = malloc(strlen("fastboot.") + strlen(cmd) + 1);
-               if (!envstr) {
-                       fastboot_tx_write_str("FAILmalloc error");
-                       return;
-               }
-
-               sprintf(envstr, "fastboot.%s", cmd);
-               s = env_get(envstr);
-               if (s) {
-                       strncat(response, s, chars_left);
-               } else {
-                       printf("WARNING: unknown variable: %s\n", cmd);
-                       strcpy(response, "FAILVariable not implemented");
-               }
-
-               free(envstr);
-       }
-       fastboot_tx_write_str(response);
-}
-
 static unsigned int rx_bytes_expected(struct usb_ep *ep)
 {
-       int rx_remain = download_size - download_bytes;
+       int rx_remain = fastboot_data_remaining();
        unsigned int rem;
        unsigned int maxpacket = ep->maxpacket;
 
@@ -455,14 +369,12 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
        return rx_remain;
 }
 
-#define BYTES_PER_DOT  0x20000
 static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
 {
-       char response[FASTBOOT_RESPONSE_LEN];
-       unsigned int transfer_size = download_size - download_bytes;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+       unsigned int transfer_size = fastboot_data_remaining();
        const unsigned char *buffer = req->buf;
        unsigned int buffer_size = req->actual;
-       unsigned int pre_dot_num, now_dot_num;
 
        if (req->status != 0) {
                printf("Bad status: %d\n", req->status);
@@ -472,33 +384,19 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
        if (buffer_size < transfer_size)
                transfer_size = buffer_size;
 
-       memcpy((void *)CONFIG_FASTBOOT_BUF_ADDR + download_bytes,
-              buffer, transfer_size);
-
-       pre_dot_num = download_bytes / BYTES_PER_DOT;
-       download_bytes += transfer_size;
-       now_dot_num = download_bytes / BYTES_PER_DOT;
-
-       if (pre_dot_num != now_dot_num) {
-               putc('.');
-               if (!(now_dot_num % 74))
-                       putc('\n');
-       }
+       fastboot_data_download(buffer, transfer_size, response);
+       if (response[0]) {
+               fastboot_tx_write_str(response);
+       } else if (!fastboot_data_remaining()) {
+               fastboot_data_complete(response);
 
-       /* Check if transfer is done */
-       if (download_bytes >= download_size) {
                /*
-                * Reset global transfer variable, keep download_bytes because
-                * it will be used in the next possible flashing command
+                * Reset global transfer variable
                 */
-               download_size = 0;
                req->complete = rx_handler_command;
                req->length = EP_BUFFER_SIZE;
 
-               strcpy(response, "OKAY");
                fastboot_tx_write_str(response);
-
-               printf("\ndownloading of %d bytes finished\n", download_bytes);
        } else {
                req->length = rx_bytes_expected(ep);
        }
@@ -507,197 +405,55 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
        usb_ep_queue(ep, req, 0);
 }
 
-static void cb_download(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
-
-       strsep(&cmd, ":");
-       download_size = simple_strtoul(cmd, NULL, 16);
-       download_bytes = 0;
-
-       printf("Starting download of %d bytes\n", download_size);
-
-       if (0 == download_size) {
-               strcpy(response, "FAILdata invalid size");
-       } else if (download_size > CONFIG_FASTBOOT_BUF_SIZE) {
-               download_size = 0;
-               strcpy(response, "FAILdata too large");
-       } else {
-               sprintf(response, "DATA%08x", download_size);
-               req->complete = rx_handler_dl_image;
-               req->length = rx_bytes_expected(ep);
-       }
-       fastboot_tx_write_str(response);
-}
-
-static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
-{
-       char boot_addr_start[12];
-       char *bootm_args[] = { "bootm", boot_addr_start, NULL };
-
-       puts("Booting kernel..\n");
-
-       sprintf(boot_addr_start, "0x%lx", (long)CONFIG_FASTBOOT_BUF_ADDR);
-       do_bootm(NULL, 0, 2, bootm_args);
-
-       /* This only happens if image is somehow faulty so we start over */
-       do_reset(NULL, 0, 0, NULL);
-}
-
-static void cb_boot(struct usb_ep *ep, struct usb_request *req)
-{
-       fastboot_func->in_req->complete = do_bootm_on_complete;
-       fastboot_tx_write_str("OKAY");
-}
-
 static void do_exit_on_complete(struct usb_ep *ep, struct usb_request *req)
 {
        g_dnl_trigger_detach();
 }
 
-static void cb_continue(struct usb_ep *ep, struct usb_request *req)
+static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
 {
-       fastboot_func->in_req->complete = do_exit_on_complete;
-       fastboot_tx_write_str("OKAY");
+       fastboot_boot();
+       do_exit_on_complete(ep, req);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH
-static void cb_flash(struct usb_ep *ep, struct usb_request *req)
+static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
 {
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
+       char *cmdbuf = req->buf;
+       char response[FASTBOOT_RESPONSE_LEN] = {0};
+       int cmd = -1;
 
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing partition name");
-               fastboot_tx_write_str("FAILmissing partition name");
+       if (req->status != 0 || req->length == 0)
                return;
-       }
-
-       fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-       fastboot_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-                                download_bytes, response);
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND
-       fastboot_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-                                 download_bytes, response);
-#endif
-       fastboot_tx_write_str(response);
-}
-#endif
 
-static void cb_oem(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-       if (strncmp("format", cmd + 4, 6) == 0) {
-               char cmdbuf[32];
-                sprintf(cmdbuf, "gpt write mmc %x $partitions",
-                       CONFIG_FASTBOOT_FLASH_MMC_DEV);
-                if (run_command(cmdbuf, 0))
-                       fastboot_tx_write_str("FAIL");
-                else
-                       fastboot_tx_write_str("OKAY");
-       } else
-#endif
-       if (strncmp("unlock", cmd + 4, 8) == 0) {
-               fastboot_tx_write_str("FAILnot implemented");
-       }
-       else {
-               fastboot_tx_write_str("FAILunknown oem command");
+       if (req->actual < req->length) {
+               cmdbuf[req->actual] = '\0';
+               cmd = fastboot_handle_command(cmdbuf, response);
+       } else {
+               pr_err("buffer overflow");
+               fastboot_fail("buffer overflow", response);
        }
-}
 
-#ifdef CONFIG_FASTBOOT_FLASH
-static void cb_erase(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmd = req->buf;
-       char response[FASTBOOT_RESPONSE_LEN];
-
-       strsep(&cmd, ":");
-       if (!cmd) {
-               pr_err("missing partition name");
-               fastboot_tx_write_str("FAILmissing partition name");
-               return;
+       if (!strncmp("DATA", response, 4)) {
+               req->complete = rx_handler_dl_image;
+               req->length = rx_bytes_expected(ep);
        }
 
-       fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-       fastboot_mmc_erase(cmd, response);
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND
-       fastboot_nand_erase(cmd, response);
-#endif
        fastboot_tx_write_str(response);
-}
-#endif
 
-struct cmd_dispatch_info {
-       char *cmd;
-       void (*cb)(struct usb_ep *ep, struct usb_request *req);
-};
-
-static const struct cmd_dispatch_info cmd_dispatch_info[] = {
-       {
-               .cmd = "reboot",
-               .cb = cb_reboot,
-       }, {
-               .cmd = "getvar:",
-               .cb = cb_getvar,
-       }, {
-               .cmd = "download:",
-               .cb = cb_download,
-       }, {
-               .cmd = "boot",
-               .cb = cb_boot,
-       }, {
-               .cmd = "continue",
-               .cb = cb_continue,
-       },
-#ifdef CONFIG_FASTBOOT_FLASH
-       {
-               .cmd = "flash",
-               .cb = cb_flash,
-       }, {
-               .cmd = "erase",
-               .cb = cb_erase,
-       },
-#endif
-       {
-               .cmd = "oem",
-               .cb = cb_oem,
-       },
-};
-
-static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
-{
-       char *cmdbuf = req->buf;
-       void (*func_cb)(struct usb_ep *ep, struct usb_request *req) = NULL;
-       int i;
-
-       if (req->status != 0 || req->length == 0)
-               return;
+       if (!strncmp("OKAY", response, 4)) {
+               switch (cmd) {
+               case FASTBOOT_COMMAND_BOOT:
+                       fastboot_func->in_req->complete = do_bootm_on_complete;
+                       break;
 
-       for (i = 0; i < ARRAY_SIZE(cmd_dispatch_info); i++) {
-               if (!strcmp_l1(cmd_dispatch_info[i].cmd, cmdbuf)) {
-                       func_cb = cmd_dispatch_info[i].cb;
+               case FASTBOOT_COMMAND_CONTINUE:
+                       fastboot_func->in_req->complete = do_exit_on_complete;
                        break;
-               }
-       }
 
-       if (!func_cb) {
-               pr_err("unknown command: %.*s", req->actual, cmdbuf);
-               fastboot_tx_write_str("FAILunknown command");
-       } else {
-               if (req->actual < req->length) {
-                       u8 *buf = (u8 *)req->buf;
-                       buf[req->actual] = 0;
-                       func_cb(ep, req);
-               } else {
-                       pr_err("buffer overflow");
-                       fastboot_tx_write_str("FAILbuffer overflow");
+               case FASTBOOT_COMMAND_REBOOT:
+               case FASTBOOT_COMMAND_REBOOT_BOOTLOADER:
+                       fastboot_func->in_req->complete = compl_do_reset;
+                       break;
                }
        }