[PATCH 0/2] AM62A DWC3: Add support for USB DFU boot in OTG mode

Roger Quadros rogerq at kernel.org
Thu Nov 28 13:45:04 CET 2024



On 26/11/2024 14:03, Siddharth Vadapalli wrote:
> Hello,
> 
> This series adds support for USB DFU boot on TI's AM62A SoC which has
> two instances of DWC3 USB Controllers namely USB0 and USB1. The USB0
> instance of the USB Controller supports USB DFU boot:
> ROM => tiboot3.bin => tispl.bin => u-boot.img
> 
> USB DFU Boot requires the USB Controller to be configured for Gadget
> mode of operation. Since the USB0 instance of the DWC3 USB Controller
> supports both Host and Gadget modes of operation via the Type-C interface
> on the AM62A7-SK board, the device-tree specifies the "dr_mode" as "OTG".
> However, there is currently no support for dynamically switching the "mode"
> from Host to Gadget and vice-versa with the help of a state-machine.
> The OTG mode is treated as a separate mode in itself rather than being
> treated as an intermediate stage before assuming the Host/Gadget mode.
> Due to this, USB DFU boot via the Type-C interface doesn't work as the
> USB Controller hasn't been appropriately configured for Device/Gadget
> mode of operation. One option is to change the device-tree to specify
> "dr_mode" as "peripheral" and force the controller to assume the Device
> role. This will imply that the U-Boot device-tree for AM62A diverges
> from its Linux counterpart. Therefore, with the intent of keeping the
> device-tree uniform across Linux and U-Boot, and at the same time, in
> order to enable USB DFU boot in "OTG" mode with the DWC3 Controller,
> the first patch in this series sets the "mode" on the basis of the
> caller function, rather than using the "dr_mode" property in the
> device-tree. There are only two callers of "dwc3_generic_probe()",
> each of which clearly specify the expected mode of configuration.
> This will enable both Host and Device mode of operation based on the
> command executed by the user, thereby truly supporting "OTG"
> functionality when the USB Controller supports it.

We don't really support OTG state machine. All you are supporting is
user initiated role change.

> 
> The second patch in this series adds USB DFU environment for AM62A,
> enabling USB DFU Boot and USB DFU flash on AM62A.
> 
> In addition to the patches in this series, the following device-tree
> changes will be required to test USB DFU on AM62A (bootph-all property
> to be added to ensure that USB Controller is present at all stages
> for DFU Boot):
> https://gist.github.com/Siddharth-Vadapalli-at-TI/53ba02cb0ff4a09c47e920d08247065f
> The above device-tree changes will be made to the Linux device-tree,
> which shall ensure that the same shall be a part of U-Boot device-tree
> eventually.
> 
> The USB DFU config fragments for AM62x have been used for enabling
> USB DFU boot on AM62a as follows:
> R5  => am62ax_evm_r5_defconfig + am62x_r5_usbdfu.config
> A53 => am62ax_evm_a53_defconfig + am62x_a53_usbdfu.config
> 
> Logs validating USB DFU boot with this series:
> https://gist.github.com/Siddharth-Vadapalli-at-TI/daa71da1b0e478a51afea42605fb2d2c
> 
> Series is based on commit
> 3073246d1be Prepare v2025.01-rc3
> of the master branch of U-Boot.
> 
> Regards,
> Siddharth.
> 
> Siddharth Vadapalli (2):
>   usb: dwc3-generic: set "mode" based on caller of dwc3_generic_probe()
>   board: ti: am62ax: env: include environment for DFU
> 
>  board/ti/am62ax/am62ax.env      | 1 +
>  drivers/usb/dwc3/dwc3-generic.c | 9 +++++----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 

-- 
cheers,
-roger



More information about the U-Boot mailing list