[U-Boot,v2,6/6] config: enable DFU over USB on Raspberry Pi4 boards
diff mbox series

Message ID 20190924131111.1691-7-m.szyprowski@samsung.com
State Changes Requested
Delegated to: Matthias Brugger
Headers show
Series
  • Raspberry Pi4: add support for DFU over USB
Related show

Commit Message

Marek Szyprowski Sept. 24, 2019, 1:11 p.m. UTC
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, cmdline.txt
and zImage/Image.gz.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
---
 configs/rpi_4_32b_defconfig | 11 +++++++++++
 configs/rpi_4_defconfig     | 11 +++++++++++
 include/configs/rpi.h       | 17 +++++++++++++++++
 3 files changed, 39 insertions(+)

Comments

Matthias Brugger Nov. 8, 2019, 4:57 p.m. UTC | #1
Hi Marek,


First of all thanks for the patch and sorry for the late response.

On 24/09/2019 15:11, 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, cmdline.txt
> and zImage/Image.gz.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Reviewed-by: Lukasz Majewski <lukma@denx.de>
> ---
>  configs/rpi_4_32b_defconfig | 11 +++++++++++
>  configs/rpi_4_defconfig     | 11 +++++++++++
>  include/configs/rpi.h       | 17 +++++++++++++++++
>  3 files changed, 39 insertions(+)
> 
> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> index a31a617a5f..0a375b9736 100644
> --- a/configs/rpi_4_32b_defconfig
> +++ b/configs/rpi_4_32b_defconfig
> @@ -12,6 +12,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_CMD_FS_UUID=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 da8c960a2a..5b9be9b9c0 100644
> --- a/configs/rpi_4_defconfig
> +++ b/configs/rpi_4_defconfig
> @@ -12,6 +12,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_CMD_FS_UUID=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..bfe76eb392 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -70,6 +70,22 @@
>  #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.gz"
> +#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;cmdline.txt fat 0 1;" \
> +		      KERNEL_FILENAME " fat 0 1\0"
> +#endif
> +

I'm hesitant to take this file list as I think it highly depends on what you
want to do with the board. For example at SUSE we use a ubootconfig.txt which
get's added to config.txt. We might want to update grub, our kernel is on a
different partition etc.

What do you think?

Other then that the patches look good, and I understand that they should go
through my tree, also I don't know much about the FAT implementation.

Regards,
Matthias
Matthias Brugger Nov. 11, 2019, 6:01 p.m. UTC | #2
On 08/11/2019 17:57, Matthias Brugger wrote:
> Hi Marek,
> 
> 
> First of all thanks for the patch and sorry for the late response.
> 
> On 24/09/2019 15:11, 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, cmdline.txt
>> and zImage/Image.gz.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Reviewed-by: Lukasz Majewski <lukma@denx.de>
>> ---
>>  configs/rpi_4_32b_defconfig | 11 +++++++++++
>>  configs/rpi_4_defconfig     | 11 +++++++++++
>>  include/configs/rpi.h       | 17 +++++++++++++++++
>>  3 files changed, 39 insertions(+)
>>
>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>> index a31a617a5f..0a375b9736 100644
>> --- a/configs/rpi_4_32b_defconfig
>> +++ b/configs/rpi_4_32b_defconfig
>> @@ -12,6 +12,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_CMD_FS_UUID=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 da8c960a2a..5b9be9b9c0 100644
>> --- a/configs/rpi_4_defconfig
>> +++ b/configs/rpi_4_defconfig
>> @@ -12,6 +12,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_CMD_FS_UUID=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..bfe76eb392 100644
>> --- a/include/configs/rpi.h
>> +++ b/include/configs/rpi.h
>> @@ -70,6 +70,22 @@
>>  #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.gz"
>> +#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;cmdline.txt fat 0 1;" \
>> +		      KERNEL_FILENAME " fat 0 1\0"

we are missing
#else
#define ENV_DFU_SETTINGS ""

otherwise armv7 builds are broken.

Regards,
Matthias

>> +#endif
>> +
> 
> I'm hesitant to take this file list as I think it highly depends on what you
> want to do with the board. For example at SUSE we use a ubootconfig.txt which
> get's added to config.txt. We might want to update grub, our kernel is on a
> different partition etc.
> 
> What do you think?
> 
> Other then that the patches look good, and I understand that they should go
> through my tree, also I don't know much about the FAT implementation.
> 
> Regards,
> Matthias
>
Marek Szyprowski Nov. 12, 2019, 9:52 a.m. UTC | #3
Hi Matthias,

