diff mbox series

[v5,4/6] configs: am62x_evm_*: Enable USB and DFU support

Message ID 20240506143846.1252377-5-martyn.welch@collabora.com
State Accepted
Commit dfc2dff5a8442aea4923f757bfc118da5dbd9fbe
Delegated to: Tom Rini
Headers show
Series Add DFU and usb boot for TI am62x SK and beagleplay | expand

Commit Message

Martyn Welch May 6, 2024, 2:38 p.m. UTC
From: Sjoerd Simons <sjoerd@collabora.com>

Provide config fragments to enable USB host as well as USB gadget and DFU
support for a53 and r5. This relevant fragment is included into the
am62x EVM a53 defconfig. For the r5, due to the smaller available size,
the config fragment also disables support for persistent storage to free
up space for USB support. This fragment needs to be included is DFU
booting is desired.

The CONFIG_DFU_SF option is placed in the defconfig rather than the
fragment as this is known not to be supported on all boards that can
support DFU.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
---
Changes in v5:
- Switch to config fragment for a53 most DFU configuration

Changes in v4:
- Move R5 dfu config to a config fragment rather then a full defconfig
- Don't enable XHCI for the R5 SPL, unneeded

Changes in v3:
- Run savedefconfig to adjust to more recent u-boot

Changes in v2:
- Create a seperate defconfig for R5



 configs/am62x_a53_usbdfu.config | 30 ++++++++++++++++++++++++++++++
 configs/am62x_evm_a53_defconfig |  2 ++
 configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 configs/am62x_a53_usbdfu.config
 create mode 100644 configs/am62x_r5_usbdfu.config

Comments

Francesco Dolcini May 7, 2024, 8:14 a.m. UTC | #1
Hello Martyn,
first thanks for your series, with this we might be able to drop some
downstream branch.

On Mon, May 06, 2024 at 03:38:44PM +0100, Martyn Welch wrote:
> From: Sjoerd Simons <sjoerd@collabora.com>
> 
> Provide config fragments to enable USB host as well as USB gadget and DFU
> support for a53 and r5. This relevant fragment is included into the
> am62x EVM a53 defconfig. For the r5, due to the smaller available size,
> the config fragment also disables support for persistent storage to free
> up space for USB support. This fragment needs to be included is DFU
> booting is desired.
> 
> The CONFIG_DFU_SF option is placed in the defconfig rather than the
> fragment as this is known not to be supported on all boards that can
> support DFU.
> 
> Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.com>

...

> diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
> new file mode 100644
> index 0000000000..772bb2ab93
> --- /dev/null
> +++ b/configs/am62x_r5_usbdfu.config
> @@ -0,0 +1,28 @@

...

> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165

This is making this fragment TI _board_ specific, while the file name seems
to imply that this is generic for the TI SoC. Other vendors, using TI
SoCs, will likely want to use their own USB IDs.

Not a big deal and no need to change it, we'll handle this in our own
defconfig when we'll enable this, but I wanted to mention this.

Francesco
Mattijs Korpershoek May 7, 2024, 9:05 a.m. UTC | #2
Hi Martyn,

Thank you for the patch.

On lun., mai 06, 2024 at 15:38, Martyn Welch <martyn.welch@collabora.com> wrote:

> From: Sjoerd Simons <sjoerd@collabora.com>
>
> Provide config fragments to enable USB host as well as USB gadget and DFU
> support for a53 and r5. This relevant fragment is included into the
> am62x EVM a53 defconfig. For the r5, due to the smaller available size,
> the config fragment also disables support for persistent storage to free
> up space for USB support. This fragment needs to be included is DFU
> booting is desired.
>
> The CONFIG_DFU_SF option is placed in the defconfig rather than the
> fragment as this is known not to be supported on all boards that can
> support DFU.
>
> Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
> Changes in v5:
> - Switch to config fragment for a53 most DFU configuration
>
> Changes in v4:
> - Move R5 dfu config to a config fragment rather then a full defconfig
> - Don't enable XHCI for the R5 SPL, unneeded
>
> Changes in v3:
> - Run savedefconfig to adjust to more recent u-boot
>
> Changes in v2:
> - Create a seperate defconfig for R5
>
>
>
>  configs/am62x_a53_usbdfu.config | 30 ++++++++++++++++++++++++++++++
>  configs/am62x_evm_a53_defconfig |  2 ++
>  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+)
>  create mode 100644 configs/am62x_a53_usbdfu.config
>  create mode 100644 configs/am62x_r5_usbdfu.config
>
> diff --git a/configs/am62x_a53_usbdfu.config b/configs/am62x_a53_usbdfu.config
> new file mode 100644
> index 0000000000..3a19cf2328
> --- /dev/null
> +++ b/configs/am62x_a53_usbdfu.config
> @@ -0,0 +1,29 @@
> +CONFIG_SYS_MALLOC_LEN=0x2000000
> +CONFIG_SPL_ENV_SUPPORT=y
> +CONFIG_SPL_RAM_SUPPORT=y
> +CONFIG_SPL_RAM_DEVICE=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_SPL_DFU=y
> +CONFIG_CMD_DFU=y
> +CONFIG_CMD_USB=y
> +CONFIG_SYSCON=y
> +CONFIG_SPL_SYSCON=y
> +CONFIG_DFU_MMC=y
> +CONFIG_DFU_RAM=y
> +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
> +CONFIG_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_SPL_DM_USB_GADGET=y
> +CONFIG_USB_XHCI_HCD=y
> +CONFIG_USB_XHCI_DWC3=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_AM62=y
> +CONFIG_USB_DWC3_AM62=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> +CONFIG_USB_GADGET_DOWNLOAD=y
> diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
> index 6c708dcb05..16294a6a79 100644
> --- a/configs/am62x_evm_a53_defconfig
> +++ b/configs/am62x_evm_a53_defconfig
> @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
>  CONFIG_CLK=y
>  CONFIG_SPL_CLK=y
>  CONFIG_CLK_TI_SCI=y
> +CONFIG_DFU_SF=y
>  CONFIG_DMA_CHANNELS=y
>  CONFIG_TI_K3_NAVSS_UDMA=y
>  CONFIG_TI_SCI_PROTOCOL=y
> @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
>  CONFIG_SYSRESET_TI_SCI=y
>  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>  CONFIG_EFI_SET_TIME=y
> +
> +#include <configs/am62x_a53_usbdfu.config>
> diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
> new file mode 100644
> index 0000000000..772bb2ab93
> --- /dev/null
> +++ b/configs/am62x_r5_usbdfu.config
> @@ -0,0 +1,28 @@
> +CONFIG_SPL_ENV_SUPPORT=y
> +CONFIG_SYSCON=y
> +CONFIG_SPL_SYSCON=y
> +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> +CONFIG_MISC=y
> +CONFIG_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_SPL_DM_USB_GADGET=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_AM62=y
> +CONFIG_USB_GADGET=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> +CONFIG_USB_GADGET_DOWNLOAD=y
> +CONFIG_SPL_DFU=y
> +# CONFIG_SPL_MMC is not set
> +# CONFIG_SPL_FS_FAT is not set
> +# CONFIG_SPL_LIBDISK_SUPPORT is not set
> +# CONFIG_SPL_SPI is not set
> +# CONFIG_SPL_SYS_MALLOC is not set
> +# CONFIG_CMD_GPT is not set
> +# CONFIG_CMD_MMC is not set
> +# CONFIG_CMD_FAT is not set
> +# CONFIG_MMC_SDHCI is not set
> -- 
> 2.43.0
Tom Rini May 7, 2024, 2:33 p.m. UTC | #3
On Tue, May 07, 2024 at 10:14:28AM +0200, Francesco Dolcini wrote:
> Hello Martyn,
> first thanks for your series, with this we might be able to drop some
> downstream branch.
> 
> On Mon, May 06, 2024 at 03:38:44PM +0100, Martyn Welch wrote:
> > From: Sjoerd Simons <sjoerd@collabora.com>
> > 
> > Provide config fragments to enable USB host as well as USB gadget and DFU
> > support for a53 and r5. This relevant fragment is included into the
> > am62x EVM a53 defconfig. For the r5, due to the smaller available size,
> > the config fragment also disables support for persistent storage to free
> > up space for USB support. This fragment needs to be included is DFU
> > booting is desired.
> > 
> > The CONFIG_DFU_SF option is placed in the defconfig rather than the
> > fragment as this is known not to be supported on all boards that can
> > support DFU.
> > 
> > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
> 
> ...
> 
> > diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
> > new file mode 100644
> > index 0000000000..772bb2ab93
> > --- /dev/null
> > +++ b/configs/am62x_r5_usbdfu.config
> > @@ -0,0 +1,28 @@
> 
> ...
> 
> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> 
> This is making this fragment TI _board_ specific, while the file name seems
> to imply that this is generic for the TI SoC. Other vendors, using TI
> SoCs, will likely want to use their own USB IDs.
> 
> Not a big deal and no need to change it, we'll handle this in our own
> defconfig when we'll enable this, but I wanted to mention this.

