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

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

Commit Message

Marek Szyprowski Sept. 16, 2019, 12:24 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 and zImage.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 configs/rpi_4_32b_defconfig | 11 +++++++++++
 include/configs/rpi.h       | 10 ++++++++++
 2 files changed, 21 insertions(+)

Comments

Matthias Brugger Sept. 16, 2019, 12:45 p.m. UTC | #1
On 16/09/2019 14:24, 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 and zImage.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  configs/rpi_4_32b_defconfig | 11 +++++++++++
>  include/configs/rpi.h       | 10 ++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> index a31a617a5fb..0a375b97369 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

Does this only work on RPi4? It seems to me that this should also be working on
the other RPi's. Do you have such HW to test?

>  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 77d2d5458a1..f502915ad53 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -70,9 +70,18 @@
>  #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
> +#define ENV_DFU_SETTINGS \
> +	"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;zImage fat 0 1"
> +#endif
> +
>  /* Console configuration */
>  #define CONFIG_SYS_CBSIZE		1024
>  
> +

New line sneaked in.

Regards,
Matthias

>  /* Environment */
>  #define CONFIG_ENV_SIZE			SZ_16K
>  #define CONFIG_SYS_LOAD_ADDR		0x1000000
> @@ -185,6 +194,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
>  
>
Marek Szyprowski Sept. 16, 2019, 12:53 p.m. UTC | #2
Hi Matthias,

On 16.09.2019 14:45, Matthias Brugger wrote:
> On 16/09/2019 14:24, 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 and zImage.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>>   configs/rpi_4_32b_defconfig | 11 +++++++++++
>>   include/configs/rpi.h       | 10 ++++++++++
>>   2 files changed, 21 insertions(+)
>>
>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>> index a31a617a5fb..0a375b97369 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
> Does this only work on RPi4? It seems to me that this should also be working on
> the other RPi's. Do you have such HW to test?

It should work on any RPi with USB device controller available on the 
micro-usb/c-usb connector. AFAIK, besides RPi4, only some RPi0 has USB 
device mode available. Other RPi's have USB hub connected to DWC2 
controller, so switching DWC2 to device mode is not enough to make it 
working.

However I have access only to RPi3 and RPi4.

>>   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 77d2d5458a1..f502915ad53 100644
>> --- a/include/configs/rpi.h
>> +++ b/include/configs/rpi.h
>> @@ -70,9 +70,18 @@
>>   #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
>> +#define ENV_DFU_SETTINGS \
>> +	"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;zImage fat 0 1"
>> +#endif
>> +
>>   /* Console configuration */
>>   #define CONFIG_SYS_CBSIZE		1024
>>   
>> +
> New line sneaked in.
>
> Regards,
> Matthias
>
>>   /* Environment */
>>   #define CONFIG_ENV_SIZE			SZ_16K
>>   #define CONFIG_SYS_LOAD_ADDR		0x1000000
>> @@ -185,6 +194,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
>>   
>>
>
Best regards
Jonathan Gray Sept. 16, 2019, 4:18 p.m. UTC | #3
On Mon, Sep 16, 2019 at 02:53:30PM +0200, Marek Szyprowski wrote:
> Hi Matthias,
> 
> On 16.09.2019 14:45, Matthias Brugger wrote:
> > On 16/09/2019 14:24, 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 and zImage.
> >>
> >> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> >> ---
> >>   configs/rpi_4_32b_defconfig | 11 +++++++++++
> >>   include/configs/rpi.h       | 10 ++++++++++
> >>   2 files changed, 21 insertions(+)
> >>
> >> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> >> index a31a617a5fb..0a375b97369 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
> > Does this only work on RPi4? It seems to me that this should also be working on
> > the other RPi's. Do you have such HW to test?
> 
> It should work on any RPi with USB device controller available on the 
> micro-usb/c-usb connector. AFAIK, besides RPi4, only some RPi0 has USB 
> device mode available. Other RPi's have USB hub connected to DWC2 
> controller, so switching DWC2 to device mode is not enough to make it 
> working.
> 
> However I have access only to RPi3 and RPi4.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/device.md

	The following devices can boot using USB device boot mode:

	Pi Compute Module
	Pi Compute Module 3
	Pi Zero
	Pi Zero W
	Pi A
	Pi A+
	Pi 3A+
Lukasz Majewski Sept. 16, 2019, 9:41 p.m. UTC | #4
Hi Marek,

> 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 and zImage.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  configs/rpi_4_32b_defconfig | 11 +++++++++++
>  include/configs/rpi.h       | 10 ++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
> index a31a617a5fb..0a375b97369 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/include/configs/rpi.h b/include/configs/rpi.h
> index 77d2d5458a1..f502915ad53 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -70,9 +70,18 @@
>  #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
> +#define ENV_DFU_SETTINGS \
> +	"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;zImage
> fat 0 1" +#endif
> +
>  /* Console configuration */
>  #define CONFIG_SYS_CBSIZE		1024
>  
> +
>  /* Environment */
>  #define CONFIG_ENV_SIZE			SZ_16K
>  #define CONFIG_SYS_LOAD_ADDR		0x1000000
> @@ -185,6 +194,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
>  

Reviewed-by: Lukasz Majewski <lukma@denx.de>

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Marek Szyprowski Sept. 17, 2019, 5:41 a.m. UTC | #5
Hi Jonathan,

On 16.09.2019 18:18, Jonathan Gray wrote:
> On Mon, Sep 16, 2019 at 02:53:30PM +0200, Marek Szyprowski wrote:
>> Hi Matthias,
>>
>> On 16.09.2019 14:45, Matthias Brugger wrote:
>>> On 16/09/2019 14:24, 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 and zImage.
>>>>
>>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>>> ---
>>>>    configs/rpi_4_32b_defconfig | 11 +++++++++++
>>>>    include/configs/rpi.h       | 10 ++++++++++
>>>>    2 files changed, 21 insertions(+)
>>>>
>>>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>>>> index a31a617a5fb..0a375b97369 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
>>> Does this only work on RPi4? It seems to me that this should also be working on
>>> the other RPi's. Do you have such HW to test?
>> It should work on any RPi with USB device controller available on the
>> micro-usb/c-usb connector. AFAIK, besides RPi4, only some RPi0 has USB
>> device mode available. Other RPi's have USB hub connected to DWC2
>> controller, so switching DWC2 to device mode is not enough to make it
>> working.
>>
>> However I have access only to RPi3 and RPi4.
> https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/device.md
>
> 	The following devices can boot using USB device boot mode:
>
> 	Pi Compute Module
> 	Pi Compute Module 3
> 	Pi Zero
> 	Pi Zero W
> 	Pi A
> 	Pi A+
> 	Pi 3A+

Wow, I wasn't aware that there were so many variants of RPi board. 
Anyway, I have only RPi3 (B) and RPi4, so I have no other board to test.

Best regards

Patch
diff mbox series

diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
index a31a617a5fb..0a375b97369 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/include/configs/rpi.h b/include/configs/rpi.h
index 77d2d5458a1..f502915ad53 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -70,9 +70,18 @@ 
 #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
+#define ENV_DFU_SETTINGS \
+	"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;zImage fat 0 1"
+#endif
+
 /* Console configuration */
 #define CONFIG_SYS_CBSIZE		1024
 
+
 /* Environment */
 #define CONFIG_ENV_SIZE			SZ_16K
 #define CONFIG_SYS_LOAD_ADDR		0x1000000
@@ -185,6 +194,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