On 08.11.2019 17:57, Matthias Brugger wrote:
> First of all thanks for the patch and sorry for the late response.
>
> On 24/09/2019 15:11, 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, cmdline.txt
>> and zImage/Image.gz.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Reviewed-by: Lukasz Majewski <lukma@denx.de>
>> ---
>>   configs/rpi_4_32b_defconfig | 11 +++++++++++
>>   configs/rpi_4_defconfig     | 11 +++++++++++
>>   include/configs/rpi.h       | 17 +++++++++++++++++
>>   3 files changed, 39 insertions(+)
>>
>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>> index a31a617a5f..0a375b9736 100644
>> --- a/configs/rpi_4_32b_defconfig
>> +++ b/configs/rpi_4_32b_defconfig
>> @@ -12,6 +12,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_CMD_FS_UUID=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 da8c960a2a..5b9be9b9c0 100644
>> --- a/configs/rpi_4_defconfig
>> +++ b/configs/rpi_4_defconfig
>> @@ -12,6 +12,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_CMD_FS_UUID=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..bfe76eb392 100644
>> --- a/include/configs/rpi.h
>> +++ b/include/configs/rpi.h
>> @@ -70,6 +70,22 @@
>>   #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.gz"
>> +#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;cmdline.txt fat 0 1;" \
>> +		      KERNEL_FILENAME " fat 0 1\0"
>> +#endif
>> +
> I'm hesitant to take this file list as I think it highly depends on what you
> want to do with the board. For example at SUSE we use a ubootconfig.txt which
> get's added to config.txt. We might want to update grub, our kernel is on a
> different partition etc.
>
> What do you think?

Well, the above list is just a proposal. IMHO distro maintainers should 
adjust it for their needs. I can add a comment about that if you want.

> Other then that the patches look good, and I understand that they should go
> through my tree, also I don't know much about the FAT implementation.

Merging everything via a single tree will be the easiest way to handle 
the runtime dependencies.

Best regards
Matthias Brugger Nov. 12, 2019, 10:30 a.m. UTC | #4
On 12/11/2019 10:52, Marek Szyprowski wrote:
> Hi Matthias,
> 
> On 08.11.2019 17:57, Matthias Brugger wrote:
>> First of all thanks for the patch and sorry for the late response.
>>
>> On 24/09/2019 15:11, 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, cmdline.txt
>>> and zImage/Image.gz.
>>>
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> Reviewed-by: Lukasz Majewski <lukma@denx.de>
>>> ---
>>>   configs/rpi_4_32b_defconfig | 11 +++++++++++
>>>   configs/rpi_4_defconfig     | 11 +++++++++++
>>>   include/configs/rpi.h       | 17 +++++++++++++++++
>>>   3 files changed, 39 insertions(+)
>>>
>>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>>> index a31a617a5f..0a375b9736 100644
>>> --- a/configs/rpi_4_32b_defconfig
>>> +++ b/configs/rpi_4_32b_defconfig
>>> @@ -12,6 +12,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_CMD_FS_UUID=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 da8c960a2a..5b9be9b9c0 100644
>>> --- a/configs/rpi_4_defconfig
>>> +++ b/configs/rpi_4_defconfig
>>> @@ -12,6 +12,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_CMD_FS_UUID=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..bfe76eb392 100644
>>> --- a/include/configs/rpi.h
>>> +++ b/include/configs/rpi.h
>>> @@ -70,6 +70,22 @@
>>>   #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.gz"
>>> +#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;cmdline.txt fat 0 1;" \
>>> +		      KERNEL_FILENAME " fat 0 1\0"
>>> +#endif
>>> +
>> I'm hesitant to take this file list as I think it highly depends on what you
>> want to do with the board. For example at SUSE we use a ubootconfig.txt which
>> get's added to config.txt. We might want to update grub, our kernel is on a
>> different partition etc.
>>
>> What do you think?
> 
> Well, the above list is just a proposal. IMHO distro maintainers should 
> adjust it for their needs. I can add a comment about that if you want.
> 

Ok, if you send a v3, then I'd propose to delete  cmdline.txt as it is not part
of U-Boot infrastructure.

Can please also fix the armv7 build as mentioned in my mail yesterday.

>> Other then that the patches look good, and I understand that they should go
>> through my tree, also I don't know much about the FAT implementation.
> 
> Merging everything via a single tree will be the easiest way to handle 
> the runtime dependencies.
> 

Ok, will do with you v3.

Regrads,
Matthias

Patch
diff mbox series

diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
index a31a617a5f..0a375b9736 100644
--- a/configs/rpi_4_32b_defconfig
+++ b/configs/rpi_4_32b_defconfig
@@ -12,6 +12,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_CMD_FS_UUID=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 da8c960a2a..5b9be9b9c0 100644
--- a/configs/rpi_4_defconfig
+++ b/configs/rpi_4_defconfig
@@ -12,6 +12,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_CMD_FS_UUID=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..bfe76eb392 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -70,6 +70,22 @@ 
 #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.gz"
+#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;cmdline.txt fat 0 1;" \
+		      KERNEL_FILENAME " fat 0 1\0"
+#endif
+
 /* Console configuration */
 #define CONFIG_SYS_CBSIZE		1024
 
@@ -185,6 +201,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