One thing about fragments, at least so long as it's being processed
correctly, is that "make fooboard_config fragA.config fragB.config"
means that fragB.config will override fragA.config values. Not that it
shouldn't also possibly be re-done as either of:
1) am62x_r5_usbdfu.config + am62x_evm_r5_usbdfu.config
2) better use of imply keyword perhaps in the SoC stanza in one of the
K3 Kconfig files.
Jonathan Humphreys May 23, 2024, 8:08 p.m. UTC | #4
Martyn Welch <martyn.welch@collabora.com> writes:

> From: Sjoerd Simons <sjoerd@collabora.com>
>
> Provide config fragments to enable USB host as well as USB gadget and DFU
> support for a53 and r5. This relevant fragment is included into the
> am62x EVM a53 defconfig. For the r5, due to the smaller available size,
> the config fragment also disables support for persistent storage to free
> up space for USB support. This fragment needs to be included is DFU
> booting is desired.
>
> The CONFIG_DFU_SF option is placed in the defconfig rather than the
> fragment as this is known not to be supported on all boards that can
> support DFU.
>
> Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
> ---
> Changes in v5:
> - Switch to config fragment for a53 most DFU configuration
>
> Changes in v4:
> - Move R5 dfu config to a config fragment rather then a full defconfig
> - Don't enable XHCI for the R5 SPL, unneeded
>
> Changes in v3:
> - Run savedefconfig to adjust to more recent u-boot
>
> Changes in v2:
> - Create a seperate defconfig for R5
>
>
>
>  configs/am62x_a53_usbdfu.config | 30 ++++++++++++++++++++++++++++++
>  configs/am62x_evm_a53_defconfig |  2 ++
>  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+)
>  create mode 100644 configs/am62x_a53_usbdfu.config
>  create mode 100644 configs/am62x_r5_usbdfu.config
>
> diff --git a/configs/am62x_a53_usbdfu.config b/configs/am62x_a53_usbdfu.config
> new file mode 100644
> index 0000000000..3a19cf2328
> --- /dev/null
> +++ b/configs/am62x_a53_usbdfu.config
> @@ -0,0 +1,29 @@
> +CONFIG_SYS_MALLOC_LEN=0x2000000
> +CONFIG_SPL_ENV_SUPPORT=y
> +CONFIG_SPL_RAM_SUPPORT=y
> +CONFIG_SPL_RAM_DEVICE=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_SPL_DFU=y
> +CONFIG_CMD_DFU=y
> +CONFIG_CMD_USB=y
> +CONFIG_SYSCON=y
> +CONFIG_SPL_SYSCON=y
> +CONFIG_DFU_MMC=y
> +CONFIG_DFU_RAM=y
> +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
> +CONFIG_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_SPL_DM_USB_GADGET=y
> +CONFIG_USB_XHCI_HCD=y
> +CONFIG_USB_XHCI_DWC3=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_AM62=y
> +CONFIG_USB_DWC3_AM62=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> +CONFIG_USB_GADGET_DOWNLOAD=y
> diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
> index 6c708dcb05..16294a6a79 100644
> --- a/configs/am62x_evm_a53_defconfig
> +++ b/configs/am62x_evm_a53_defconfig
> @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
>  CONFIG_CLK=y
>  CONFIG_SPL_CLK=y
>  CONFIG_CLK_TI_SCI=y
> +CONFIG_DFU_SF=y
>  CONFIG_DMA_CHANNELS=y
>  CONFIG_TI_K3_NAVSS_UDMA=y
>  CONFIG_TI_SCI_PROTOCOL=y
> @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
>  CONFIG_SYSRESET_TI_SCI=y
>  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>  CONFIG_EFI_SET_TIME=y
> +
> +#include <configs/am62x_a53_usbdfu.config>
> diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
> new file mode 100644
> index 0000000000..772bb2ab93
> --- /dev/null
> +++ b/configs/am62x_r5_usbdfu.config
> @@ -0,0 +1,28 @@
> +CONFIG_SPL_ENV_SUPPORT=y
> +CONFIG_SYSCON=y
> +CONFIG_SPL_SYSCON=y
> +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> +CONFIG_MISC=y
> +CONFIG_USB=y
> +CONFIG_DM_USB_GADGET=y
> +CONFIG_SPL_DM_USB_GADGET=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_GENERIC=y
> +CONFIG_SPL_USB_DWC3_AM62=y
> +CONFIG_USB_GADGET=y
> +CONFIG_SPL_USB_GADGET=y
> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> +CONFIG_USB_GADGET_DOWNLOAD=y
> +CONFIG_SPL_DFU=y
> +# CONFIG_SPL_MMC is not set
> +# CONFIG_SPL_FS_FAT is not set
> +# CONFIG_SPL_LIBDISK_SUPPORT is not set
> +# CONFIG_SPL_SPI is not set
> +# CONFIG_SPL_SYS_MALLOC is not set
> +# CONFIG_CMD_GPT is not set
> +# CONFIG_CMD_MMC is not set
> +# CONFIG_CMD_FAT is not set
> +# CONFIG_MMC_SDHCI is not set
> -- 
> 2.43.0

Hi all, it appears that this patch breaks OSPI DFU on the board.  In
particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to be the
culprit.

I see the error as a DFU timeout when applying capsules.

  SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
  ############jedec_spi_nor flash@0: flash operation timed out
  #DFU write failed

