From 358f1902de1561820eb1e60fb142550d55d33fc8 Mon Sep 17 00:00:00 2001 From: Vinuchandran A V Date: Fri, 13 Nov 2026 16:08:23 +0530 Subject: [PATCH] feat(linux): Add AM62Ax USB MSC steps Added missing USB MSC steps for AM62Ax Signed-off-by: Vinu <45234135+vinuchandran-av@users.noreply.github.com> --- .../U-Boot/UG-Memory-K3.rst | 207 +++++++++++++++++- 1 file changed, 201 insertions(+), 6 deletions(-) diff --git a/source/linux/Foundational_Components/U-Boot/UG-Memory-K3.rst b/source/linux/Foundational_Components/U-Boot/UG-Memory-K3.rst index 01dbbf839..55705b3a2 100644 --- a/source/linux/Foundational_Components/U-Boot/UG-Memory-K3.rst +++ b/source/linux/Foundational_Components/U-Boot/UG-Memory-K3.rst @@ -259,7 +259,7 @@ USB Configuring USB in Host Mode ============================ -.. ifconfig:: CONFIG_part_variant not in ('J721E', 'J7200', 'J721S2', 'AM64X', 'AM62X', 'AM65X') +.. ifconfig:: CONFIG_part_variant not in ('J721E', 'J7200', 'J721S2', 'AM64X', 'AM62X', 'AM65X', 'AM62AX') Configuring USB in host mode documentation is pending for |__PART_FAMILY_DEVICE_NAMES__| reach out to: `Help e2e `__ for additional information. @@ -365,6 +365,33 @@ Configuring USB in Host Mode + dr_mode = "host"; u-boot,dm-spl; +.. ifconfig:: CONFIG_part_variant in ('AM62AX') + + .. note:: + + There are two instances of USB on AM62Ax SoC. On the SK board, zeroth instance is + brought out through a Type C port and the first instance is brought out through a Type + A port. By default, USB0 port is configured to be in **peripheral mode**. Since + U-Boot does not support dynamic switching of USB roles, below DT fragment needs to + be applied and U-Boot image needs to be rebuilt to make USB0 port as a USB 2.0 + host port. + + .. code-block:: diff + + diff --git a/dts/upstream/src/arm64/ti/k3-am62a7-sk.dts b/dts/upstream/src/arm64/ti/k3-am62a7-sk.dts + index 3a6d18c1..fb2b50a7 100644 + --- a/dts/upstream/src/arm64/ti/k3-am62a7-sk.dts + +++ b/dts/upstream/src/arm64/ti/k3-am62a7-sk.dts + @@ -726,6 +726,8 @@ + + &usb0 { + usb-role-switch; + + dr_mode = "host"; + + bootph-all; + + port { + usb0_hs_ep: endpoint { + .. ifconfig:: CONFIG_part_variant in ('AM65X') .. note:: @@ -392,7 +419,7 @@ Configuring USB in Host Mode /* Disable ICSSG2 EMAC1 */ /delete-node/ &icssg2_emac1; -.. ifconfig:: CONFIG_part_variant in ('J721E', 'J7200', 'J721S2', 'AM64X', 'AM62X', 'AM65X') +.. ifconfig:: CONFIG_part_variant in ('J721E', 'J7200', 'J721S2', 'AM64X', 'AM62X', 'AM65X', 'AM62AX') Loading images from USB storage =============================== @@ -411,7 +438,7 @@ Configuring USB in Host Mode Flash and boot SPL from USB storage =================================== -.. ifconfig:: CONFIG_part_variant not in ('J7200', 'J721E', 'AM64X', 'AM65X', 'J722S', 'AM62LX') +.. ifconfig:: CONFIG_part_variant not in ('J7200', 'J721E', 'AM64X', 'AM65X', 'J722S', 'AM62LX', 'AM62AX') Boot SPL from USB storage documentation is pending for |__PART_FAMILY_DEVICE_NAMES__| reach out to: `Help e2e `__ for additional information. @@ -441,6 +468,26 @@ Flash and boot SPL from USB storage the board. - The board should now boot to u-boot prompt. +.. ifconfig:: CONFIG_part_variant in ('AM62AX') + + Booting to U-Boot prompt from USB storage is supported. The following are the + steps to be followed: + + - To build the boot loader images with USB mass storage support, apply the following configuration fragments on top of the default defconfigs: + + - R5 SPL: am62ax_evm_r5_defconfig + am62x_r5_usbmsc.config + - A53 U-Boot: am62ax_evm_a53_defconfig + am62x_a53_usbmsc.config + + USB support is disabled by default in both SPL and U-Boot. For instructions to build the boot loader images, refer to :ref:`Build-U-Boot-label`. + - Create a FAT32 partition with boot flag enabled on the USB storage device. + - Copy the boot loader images (:file:`tiboot3.bin`, :file:`tispl.bin`, + :file:`u-boot.img`) into the above created partition. + - Set the boot mode switches to USB host boot mode (Refer to the + **Initialization/Boot Mode Pins** chapter of TRM for boot switch details). + - Connect the USB Mass storage device with the boot loader images and boot up + the board. + - The board should now boot to u-boot prompt. + .. ifconfig:: CONFIG_part_variant in ('AM64X', 'AM65X', 'J722S') .. ifconfig:: CONFIG_part_variant in ('AM64X') @@ -512,7 +559,7 @@ Flash and boot SPL from USB storage Boot Linux from USB storage ============================== -.. ifconfig:: CONFIG_part_family not in ('J7_family', 'AM62X_family', 'AM64X_family') +.. ifconfig:: CONFIG_part_family not in ('J7_family', 'AM62X_family', 'AM64X_family', 'AM62AX_family') Booting Linux from USB storage documentation is pending for |__PART_FAMILY_DEVICE_NAMES__|, reach out to: `Help e2e `__ for additional information. @@ -576,6 +623,156 @@ Boot Linux from USB storage => run usb_boot +.. ifconfig:: CONFIG_part_family in ('AM62AX_family') + + Loading the Linux kernel, Device Tree and the Root file system from USB Mass storage + device requires the following changes: + + - **U-Boot** + + - In U-Boot, the USB controller can be used in either host or peripheral mode. For + booting to Linux kernel from USB storage device, the USB port is to be set as host. + - By default, on SK-AM62A-LP board the zero instance of USB connected to the Type C + port, is set to peripheral mode and the first instance of USB connected to the Type + A port is set to host mode. + - Therefore, USB controller needs to be set host mode and custom boot loader images + are required to be built, if zeroth instance is used. Refer to note in section + :ref:`uboot-configure-usb-in-host-mode` + + - **Linux** + + - In Linux, by default the USB subsystem is built as modules. For booting from USB + mass storage device, USB subsytem is required to be built into the image. This can be + done by making the following changes in the configuration used for building kernel: + + .. code-block:: Kconfig + + CONFIG_USB_COMMON=y + CONFIG_USB=y + CONFIG_USB_XHCI_HCD=y + CONFIG_USB_XHCI_PCI=y + CONFIG_USB_XHCI_PLATFORM=y + CONFIG_USB_STORAGE=y + CONFIG_USB_DWC3=y + CONFIG_USB_DWC3_AM62=y + CONFIG_USB_GADGET=y + CONFIG_TYPEC=y + CONFIG_TYPEC_TPS6598X=y + CONFIG_USB_ROLE_SWITCH=y + + - By default, the USB0 port (Type-C) is configured in peripheral mode in the Linux + device tree. To boot from a USB mass storage device connected to USB0, apply the + following device tree change so that USB0 operates as a USB 2.0 host port, and + rebuild the device tree blob: + + .. code-block:: diff + + diff --git a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts + index 3a6d18c14..b220ec5c2 100644 + --- a/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts + +++ b/arch/arm64/boot/dts/ti/k3-am62a7-sk.dts + @@ -726,7 +726,8 @@ &usbss0 { + + &usb0 { + usb-role-switch; + - + + dr_mode = "host"; + + bootph-all; + port { + usb0_hs_ep: endpoint { + remote-endpoint = <&usb_con_hs>; + + .. note:: + + This change must be applied to both the U-Boot device tree (see + `Configuring USB in Host Mode`_) and the Linux device tree. The two are + configured independently, and the U-Boot setting does not carry over to Linux. + + **Copying the images to USB storage device** + + - After making the required changes mentioned above, build the kernel, device tree + file and modules. + - The USB Mass storage device should have the rootfs as the second + partition with ext4 file system. The following images should be in :file:`/boot` directory: + + #. Linux kernel **Image** + #. Device tree blob (dtb) file + + + **Run usbboot** + + By default, the U-Boot environment does not define a ``usbboot`` command. + Add the following environment variables to the board environment file + (:file:`board/ti/am62ax/am62ax.env`), rebuild and use the A53 U-Boot (with the + previously mentioned fragment). + + .. code-block:: diff + + diff --git a/board/ti/am62ax/am62ax.env b/board/ti/am62ax/am62ax.env + index ea0d81b1..fc884c6c 100644 + --- a/board/ti/am62ax/am62ax.env + +++ b/board/ti/am62ax/am62ax.env + @@ -20,3 +20,24 @@ bootdir=/boot + rd_spec=- + rproc_fw_binaries= 0 /lib/firmware/am62a-mcu-r5f0_0-fw 2 /lib/firmware/am62a-c71_0-fw + name_overlays=ti/k3-am62a7-sk-edgeai.dtbo + + + +args_usb=part uuid usb ${bootpart} uuid; + + setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootwait + +init_usb=run args_all args_usb + +get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} + +get_overlay_usb= + + fdt address ${fdtaddr}; + + fdt resize 0x100000; + + for overlay in $name_overlays; + + do; + + load usb ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay} && fdt apply ${dtboaddr}; + + done; + +get_kern_usb=load usb ${bootpart} ${loadaddr} ${bootdir}/${name_kern} + +usbboot=setenv boot usb; + + setenv bootpart 0:2; + + usb start; + + run init_usb; + + run get_kern_usb; + + run get_fdt_usb; + + run get_overlay_usb; + + run run_kern; + + .. important:: + + Drop any variable from the patch that is already defined in your + environment (for example ``args_usb``), and adjust ``root=`` and + ``bootpart`` to match the partition layout of your USB drive. + + During boot, cancel the autoboot at the U-Boot prompt and run the + following command: + + .. code-block:: console + + => run usbboot + + **Manual steps (without modifying the environment)** + + If the environment is not modified, the same boot can be performed manually + from the U-Boot prompt. The USB drive must use the same layout as the SDK + SD card image: a FAT boot partition (partition 1) and an ext4 root + filesystem partition (partition 2). The kernel ``Image`` and the device + tree blob are loaded from the ``/boot`` directory of the ext4 partition. + + .. code-block:: console + + => usb start + => usb storage + => ls usb 0:2 /boot + => load usb 0:2 ${loadaddr} /boot/Image + => load usb 0:2 ${fdtaddr} /boot/.dtb + => setenv bootargs console=ttyS2,115200n8 root=/dev/sda2 rootwait + => booti ${loadaddr} - ${fdtaddr} + + Replace ``.dtb`` with the device tree for your board, and update + the console and root device to match your setup. For example, on the + SK-AM62A-LP use ``/boot/dtb/ti/k3-am62a7-sk.dtb``. + .. ifconfig:: CONFIG_part_family in ('AM62X_family') To load the Linux kernel, Device Tree and the Root file system from USB Mass storage @@ -688,8 +885,6 @@ Boot Linux from USB storage => run usbboot -| - .. _uboot-mmc-support: MMC support in u-boot