[U-Boot] [PATCH v3 6/6] config: enable DFU over USB on Raspberry Pi4 boards

Matthias Brugger mbrugger at suse.com
Tue Nov 19 16:05:43 UTC 2019



On 15/11/2019 14:47, Marek Szyprowski wrote:
> Enable support for DFU over USB. This requires to enable USB gadget,
> DWC2 UDC OTG driver and DFU command. DFU entities are defined for the
> following firmware objects: u-boot.bin, uboot.env, config.txt and
> zImage/Image.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
> Reviewed-by: Lukasz Majewski <lukma at denx.de>

Looks good, I submitted the whole series for inclusion in v2020.01

Regards,
Matthias

> ---
> Changelog:
> v3:
> - fixed non-RPi4 builds (missing #else ENV_DFU_SETTINGS def)
> - removed config.txt entity (not needed in uboot-based boot)
> - switched arm64 kernel filename to 'Image'
> ---
>  configs/rpi_4_32b_defconfig | 11 +++++++++++
>  configs/rpi_4_defconfig     | 11 +++++++++++
>  include/configs/rpi.h       | 20 ++++++++++++++++++++
>  3 files changed, 42 insertions(+)
> 
> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> index dc696906fd..a0ba8782bc 100644
> --- a/configs/rpi_4_32b_defconfig
> +++ b/configs/rpi_4_32b_defconfig
> @@ -11,6 +11,7 @@ CONFIG_MISC_INIT_R=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_SYS_PROMPT="U-Boot> "
> +CONFIG_CMD_DFU=y
>  # CONFIG_CMD_FLASH is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_CMD_MMC=y
> @@ -19,6 +20,7 @@ CONFIG_OF_BOARD=y
>  CONFIG_ENV_FAT_INTERFACE="mmc"
>  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
> +CONFIG_DFU_MMC=y
>  CONFIG_DM_KEYBOARD=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
> @@ -26,6 +28,15 @@ CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_PINCTRL=y
>  # CONFIG_PINCTRL_GENERIC is not set
>  # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
> +CONFIG_USB=y
> +CONFIG_DM_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="FSL"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0525
> +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
> +CONFIG_USB_GADGET_DWC2_OTG=y
> +CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_DM_VIDEO=y
>  CONFIG_SYS_WHITE_ON_BLACK=y
>  CONFIG_CONSOLE_SCROLL_LINES=10
> diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
> index 2954e17ac3..2fcd56ebf3 100644
> --- a/configs/rpi_4_defconfig
> +++ b/configs/rpi_4_defconfig
> @@ -11,6 +11,7 @@ CONFIG_MISC_INIT_R=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_SYS_PROMPT="U-Boot> "
> +CONFIG_CMD_DFU=y
>  # CONFIG_CMD_FLASH is not set
>  CONFIG_CMD_GPIO=y
>  CONFIG_CMD_MMC=y
> @@ -19,6 +20,7 @@ CONFIG_OF_BOARD=y
>  CONFIG_ENV_FAT_INTERFACE="mmc"
>  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
> +CONFIG_DFU_MMC=y
>  CONFIG_DM_KEYBOARD=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
> @@ -26,6 +28,15 @@ CONFIG_MMC_SDHCI_BCM2835=y
>  CONFIG_PINCTRL=y
>  # CONFIG_PINCTRL_GENERIC is not set
>  # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
> +CONFIG_USB=y
> +CONFIG_DM_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="FSL"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0525
> +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
> +CONFIG_USB_GADGET_DWC2_OTG=y
> +CONFIG_USB_GADGET_DOWNLOAD=y
>  CONFIG_DM_VIDEO=y
>  CONFIG_SYS_WHITE_ON_BLACK=y
>  CONFIG_CONSOLE_SCROLL_LINES=10
> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
> index 77d2d5458a..6723c7cc92 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -70,6 +70,25 @@
>  #define CONFIG_TFTP_TSIZE
>  #endif
>  
> +/* DFU over USB/UDC */
> +#ifdef CONFIG_CMD_DFU
> +#define CONFIG_SYS_DFU_DATA_BUF_SIZE	SZ_1M
> +#define CONFIG_SYS_DFU_MAX_FILE_SIZE	SZ_2M
> +
> +#ifdef CONFIG_ARM64
> +#define KERNEL_FILENAME		"Image"
> +#else
> +#define KERNEL_FILENAME		"zImage"
> +#endif
> +
> +#define ENV_DFU_SETTINGS \
> +	"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \
> +		      "config.txt fat 0 1;" \
> +		      KERNEL_FILENAME " fat 0 1\0"
> +#else
> +#define ENV_DFU_SETTINGS ""
> +#endif
> +
>  /* Console configuration */
>  #define CONFIG_SYS_CBSIZE		1024
>  
> @@ -185,6 +204,7 @@
>  #define CONFIG_EXTRA_ENV_SETTINGS \
>  	"dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
>  	ENV_DEVICE_SETTINGS \
> +	ENV_DFU_SETTINGS \
>  	ENV_MEM_LAYOUT_SETTINGS \
>  	BOOTENV
>  
> 


More information about the U-Boot mailing list