Jon
Martyn Welch July 1, 2024, 11:27 a.m. UTC | #5
On Thu, 2024-05-23 at 15:08 -0500, Jon Humphreys wrote:
> Martyn Welch <martyn.welch@collabora.com> writes:
> 
> > From: Sjoerd Simons <sjoerd@collabora.com>
> > 
> > Provide config fragments to enable USB host as well as USB gadget
> > and DFU
> > support for a53 and r5. This relevant fragment is included into the
> > am62x EVM a53 defconfig. For the r5, due to the smaller available
> > size,
> > the config fragment also disables support for persistent storage to
> > free
> > up space for USB support. This fragment needs to be included is DFU
> > booting is desired.
> > 
> > The CONFIG_DFU_SF option is placed in the defconfig rather than the
> > fragment as this is known not to be supported on all boards that
> > can
> > support DFU.
> > 
> > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
> > ---
> > Changes in v5:
> > - Switch to config fragment for a53 most DFU configuration
> > 
> > Changes in v4:
> > - Move R5 dfu config to a config fragment rather then a full
> > defconfig
> > - Don't enable XHCI for the R5 SPL, unneeded
> > 
> > Changes in v3:
> > - Run savedefconfig to adjust to more recent u-boot
> > 
> > Changes in v2:
> > - Create a seperate defconfig for R5
> > 
> > 
> > 
> >  configs/am62x_a53_usbdfu.config | 30
> > ++++++++++++++++++++++++++++++
> >  configs/am62x_evm_a53_defconfig |  2 ++
> >  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
> >  3 files changed, 60 insertions(+)
> >  create mode 100644 configs/am62x_a53_usbdfu.config
> >  create mode 100644 configs/am62x_r5_usbdfu.config
> > 
> > diff --git a/configs/am62x_a53_usbdfu.config
> > b/configs/am62x_a53_usbdfu.config
> > new file mode 100644
> > index 0000000000..3a19cf2328
> > --- /dev/null
> > +++ b/configs/am62x_a53_usbdfu.config
> > @@ -0,0 +1,29 @@
> > +CONFIG_SYS_MALLOC_LEN=0x2000000
> > +CONFIG_SPL_ENV_SUPPORT=y
> > +CONFIG_SPL_RAM_SUPPORT=y
> > +CONFIG_SPL_RAM_DEVICE=y
> > +CONFIG_SPL_USB_GADGET=y
> > +CONFIG_SPL_DFU=y
> > +CONFIG_CMD_DFU=y
> > +CONFIG_CMD_USB=y
> > +CONFIG_SYSCON=y
> > +CONFIG_SPL_SYSCON=y
> > +CONFIG_DFU_MMC=y
> > +CONFIG_DFU_RAM=y
> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> > +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
> > +CONFIG_USB=y
> > +CONFIG_DM_USB_GADGET=y
> > +CONFIG_SPL_DM_USB_GADGET=y
> > +CONFIG_USB_XHCI_HCD=y
> > +CONFIG_USB_XHCI_DWC3=y
> > +CONFIG_USB_DWC3=y
> > +CONFIG_USB_DWC3_GENERIC=y
> > +CONFIG_SPL_USB_DWC3_GENERIC=y
> > +CONFIG_SPL_USB_DWC3_AM62=y
> > +CONFIG_USB_DWC3_AM62=y
> > +CONFIG_USB_GADGET=y
> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> > +CONFIG_USB_GADGET_DOWNLOAD=y
> > diff --git a/configs/am62x_evm_a53_defconfig
> > b/configs/am62x_evm_a53_defconfig
> > index 6c708dcb05..16294a6a79 100644
> > --- a/configs/am62x_evm_a53_defconfig
> > +++ b/configs/am62x_evm_a53_defconfig
> > @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
> >  CONFIG_CLK=y
> >  CONFIG_SPL_CLK=y
> >  CONFIG_CLK_TI_SCI=y
> > +CONFIG_DFU_SF=y
> >  CONFIG_DMA_CHANNELS=y
> >  CONFIG_TI_K3_NAVSS_UDMA=y
> >  CONFIG_TI_SCI_PROTOCOL=y
> > @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
> >  CONFIG_SYSRESET_TI_SCI=y
> >  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
> >  CONFIG_EFI_SET_TIME=y
> > +
> > +#include <configs/am62x_a53_usbdfu.config>
> > diff --git a/configs/am62x_r5_usbdfu.config
> > b/configs/am62x_r5_usbdfu.config
> > new file mode 100644
> > index 0000000000..772bb2ab93
> > --- /dev/null
> > +++ b/configs/am62x_r5_usbdfu.config
> > @@ -0,0 +1,28 @@
> > +CONFIG_SPL_ENV_SUPPORT=y
> > +CONFIG_SYSCON=y
> > +CONFIG_SPL_SYSCON=y
> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> > +CONFIG_MISC=y
> > +CONFIG_USB=y
> > +CONFIG_DM_USB_GADGET=y
> > +CONFIG_SPL_DM_USB_GADGET=y
> > +CONFIG_USB_DWC3=y
> > +CONFIG_USB_DWC3_GENERIC=y
> > +CONFIG_SPL_USB_DWC3_GENERIC=y
> > +CONFIG_SPL_USB_DWC3_AM62=y
> > +CONFIG_USB_GADGET=y
> > +CONFIG_SPL_USB_GADGET=y
> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> > +CONFIG_USB_GADGET_DOWNLOAD=y
> > +CONFIG_SPL_DFU=y
> > +# CONFIG_SPL_MMC is not set
> > +# CONFIG_SPL_FS_FAT is not set
> > +# CONFIG_SPL_LIBDISK_SUPPORT is not set
> > +# CONFIG_SPL_SPI is not set
> > +# CONFIG_SPL_SYS_MALLOC is not set
> > +# CONFIG_CMD_GPT is not set
> > +# CONFIG_CMD_MMC is not set
> > +# CONFIG_CMD_FAT is not set
> > +# CONFIG_MMC_SDHCI is not set
> > -- 
> > 2.43.0
> 
> Hi all, it appears that this patch breaks OSPI DFU on the board.  In
> particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to be the
> culprit.
> 
> I see the error as a DFU timeout when applying capsules.
> 
>   SF: Detected s28hs512t with page size 256 Bytes, erase size 256
> KiB, total 64 MiB
>   ############jedec_spi_nor flash@0: flash operation timed out
>   #DFU write failed
> 

I'm not seeing this failure using the `-next` branch from yesterday
(2f96033923).

I've attempted to use both the `uboot-capsule.bin` produced with and
without the DFU config enabled whilst booting the SK-AM62 via DFU and
from an SD card. I seem to be consistently getting the following:

=> ext2ls mmc 1:1                                                    
<DIR>       4096 .                                                   
<DIR>       4096 ..                                                  
<DIR>      16384 lost+found                                          
         1132791 uboot-capsule.bin                                   
=> load mmc 1:1 ${loadaddr} /uboot-capsule.bin                       
1132791 bytes read in 57 ms (19 MiB/s)                               
=> efidebug capsule update ${loadaddr}                               
** File not found ubootefi.var **                                    
Failed to load EFI variables                                         
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB,
total 64 Mi
B                                                                    
########################################################             
** Unable to write file ubootefi.var **                              
Failed to persist EFI variables                                      
=>

TBH, I'm not sure if this is good or bad at this point, but I'm not
seeing the error that you reported. As can be seen above, I don't have
a `ubootefi.var` file, but then I don't boot using EFI mechanisms, so I
guess that's expected?

But then, the commands I've used above aren't applying the capsule
either right?

Martyn

> Jon
Jonathan Humphreys July 4, 2024, 1:35 a.m. UTC | #6
Martyn Welch <martyn.welch@collabora.com> writes:

> On Thu, 2024-05-23 at 15:08 -0500, Jon Humphreys wrote:
>> Martyn Welch <martyn.welch@collabora.com> writes:
>> 
>> > From: Sjoerd Simons <sjoerd@collabora.com>
>> > 
>> > Provide config fragments to enable USB host as well as USB gadget
>> > and DFU
>> > support for a53 and r5. This relevant fragment is included into the
>> > am62x EVM a53 defconfig. For the r5, due to the smaller available
>> > size,
>> > the config fragment also disables support for persistent storage to
>> > free
>> > up space for USB support. This fragment needs to be included is DFU
>> > booting is desired.
>> > 
>> > The CONFIG_DFU_SF option is placed in the defconfig rather than the
>> > fragment as this is known not to be supported on all boards that
>> > can
>> > support DFU.
>> > 
>> > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
>> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
>> > ---
>> > Changes in v5:
>> > - Switch to config fragment for a53 most DFU configuration
>> > 
>> > Changes in v4:
>> > - Move R5 dfu config to a config fragment rather then a full
>> > defconfig
>> > - Don't enable XHCI for the R5 SPL, unneeded
>> > 
>> > Changes in v3:
>> > - Run savedefconfig to adjust to more recent u-boot
>> > 
>> > Changes in v2:
>> > - Create a seperate defconfig for R5
>> > 
>> > 
>> > 
>> >  configs/am62x_a53_usbdfu.config | 30
>> > ++++++++++++++++++++++++++++++
>> >  configs/am62x_evm_a53_defconfig |  2 ++
>> >  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
>> >  3 files changed, 60 insertions(+)
>> >  create mode 100644 configs/am62x_a53_usbdfu.config
>> >  create mode 100644 configs/am62x_r5_usbdfu.config
>> > 
>> > diff --git a/configs/am62x_a53_usbdfu.config
>> > b/configs/am62x_a53_usbdfu.config
>> > new file mode 100644
>> > index 0000000000..3a19cf2328
>> > --- /dev/null
>> > +++ b/configs/am62x_a53_usbdfu.config
>> > @@ -0,0 +1,29 @@
>> > +CONFIG_SYS_MALLOC_LEN=0x2000000
>> > +CONFIG_SPL_ENV_SUPPORT=y
>> > +CONFIG_SPL_RAM_SUPPORT=y
>> > +CONFIG_SPL_RAM_DEVICE=y
>> > +CONFIG_SPL_USB_GADGET=y
>> > +CONFIG_SPL_DFU=y
>> > +CONFIG_CMD_DFU=y
>> > +CONFIG_CMD_USB=y
>> > +CONFIG_SYSCON=y
>> > +CONFIG_SPL_SYSCON=y
>> > +CONFIG_DFU_MMC=y
>> > +CONFIG_DFU_RAM=y
>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>> > +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
>> > +CONFIG_USB=y
>> > +CONFIG_DM_USB_GADGET=y
>> > +CONFIG_SPL_DM_USB_GADGET=y
>> > +CONFIG_USB_XHCI_HCD=y
>> > +CONFIG_USB_XHCI_DWC3=y
>> > +CONFIG_USB_DWC3=y
>> > +CONFIG_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_AM62=y
>> > +CONFIG_USB_DWC3_AM62=y
>> > +CONFIG_USB_GADGET=y
>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>> > diff --git a/configs/am62x_evm_a53_defconfig
>> > b/configs/am62x_evm_a53_defconfig
>> > index 6c708dcb05..16294a6a79 100644
>> > --- a/configs/am62x_evm_a53_defconfig
>> > +++ b/configs/am62x_evm_a53_defconfig
>> > @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
>> >  CONFIG_CLK=y
>> >  CONFIG_SPL_CLK=y
>> >  CONFIG_CLK_TI_SCI=y
>> > +CONFIG_DFU_SF=y
>> >  CONFIG_DMA_CHANNELS=y
>> >  CONFIG_TI_K3_NAVSS_UDMA=y
>> >  CONFIG_TI_SCI_PROTOCOL=y
>> > @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
>> >  CONFIG_SYSRESET_TI_SCI=y
>> >  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>> >  CONFIG_EFI_SET_TIME=y
>> > +
>> > +#include <configs/am62x_a53_usbdfu.config>
>> > diff --git a/configs/am62x_r5_usbdfu.config
>> > b/configs/am62x_r5_usbdfu.config
>> > new file mode 100644
>> > index 0000000000..772bb2ab93
>> > --- /dev/null
>> > +++ b/configs/am62x_r5_usbdfu.config
>> > @@ -0,0 +1,28 @@
>> > +CONFIG_SPL_ENV_SUPPORT=y
>> > +CONFIG_SYSCON=y
>> > +CONFIG_SPL_SYSCON=y
>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>> > +CONFIG_MISC=y
>> > +CONFIG_USB=y
>> > +CONFIG_DM_USB_GADGET=y
>> > +CONFIG_SPL_DM_USB_GADGET=y
>> > +CONFIG_USB_DWC3=y
>> > +CONFIG_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_AM62=y
>> > +CONFIG_USB_GADGET=y
>> > +CONFIG_SPL_USB_GADGET=y
>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>> > +CONFIG_SPL_DFU=y
>> > +# CONFIG_SPL_MMC is not set
>> > +# CONFIG_SPL_FS_FAT is not set
>> > +# CONFIG_SPL_LIBDISK_SUPPORT is not set
>> > +# CONFIG_SPL_SPI is not set
>> > +# CONFIG_SPL_SYS_MALLOC is not set
>> > +# CONFIG_CMD_GPT is not set
>> > +# CONFIG_CMD_MMC is not set
>> > +# CONFIG_CMD_FAT is not set
>> > +# CONFIG_MMC_SDHCI is not set
>> > -- 
>> > 2.43.0
>> 
>> Hi all, it appears that this patch breaks OSPI DFU on the board.  In
>> particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to be the
>> culprit.
>> 
>> I see the error as a DFU timeout when applying capsules.
>> 
>>   SF: Detected s28hs512t with page size 256 Bytes, erase size 256
>> KiB, total 64 MiB
>>   ############jedec_spi_nor flash@0: flash operation timed out
>>   #DFU write failed
>> 
>
> I'm not seeing this failure using the `-next` branch from yesterday
> (2f96033923).
>
> I've attempted to use both the `uboot-capsule.bin` produced with and
> without the DFU config enabled whilst booting the SK-AM62 via DFU and
> from an SD card. I seem to be consistently getting the following:
>
> => ext2ls mmc 1:1                                                    
> <DIR>       4096 .                                                   
> <DIR>       4096 ..                                                  
> <DIR>      16384 lost+found                                          
>          1132791 uboot-capsule.bin                                   
> => load mmc 1:1 ${loadaddr} /uboot-capsule.bin                       
> 1132791 bytes read in 57 ms (19 MiB/s)                               
> => efidebug capsule update ${loadaddr}                               
> ** File not found ubootefi.var **                                    
> Failed to load EFI variables                                         
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB,
> total 64 Mi
> B                                                                    
> ########################################################             
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> =>
>
> TBH, I'm not sure if this is good or bad at this point, but I'm not
> seeing the error that you reported. As can be seen above, I don't have
> a `ubootefi.var` file, but then I don't boot using EFI mechanisms, so I
> guess that's expected?
>
> But then, the commands I've used above aren't applying the capsule
> either right?
>
> Martyn
>
>> Jon

Hi Martyn, you are not seeing the error. I am on vacation until the 10th so
I cannot follow up. When I return, I'll see if I can reproduce from the
exact sha you listed and we can go from there.

Thanks 
Jon
Jonathan Humphreys July 11, 2024, 8:51 p.m. UTC | #7
Martyn Welch <martyn.welch@collabora.com> writes:

> On Thu, 2024-05-23 at 15:08 -0500, Jon Humphreys wrote:
>> Martyn Welch <martyn.welch@collabora.com> writes:
>> 
>> > From: Sjoerd Simons <sjoerd@collabora.com>
>> > 
>> > Provide config fragments to enable USB host as well as USB gadget
>> > and DFU
>> > support for a53 and r5. This relevant fragment is included into the
>> > am62x EVM a53 defconfig. For the r5, due to the smaller available
>> > size,
>> > the config fragment also disables support for persistent storage to
>> > free
>> > up space for USB support. This fragment needs to be included is DFU
>> > booting is desired.
>> > 
>> > The CONFIG_DFU_SF option is placed in the defconfig rather than the
>> > fragment as this is known not to be supported on all boards that
>> > can
>> > support DFU.
>> > 
>> > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
>> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
>> > ---
>> > Changes in v5:
>> > - Switch to config fragment for a53 most DFU configuration
>> > 
>> > Changes in v4:
>> > - Move R5 dfu config to a config fragment rather then a full
>> > defconfig
>> > - Don't enable XHCI for the R5 SPL, unneeded
>> > 
>> > Changes in v3:
>> > - Run savedefconfig to adjust to more recent u-boot
>> > 
>> > Changes in v2:
>> > - Create a seperate defconfig for R5
>> > 
>> > 
>> > 
>> >  configs/am62x_a53_usbdfu.config | 30
>> > ++++++++++++++++++++++++++++++
>> >  configs/am62x_evm_a53_defconfig |  2 ++
>> >  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
>> >  3 files changed, 60 insertions(+)
>> >  create mode 100644 configs/am62x_a53_usbdfu.config
>> >  create mode 100644 configs/am62x_r5_usbdfu.config
>> > 
>> > diff --git a/configs/am62x_a53_usbdfu.config
>> > b/configs/am62x_a53_usbdfu.config
>> > new file mode 100644
>> > index 0000000000..3a19cf2328
>> > --- /dev/null
>> > +++ b/configs/am62x_a53_usbdfu.config
>> > @@ -0,0 +1,29 @@
>> > +CONFIG_SYS_MALLOC_LEN=0x2000000
>> > +CONFIG_SPL_ENV_SUPPORT=y
>> > +CONFIG_SPL_RAM_SUPPORT=y
>> > +CONFIG_SPL_RAM_DEVICE=y
>> > +CONFIG_SPL_USB_GADGET=y
>> > +CONFIG_SPL_DFU=y
>> > +CONFIG_CMD_DFU=y
>> > +CONFIG_CMD_USB=y
>> > +CONFIG_SYSCON=y
>> > +CONFIG_SPL_SYSCON=y
>> > +CONFIG_DFU_MMC=y
>> > +CONFIG_DFU_RAM=y
>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>> > +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
>> > +CONFIG_USB=y
>> > +CONFIG_DM_USB_GADGET=y
>> > +CONFIG_SPL_DM_USB_GADGET=y
>> > +CONFIG_USB_XHCI_HCD=y
>> > +CONFIG_USB_XHCI_DWC3=y
>> > +CONFIG_USB_DWC3=y
>> > +CONFIG_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_AM62=y
>> > +CONFIG_USB_DWC3_AM62=y
>> > +CONFIG_USB_GADGET=y
>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>> > diff --git a/configs/am62x_evm_a53_defconfig
>> > b/configs/am62x_evm_a53_defconfig
>> > index 6c708dcb05..16294a6a79 100644
>> > --- a/configs/am62x_evm_a53_defconfig
>> > +++ b/configs/am62x_evm_a53_defconfig
>> > @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
>> >  CONFIG_CLK=y
>> >  CONFIG_SPL_CLK=y
>> >  CONFIG_CLK_TI_SCI=y
>> > +CONFIG_DFU_SF=y
>> >  CONFIG_DMA_CHANNELS=y
>> >  CONFIG_TI_K3_NAVSS_UDMA=y
>> >  CONFIG_TI_SCI_PROTOCOL=y
>> > @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
>> >  CONFIG_SYSRESET_TI_SCI=y
>> >  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>> >  CONFIG_EFI_SET_TIME=y
>> > +
>> > +#include <configs/am62x_a53_usbdfu.config>
>> > diff --git a/configs/am62x_r5_usbdfu.config
>> > b/configs/am62x_r5_usbdfu.config
>> > new file mode 100644
>> > index 0000000000..772bb2ab93
>> > --- /dev/null
>> > +++ b/configs/am62x_r5_usbdfu.config
>> > @@ -0,0 +1,28 @@
>> > +CONFIG_SPL_ENV_SUPPORT=y
>> > +CONFIG_SYSCON=y
>> > +CONFIG_SPL_SYSCON=y
>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>> > +CONFIG_MISC=y
>> > +CONFIG_USB=y
>> > +CONFIG_DM_USB_GADGET=y
>> > +CONFIG_SPL_DM_USB_GADGET=y
>> > +CONFIG_USB_DWC3=y
>> > +CONFIG_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>> > +CONFIG_SPL_USB_DWC3_AM62=y
>> > +CONFIG_USB_GADGET=y
>> > +CONFIG_SPL_USB_GADGET=y
>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>> > +CONFIG_SPL_DFU=y
>> > +# CONFIG_SPL_MMC is not set
>> > +# CONFIG_SPL_FS_FAT is not set
>> > +# CONFIG_SPL_LIBDISK_SUPPORT is not set
>> > +# CONFIG_SPL_SPI is not set
>> > +# CONFIG_SPL_SYS_MALLOC is not set
>> > +# CONFIG_CMD_GPT is not set
>> > +# CONFIG_CMD_MMC is not set
>> > +# CONFIG_CMD_FAT is not set
>> > +# CONFIG_MMC_SDHCI is not set
>> > -- 
>> > 2.43.0
>> 
>> Hi all, it appears that this patch breaks OSPI DFU on the board.  In
>> particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to be the
>> culprit.
>> 
>> I see the error as a DFU timeout when applying capsules.
>> 
>>   SF: Detected s28hs512t with page size 256 Bytes, erase size 256
>> KiB, total 64 MiB
>>   ############jedec_spi_nor flash@0: flash operation timed out
>>   #DFU write failed
>> 
>
> I'm not seeing this failure using the `-next` branch from yesterday
> (2f96033923).
>
> I've attempted to use both the `uboot-capsule.bin` produced with and
> without the DFU config enabled whilst booting the SK-AM62 via DFU and
> from an SD card. I seem to be consistently getting the following:
>
> => ext2ls mmc 1:1                                                    
> <DIR>       4096 .                                                   
> <DIR>       4096 ..                                                  
> <DIR>      16384 lost+found                                          
>          1132791 uboot-capsule.bin                                   
> => load mmc 1:1 ${loadaddr} /uboot-capsule.bin                       
> 1132791 bytes read in 57 ms (19 MiB/s)                               
> => efidebug capsule update ${loadaddr}                               
> ** File not found ubootefi.var **                                    
> Failed to load EFI variables                                         
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB,
> total 64 Mi
> B                                                                    
> ########################################################             
> ** Unable to write file ubootefi.var **                              
> Failed to persist EFI variables                                      
> =>
>
> TBH, I'm not sure if this is good or bad at this point, but I'm not
> seeing the error that you reported. As can be seen above, I don't have
> a `ubootefi.var` file, but then I don't boot using EFI mechanisms, so I
> guess that's expected?
>
> But then, the commands I've used above aren't applying the capsule
> either right?
>
> Martyn
>
>> Jon

Hi Martyn, against upstream/next, I no longer see the failure.  Thanks for
looking into it.

Jon
Jonathan Humphreys July 11, 2024, 9:41 p.m. UTC | #8
Jon Humphreys <j-humphreys@ti.com> writes:

> Martyn Welch <martyn.welch@collabora.com> writes:
>
>> On Thu, 2024-05-23 at 15:08 -0500, Jon Humphreys wrote:
>>> Martyn Welch <martyn.welch@collabora.com> writes:
>>> 
>>> > From: Sjoerd Simons <sjoerd@collabora.com>
>>> > 
>>> > Provide config fragments to enable USB host as well as USB gadget
>>> > and DFU
>>> > support for a53 and r5. This relevant fragment is included into the
>>> > am62x EVM a53 defconfig. For the r5, due to the smaller available
>>> > size,
>>> > the config fragment also disables support for persistent storage to
>>> > free
>>> > up space for USB support. This fragment needs to be included is DFU
>>> > booting is desired.
>>> > 
>>> > The CONFIG_DFU_SF option is placed in the defconfig rather than the
>>> > fragment as this is known not to be supported on all boards that
>>> > can
>>> > support DFU.
>>> > 
>>> > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
>>> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
>>> > ---
>>> > Changes in v5:
>>> > - Switch to config fragment for a53 most DFU configuration
>>> > 
>>> > Changes in v4:
>>> > - Move R5 dfu config to a config fragment rather then a full
>>> > defconfig
>>> > - Don't enable XHCI for the R5 SPL, unneeded
>>> > 
>>> > Changes in v3:
>>> > - Run savedefconfig to adjust to more recent u-boot
>>> > 
>>> > Changes in v2:
>>> > - Create a seperate defconfig for R5
>>> > 
>>> > 
>>> > 
>>> >  configs/am62x_a53_usbdfu.config | 30
>>> > ++++++++++++++++++++++++++++++
>>> >  configs/am62x_evm_a53_defconfig |  2 ++
>>> >  configs/am62x_r5_usbdfu.config  | 28 ++++++++++++++++++++++++++++
>>> >  3 files changed, 60 insertions(+)
>>> >  create mode 100644 configs/am62x_a53_usbdfu.config
>>> >  create mode 100644 configs/am62x_r5_usbdfu.config
>>> > 
>>> > diff --git a/configs/am62x_a53_usbdfu.config
>>> > b/configs/am62x_a53_usbdfu.config
>>> > new file mode 100644
>>> > index 0000000000..3a19cf2328
>>> > --- /dev/null
>>> > +++ b/configs/am62x_a53_usbdfu.config
>>> > @@ -0,0 +1,29 @@
>>> > +CONFIG_SYS_MALLOC_LEN=0x2000000
>>> > +CONFIG_SPL_ENV_SUPPORT=y
>>> > +CONFIG_SPL_RAM_SUPPORT=y
>>> > +CONFIG_SPL_RAM_DEVICE=y
>>> > +CONFIG_SPL_USB_GADGET=y
>>> > +CONFIG_SPL_DFU=y
>>> > +CONFIG_CMD_DFU=y
>>> > +CONFIG_CMD_USB=y
>>> > +CONFIG_SYSCON=y
>>> > +CONFIG_SPL_SYSCON=y
>>> > +CONFIG_DFU_MMC=y
>>> > +CONFIG_DFU_RAM=y
>>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>>> > +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
>>> > +CONFIG_USB=y
>>> > +CONFIG_DM_USB_GADGET=y
>>> > +CONFIG_SPL_DM_USB_GADGET=y
>>> > +CONFIG_USB_XHCI_HCD=y
>>> > +CONFIG_USB_XHCI_DWC3=y
>>> > +CONFIG_USB_DWC3=y
>>> > +CONFIG_USB_DWC3_GENERIC=y
>>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>>> > +CONFIG_SPL_USB_DWC3_AM62=y
>>> > +CONFIG_USB_DWC3_AM62=y
>>> > +CONFIG_USB_GADGET=y
>>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>>> > diff --git a/configs/am62x_evm_a53_defconfig
>>> > b/configs/am62x_evm_a53_defconfig
>>> > index 6c708dcb05..16294a6a79 100644
>>> > --- a/configs/am62x_evm_a53_defconfig
>>> > +++ b/configs/am62x_evm_a53_defconfig
>>> > @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
>>> >  CONFIG_CLK=y
>>> >  CONFIG_SPL_CLK=y
>>> >  CONFIG_CLK_TI_SCI=y
>>> > +CONFIG_DFU_SF=y
>>> >  CONFIG_DMA_CHANNELS=y
>>> >  CONFIG_TI_K3_NAVSS_UDMA=y
>>> >  CONFIG_TI_SCI_PROTOCOL=y
>>> > @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
>>> >  CONFIG_SYSRESET_TI_SCI=y
>>> >  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>>> >  CONFIG_EFI_SET_TIME=y
>>> > +
>>> > +#include <configs/am62x_a53_usbdfu.config>
>>> > diff --git a/configs/am62x_r5_usbdfu.config
>>> > b/configs/am62x_r5_usbdfu.config
>>> > new file mode 100644
>>> > index 0000000000..772bb2ab93
>>> > --- /dev/null
>>> > +++ b/configs/am62x_r5_usbdfu.config
>>> > @@ -0,0 +1,28 @@
>>> > +CONFIG_SPL_ENV_SUPPORT=y
>>> > +CONFIG_SYSCON=y
>>> > +CONFIG_SPL_SYSCON=y
>>> > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
>>> > +CONFIG_MISC=y
>>> > +CONFIG_USB=y
>>> > +CONFIG_DM_USB_GADGET=y
>>> > +CONFIG_SPL_DM_USB_GADGET=y
>>> > +CONFIG_USB_DWC3=y
>>> > +CONFIG_USB_DWC3_GENERIC=y
>>> > +CONFIG_SPL_USB_DWC3_GENERIC=y
>>> > +CONFIG_SPL_USB_DWC3_AM62=y
>>> > +CONFIG_USB_GADGET=y
>>> > +CONFIG_SPL_USB_GADGET=y
>>> > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>>> > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>>> > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
>>> > +CONFIG_USB_GADGET_DOWNLOAD=y
>>> > +CONFIG_SPL_DFU=y
>>> > +# CONFIG_SPL_MMC is not set
>>> > +# CONFIG_SPL_FS_FAT is not set
>>> > +# CONFIG_SPL_LIBDISK_SUPPORT is not set
>>> > +# CONFIG_SPL_SPI is not set
>>> > +# CONFIG_SPL_SYS_MALLOC is not set
>>> > +# CONFIG_CMD_GPT is not set
>>> > +# CONFIG_CMD_MMC is not set
>>> > +# CONFIG_CMD_FAT is not set
>>> > +# CONFIG_MMC_SDHCI is not set
>>> > -- 
>>> > 2.43.0
>>> 
>>> Hi all, it appears that this patch breaks OSPI DFU on the board.  In
>>> particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to be the
>>> culprit.
>>> 
>>> I see the error as a DFU timeout when applying capsules.
>>> 
>>>   SF: Detected s28hs512t with page size 256 Bytes, erase size 256
>>> KiB, total 64 MiB
>>>   ############jedec_spi_nor flash@0: flash operation timed out
>>>   #DFU write failed
>>> 
>>
>> I'm not seeing this failure using the `-next` branch from yesterday
>> (2f96033923).
>>
>> I've attempted to use both the `uboot-capsule.bin` produced with and
>> without the DFU config enabled whilst booting the SK-AM62 via DFU and
>> from an SD card. I seem to be consistently getting the following:
>>
>> => ext2ls mmc 1:1                                                    
>> <DIR>       4096 .                                                   
>> <DIR>       4096 ..                                                  
>> <DIR>      16384 lost+found                                          
>>          1132791 uboot-capsule.bin                                   
>> => load mmc 1:1 ${loadaddr} /uboot-capsule.bin                       
>> 1132791 bytes read in 57 ms (19 MiB/s)                               
>> => efidebug capsule update ${loadaddr}                               
>> ** File not found ubootefi.var **                                    
>> Failed to load EFI variables                                         
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB,
>> total 64 Mi
>> B                                                                    
>> ########################################################             
>> ** Unable to write file ubootefi.var **                              
>> Failed to persist EFI variables                                      
>> =>
>>
>> TBH, I'm not sure if this is good or bad at this point, but I'm not
>> seeing the error that you reported. As can be seen above, I don't have
>> a `ubootefi.var` file, but then I don't boot using EFI mechanisms, so I
>> guess that's expected?
>>
>> But then, the commands I've used above aren't applying the capsule
>> either right?
>>
>> Martyn
>>
>>> Jon
>
> Hi Martyn, against upstream/next, I no longer see the failure.  Thanks for
> looking into it.
>
> Jon

Sorry, I wasn't running what I thought I was.  I can confirm that I
see the failure when I build against 2f960339235.

Here are my steps:

=> ls mmc 1
   288978   tiboot3.bin
  1017959   tispl.bin
  1130635   u-boot.img
      307   uEnv.txt
  1133143   uboot-capsule.bin

5 file(s), 0 dir(s)

=> load mmc 1:1 ${loadaddr} /uboot-capsule.bin
1133143 bytes read in 60 ms (18 MiB/s)
=> efidebug capsule update ${loadaddr}
Cannot read EFI system partition
Cannot read EFI system partition
Failed to persist EFI variables
Cannot read EFI system partition
Failed to persist EFI variables
Cannot read EFI system partition
Failed to persist EFI variables
Cannot read EFI system partition
Failed to persist EFI variables
Cannot read EFI system partition
Failed to persist EFI variables
SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
############jedec_spi_nor flash@0: flash operation timed out
#DFU write failed
Firmware update failed: <NULL>
Cannot handle a capsule at 0000000082000000
=> 

What board rev of the sk-am62 are you using?  I am using PROC142A.

Jon
Martyn Welch July 12, 2024, 7:51 a.m. UTC | #9
On Thu, 2024-07-11 at 16:41 -0500, Jon Humphreys wrote:
> Jon Humphreys <j-humphreys@ti.com> writes:
> 
> > Martyn Welch <martyn.welch@collabora.com> writes:
> > 
> > > On Thu, 2024-05-23 at 15:08 -0500, Jon Humphreys wrote:
> > > > Martyn Welch <martyn.welch@collabora.com> writes:
> > > > 
> > > > > From: Sjoerd Simons <sjoerd@collabora.com>
> > > > > 
> > > > > Provide config fragments to enable USB host as well as USB
> > > > > gadget
> > > > > and DFU
> > > > > support for a53 and r5. This relevant fragment is included
> > > > > into the
> > > > > am62x EVM a53 defconfig. For the r5, due to the smaller
> > > > > available
> > > > > size,
> > > > > the config fragment also disables support for persistent
> > > > > storage to
> > > > > free
> > > > > up space for USB support. This fragment needs to be included
> > > > > is DFU
> > > > > booting is desired.
> > > > > 
> > > > > The CONFIG_DFU_SF option is placed in the defconfig rather
> > > > > than the
> > > > > fragment as this is known not to be supported on all boards
> > > > > that
> > > > > can
> > > > > support DFU.
> > > > > 
> > > > > Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
> > > > > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
> > > > > ---
> > > > > Changes in v5:
> > > > > - Switch to config fragment for a53 most DFU configuration
> > > > > 
> > > > > Changes in v4:
> > > > > - Move R5 dfu config to a config fragment rather then a full
> > > > > defconfig
> > > > > - Don't enable XHCI for the R5 SPL, unneeded
> > > > > 
> > > > > Changes in v3:
> > > > > - Run savedefconfig to adjust to more recent u-boot
> > > > > 
> > > > > Changes in v2:
> > > > > - Create a seperate defconfig for R5
> > > > > 
> > > > > 
> > > > > 
> > > > >  configs/am62x_a53_usbdfu.config | 30
> > > > > ++++++++++++++++++++++++++++++
> > > > >  configs/am62x_evm_a53_defconfig |  2 ++
> > > > >  configs/am62x_r5_usbdfu.config  | 28
> > > > > ++++++++++++++++++++++++++++
> > > > >  3 files changed, 60 insertions(+)
> > > > >  create mode 100644 configs/am62x_a53_usbdfu.config
> > > > >  create mode 100644 configs/am62x_r5_usbdfu.config
> > > > > 
> > > > > diff --git a/configs/am62x_a53_usbdfu.config
> > > > > b/configs/am62x_a53_usbdfu.config
> > > > > new file mode 100644
> > > > > index 0000000000..3a19cf2328
> > > > > --- /dev/null
> > > > > +++ b/configs/am62x_a53_usbdfu.config
> > > > > @@ -0,0 +1,29 @@
> > > > > +CONFIG_SYS_MALLOC_LEN=0x2000000
> > > > > +CONFIG_SPL_ENV_SUPPORT=y
> > > > > +CONFIG_SPL_RAM_SUPPORT=y
> > > > > +CONFIG_SPL_RAM_DEVICE=y
> > > > > +CONFIG_SPL_USB_GADGET=y
> > > > > +CONFIG_SPL_DFU=y
> > > > > +CONFIG_CMD_DFU=y
> > > > > +CONFIG_CMD_USB=y
> > > > > +CONFIG_SYSCON=y
> > > > > +CONFIG_SPL_SYSCON=y
> > > > > +CONFIG_DFU_MMC=y
> > > > > +CONFIG_DFU_RAM=y
> > > > > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> > > > > +CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
> > > > > +CONFIG_USB=y
> > > > > +CONFIG_DM_USB_GADGET=y
> > > > > +CONFIG_SPL_DM_USB_GADGET=y
> > > > > +CONFIG_USB_XHCI_HCD=y
> > > > > +CONFIG_USB_XHCI_DWC3=y
> > > > > +CONFIG_USB_DWC3=y
> > > > > +CONFIG_USB_DWC3_GENERIC=y
> > > > > +CONFIG_SPL_USB_DWC3_GENERIC=y
> > > > > +CONFIG_SPL_USB_DWC3_AM62=y
> > > > > +CONFIG_USB_DWC3_AM62=y
> > > > > +CONFIG_USB_GADGET=y
> > > > > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> > > > > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> > > > > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> > > > > +CONFIG_USB_GADGET_DOWNLOAD=y
> > > > > diff --git a/configs/am62x_evm_a53_defconfig
> > > > > b/configs/am62x_evm_a53_defconfig
> > > > > index 6c708dcb05..16294a6a79 100644
> > > > > --- a/configs/am62x_evm_a53_defconfig
> > > > > +++ b/configs/am62x_evm_a53_defconfig
> > > > > @@ -68,6 +68,7 @@ CONFIG_SPL_OF_TRANSLATE=y
> > > > >  CONFIG_CLK=y
> > > > >  CONFIG_SPL_CLK=y
> > > > >  CONFIG_CLK_TI_SCI=y
> > > > > +CONFIG_DFU_SF=y
> > > > >  CONFIG_DMA_CHANNELS=y
> > > > >  CONFIG_TI_K3_NAVSS_UDMA=y
> > > > >  CONFIG_TI_SCI_PROTOCOL=y
> > > > > @@ -111,3 +112,5 @@ CONFIG_SPL_SYSRESET=y
> > > > >  CONFIG_SYSRESET_TI_SCI=y
> > > > >  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
> > > > >  CONFIG_EFI_SET_TIME=y
> > > > > +
> > > > > +#include <configs/am62x_a53_usbdfu.config>
> > > > > diff --git a/configs/am62x_r5_usbdfu.config
> > > > > b/configs/am62x_r5_usbdfu.config
> > > > > new file mode 100644
> > > > > index 0000000000..772bb2ab93
> > > > > --- /dev/null
> > > > > +++ b/configs/am62x_r5_usbdfu.config
> > > > > @@ -0,0 +1,28 @@
> > > > > +CONFIG_SPL_ENV_SUPPORT=y
> > > > > +CONFIG_SYSCON=y
> > > > > +CONFIG_SPL_SYSCON=y
> > > > > +CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
> > > > > +CONFIG_MISC=y
> > > > > +CONFIG_USB=y
> > > > > +CONFIG_DM_USB_GADGET=y
> > > > > +CONFIG_SPL_DM_USB_GADGET=y
> > > > > +CONFIG_USB_DWC3=y
> > > > > +CONFIG_USB_DWC3_GENERIC=y
> > > > > +CONFIG_SPL_USB_DWC3_GENERIC=y
> > > > > +CONFIG_SPL_USB_DWC3_AM62=y
> > > > > +CONFIG_USB_GADGET=y
> > > > > +CONFIG_SPL_USB_GADGET=y
> > > > > +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> > > > > +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> > > > > +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
> > > > > +CONFIG_USB_GADGET_DOWNLOAD=y
> > > > > +CONFIG_SPL_DFU=y
> > > > > +# CONFIG_SPL_MMC is not set
> > > > > +# CONFIG_SPL_FS_FAT is not set
> > > > > +# CONFIG_SPL_LIBDISK_SUPPORT is not set
> > > > > +# CONFIG_SPL_SPI is not set
> > > > > +# CONFIG_SPL_SYS_MALLOC is not set
> > > > > +# CONFIG_CMD_GPT is not set
> > > > > +# CONFIG_CMD_MMC is not set
> > > > > +# CONFIG_CMD_FAT is not set
> > > > > +# CONFIG_MMC_SDHCI is not set
> > > > > -- 
> > > > > 2.43.0
> > > > 
> > > > Hi all, it appears that this patch breaks OSPI DFU on the
> > > > board.  In
> > > > particular, changing the CONFIG_SYS_DFU_DATA_BUF_SIZE seems to
> > > > be the
> > > > culprit.
> > > > 
> > > > I see the error as a DFU timeout when applying capsules.
> > > > 
> > > >   SF: Detected s28hs512t with page size 256 Bytes, erase size
> > > > 256
> > > > KiB, total 64 MiB
> > > >   ############jedec_spi_nor flash@0: flash operation timed out
> > > >   #DFU write failed
> > > > 
> > > 
> > > I'm not seeing this failure using the `-next` branch from
> > > yesterday
> > > (2f96033923).
> > > 
> > > I've attempted to use both the `uboot-capsule.bin` produced with
> > > and
> > > without the DFU config enabled whilst booting the SK-AM62 via DFU
> > > and
> > > from an SD card. I seem to be consistently getting the following:
> > > 
> > > => ext2ls mmc
> > > 1:1                                                    
> > > <DIR>       4096
> > > .                                                   
> > > <DIR>       4096
> > > ..                                                  
> > > <DIR>      16384
> > > lost+found                                          
> > >          1132791 uboot-
> > > capsule.bin                                   
> > > => load mmc 1:1 ${loadaddr} /uboot-
> > > capsule.bin                       
> > > 1132791 bytes read in 57 ms (19
> > > MiB/s)                               
> > > => efidebug capsule update
> > > ${loadaddr}                               
> > > ** File not found ubootefi.var
> > > **                                    
> > > Failed to load EFI
> > > variables                                         
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > SF: Detected s28hs512t with page size 256 Bytes, erase size 256
> > > KiB,
> > > total 64 Mi
> > > B                                                                
> > >     
> > > ########################################################         
> > >     
> > > ** Unable to write file ubootefi.var
> > > **                              
> > > Failed to persist EFI
> > > variables                                      
> > > =>
> > > 
> > > TBH, I'm not sure if this is good or bad at this point, but I'm
> > > not
> > > seeing the error that you reported. As can be seen above, I don't
> > > have
> > > a `ubootefi.var` file, but then I don't boot using EFI
> > > mechanisms, so I
> > > guess that's expected?
> > > 
> > > But then, the commands I've used above aren't applying the
> > > capsule
> > > either right?
> > > 
> > > Martyn
> > > 
> > > > Jon
> > 
> > Hi Martyn, against upstream/next, I no longer see the failure. 
> > Thanks for
> > looking into it.
> > 
> > Jon
> 
> Sorry, I wasn't running what I thought I was.  I can confirm that I
> see the failure when I build against 2f960339235.
> 
> Here are my steps:
> 
> => ls mmc 1
>    288978   tiboot3.bin
>   1017959   tispl.bin
>   1130635   u-boot.img
>       307   uEnv.txt
>   1133143   uboot-capsule.bin
> 
> 5 file(s), 0 dir(s)
> 
> => load mmc 1:1 ${loadaddr} /uboot-capsule.bin
> 1133143 bytes read in 60 ms (18 MiB/s)
> => efidebug capsule update ${loadaddr}
> Cannot read EFI system partition
> Cannot read EFI system partition
> Failed to persist EFI variables
> Cannot read EFI system partition
> Failed to persist EFI variables
> Cannot read EFI system partition
> Failed to persist EFI variables
> Cannot read EFI system partition
> Failed to persist EFI variables
> Cannot read EFI system partition
> Failed to persist EFI variables
> SF: Detected s28hs512t with page size 256 Bytes, erase size 256 KiB,
> total 64 MiB
> ############jedec_spi_nor flash@0: flash operation timed out
> #DFU write failed
> Firmware update failed: <NULL>
> Cannot handle a capsule at 0000000082000000
> => 
> 
> What board rev of the sk-am62 are you using?  I am using PROC142A.
> 
> 

Hi Jon,

The board I have here is PROC114E3.

Martyn

> Jon
>
diff mbox series

Patch

diff --git a/configs/am62x_a53_usbdfu.config b/configs/am62x_a53_usbdfu.config
new file mode 100644
index 0000000000..3a19cf2328
--- /dev/null
+++ b/configs/am62x_a53_usbdfu.config
@@ -0,0 +1,29 @@ 
+CONFIG_SYS_MALLOC_LEN=0x2000000
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SPL_RAM_SUPPORT=y
+CONFIG_SPL_RAM_DEVICE=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_SPL_DFU=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_USB=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_DFU_MMC=y
+CONFIG_DFU_RAM=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
+CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_AM62=y
+CONFIG_USB_DWC3_AM62=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0451
+CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
+CONFIG_USB_GADGET_DOWNLOAD=y
diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig
index 6c708dcb05..16294a6a79 100644
--- a/configs/am62x_evm_a53_defconfig
+++ b/configs/am62x_evm_a53_defconfig
@@ -68,6 +68,7 @@  CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_CLK_TI_SCI=y
+CONFIG_DFU_SF=y
 CONFIG_DMA_CHANNELS=y
 CONFIG_TI_K3_NAVSS_UDMA=y
 CONFIG_TI_SCI_PROTOCOL=y
@@ -111,3 +112,5 @@  CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
 CONFIG_EFI_SET_TIME=y
+
+#include <configs/am62x_a53_usbdfu.config>
diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
new file mode 100644
index 0000000000..772bb2ab93
--- /dev/null
+++ b/configs/am62x_r5_usbdfu.config
@@ -0,0 +1,28 @@ 
+CONFIG_SPL_ENV_SUPPORT=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
+CONFIG_MISC=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_AM62=y
+CONFIG_USB_GADGET=y
+CONFIG_SPL_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0451
+CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_SPL_DFU=y
+# CONFIG_SPL_MMC is not set
+# CONFIG_SPL_FS_FAT is not set
+# CONFIG_SPL_LIBDISK_SUPPORT is not set
+# CONFIG_SPL_SPI is not set
+# CONFIG_SPL_SYS_MALLOC is not set
+# CONFIG_CMD_GPT is not set
+# CONFIG_CMD_MMC is not set
+# CONFIG_CMD_FAT is not set
+# CONFIG_MMC_SDHCI is not set