U-boot customization for verdin am62

Hi all,

We are trying to customize the u-boot of verdin am62 for our custom board in which we want to remove the usb boot, ethernet boot as well as booting MMC1.

In usb boot we want to change the usb instance for usb-boot for updating the image in mmcblk0.

currently we have a workspace under build as u-boot-toradex-ti, but we are not finding any device tree files to do so.

and also kindly provide the information on how to test the new u-boot image after building.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To customize the U-Boot for your Verdin AM62 module and remove USB, Ethernet, and MMC1 boot options, you will need to modify the U-Boot configuration files rather than the device tree files. U-Boot boot options are typically controlled through configuration settings in the U-Boot source code.

Here are the steps you can follow:

  1. Access U-Boot Configuration: Navigate to your U-Boot source directory, which you mentioned as u-boot-toradex-ti.

  2. Modify Configuration Files: Look for the configuration header files, typically named include/configs/<board_name>.h. This file contains macros that define the boot options.

  3. Disable Boot Options:

    • USB Boot: Locate and comment out or remove any macros related to USB boot, such as CONFIG_CMD_USB or CONFIG_USB_STORAGE.
    • Ethernet Boot: Similarly, find and disable macros like CONFIG_CMD_NET or CONFIG_NET.
    • MMC1 Boot: Look for CONFIG_MMC or CONFIG_CMD_MMC and adjust accordingly.
  4. Rebuild U-Boot: After making these changes, rebuild U-Boot to apply the new configuration. Use the appropriate make commands for your setup, ensuring you target both the A53 and R5 processors if required.

  5. Deploy the New U-Boot: Once built, deploy the new U-Boot binary to your module.

Device trees are primarily used for hardware configuration and peripheral setup, not for boot option management in U-Boot. Therefore, your focus should be on the U-Boot configuration files for this task.

By following these steps, you should be able to customize the U-Boot to meet your specific boot requirements for the Verdin AM62 module.

If you have any more questions, feel free to ask!

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Custom device tree.

Hi @naveenkumar.muthusam,

If I understand your question correctly, you want to modify the boot targets (either change the order in which the bootloader will look into targets or remove some of them) in the uboot environment. Is that the case? Do you have a specific reason why you want to remove USB, ethernet and MMC1 from the targets list?

Here we have instructions for how to build a custom Uboot from sources and deploy it: https://developer.toradex.com/linux-bsp/os-development/build-u-boot-and-linux-kernel-from-source-code/build-u-boot/#downstream
This is what I would recommend to try first: Build your uboot, deploy and test it before you add the patches into your Yocto build for the image.

Now regarding the file you need to modify to change the order of boot targets:
Currently, we have an include file per device. In there you can specify the U-Boot environment and also the boot devices. Here for example the verdin-imx8mp:
https://git.toradex.com/cgit/u-boot-toradex.git/tree/include/configs/verdin-imx8mp.h?h=toradex_imx_lf_v2024.04
The macro BOOT_TARGET_DEVICES will then create the boot target list. If you want to add for example USB as first boot source, you could do something like this:

diff --git a/include/configs/verdin-imx8mp.h b/include/configs/verdin-imx8mp.h
index bff417fdafb..80b4055cd97 100644
--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -30,6 +30,7 @@

 /* Enable Distro Boot */
 #define BOOT_TARGET_DEVICES(func) \
+       func(USB, usb, 0) \
        func(MMC, mmc, 1) \
        func(MMC, mmc, 2) \
        func(DHCP, dhcp, na)

This patch can then be added in your custom meta layer (meta-custom/recipes-bsp/u-boot) with a SRC_URI;append.

Hi @rudhi.tx ,

Thanks for your reply.

i was able to the boot targets changes. but with respect to the usb instance changes i need some more information.

currenlty in u-boot, i am able to detect the usb devices connected to the usb0 instance. we want to detect devices connected to the usb1 in the u-boot as well.

please provide information regarding the device tree used in the u-boot for verdin am62 as well.

Hello @naveenkumar.muthusam,

You can modify the patch to the following and it should work:

diff --git a/include/configs/verdin-imx8mp.h b/include/configs/verdin-imx8mp.h
index bff417fdafb..80b4055cd97 100644
--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -30,6 +30,7 @@

 /* Enable Distro Boot */
 #define BOOT_TARGET_DEVICES(func) \
+       func(USB, usb, 1) \
        func(MMC, mmc, 1) \
        func(MMC, mmc, 2) \
        func(DHCP, dhcp, na)

Hi @rudhi.tx ,

Thanks for your reply.

Please check the below logs.

Hit any key to stop autoboot: 0
Verdin AM62 #
Verdin AM62 #
Verdin AM62 #
Verdin AM62 # mmc info
Device: mmc@fa10000
Manufacturer ID: 13
OEM: 4e
Name: Q2J55L
Bus Speed: 200000000
Mode: HS200 (200MHz)
Rd Block Len: 512
MMC version 5.0
High Capacity: Yes
Capacity: 7.1 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 7.1 GiB WRREL
Boot Capacity: 16 MiB ENH
RPMB Capacity: 4 MiB ENH
Boot area 0 is not write protected
Boot area 1 is not write protected
Verdin AM62 # sf probe
Unknown command ‘sf’ - try ‘help’
Verdin AM62 # sf
Unknown command ‘sf’ - try ‘help’
Verdin AM62 # usb strt
USB is stopped. Please issue ‘usb start’ first.
Verdin AM62 # usb start
starting USB…
Bus usb@31100000: generic_phy_get_bulk : no phys property
Register 1000840 NbrPorts 1
Starting the controller
USB XHCI 1.10strong text
scanning bus usb@31100000 for devices… 3 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
Verdin AM62 #

whenever i give command of usb start in u-boot, i am able to see only usb@31100000 , which corresponds to usb1. in case if i want to add usb@31000000 which is usb0, how can i do it

kindly provide information regarding this. Please provide information regarding the Dts file used in u-boot. Please provide this information because we need to remove MMC1 and we have to configure the MMC1 Pins fot UART.

Hello @naveenkumar.muthusam,

In my understanding you don’t have to modify the device tree files in uboot to modify the boot targets. You can do that by modifying the header file. Nevertheless, if you would like to take a look at the device tree file, it is u-boot-toradex/arch/arm/dts/k3-am62-verdin-dev.dtsi.

Also, could you please try again building uboot with the following patch:

diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h
index a2cbcce33d1..8fa15cb6ce9 100644
--- a/include/configs/verdin-am62.h
+++ b/include/configs/verdin-am62.h
@@ -27,8 +27,9 @@
 #if CONFIG_TARGET_VERDIN_AM62_A53
 /* Enable Distro Boot */
 #define BOOT_TARGET_DEVICES(func) \
+       func(USB, usb, 0) \
+       func(USB, usb, 1) \
        func(MMC, mmc, 0) \
-       func(MMC, mmc, 1) \
        func(DHCP, dhcp, na)

Please note that in my previous answers, I used an example with the files for verdin i.MX8MP. I have changed it to the one for AM62 here. Once you are in uboot, you can try with the commands usb start 0 for USB 0 and usb start 1 for USB 1.

Hi @rudhi.tx,

Thanks for your reply.

I have checked about commands usb start 0, this command always starts usb instance 1 only. even the command usb start 1 is also starting the usb instance 1 only.

Once the U-boot build is completed, how can test newly built u-boot image.please provide steps for steps for testing it in the dev board.

steps i need are, what partions are needed in the sd card and which images needed to be added in the SD Card for testing u-boot only.

Hello @naveenkumar.muthusam,

I have some interesting findings as I was working on this topic. However, the right solution depends on your use-case. I would like to propose a meeting to understand this better and to share the solution with you. Do you think you have time for a meeting this week? If so, could you please send me some time slots?

Hi @rudhi.tx,

Thanks for your reply. we are can have discussion in friday between 2-5PM IST.

Hi @naveenkumar.muthusam

I just sent you a Zoom meeting invitation via email. Let me know if you received it :slight_smile:

Hi @rudhi.tx,

we have received your invite. Thank you.

Hi @rudhi.tx,

we have one more query as well.

In Our custom board, we are using MMC1 Pins for UART. The voltage level of this MMC1 Pins are by default stays at 3.3V. in case, if we want the Voltage level to stay at 1.8V, is there any changes needed in the Device tree. we tried few things, which didn’t work out for us. maybe we can discuss this as well in call tomorrow.

Hello @naveenkumar.muthusam,

Thanks for the meeting earlier.
Going back to the original topic:
Here is the patch that worked for me (you need to configure usb0 instance to be in host mode):

 diff --git a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi
index 206df610461..f706340a60f 100644
--- a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi
@@ -183,7 +183,7 @@
 };
 
 &usb0 {
-       dr_mode = "peripheral";
+       dr_mode = "host";
        /* Since role switching is not supported in U-Boot */
        /delete-property/ extcon;
        bootph-pre-ram;

Then I built the custom uboot following this article: Specifics: Build U-Boot for TI AM62x-based SoMs | Toradex Developer Center

Then to deploy the custom uboot, I replaced the files tispl.bin, u-boot.img and tiboot3-am62x-hs-fs-verdin.bin in a working BSP reference image which I downloaded from our website. Then you can flash this custom image into your recovered Verdin AM62 module, interrupt the booting in uboot and access the USB devices. Instead of re-flashing the whole image, you can also use dd to replace these 3 files in mmcblk0boot0. If you use dd, you can check the seek values for these files in the image.json file in the TEZI compatible image. This is what I would do in development to test the setup. Personally, I prefer method 1 in development.

However, when it comes to production programming, you need to consider certain things. To boot from a USB device or SD card, you need U-Boot (in your case, the custom u-boot) already running on the module. I understand that you want to boot the module from USB device - connected to USB instance 0. Now, as I explained earlier, we ship the modules with Toradex Easy Installer (TEZI) pre-installed on it, and the uboot on the default TEZI would have the same behavior that you observe now (will only detect USB controller 1).

Therefore, you need to install the custom uboot into eMMC if you have a strong reason why you want to boot from USB instance 0 (instead of using the eMMC directly). You will need some medium to install a custom image or custom uboot in the first place. It could be an SD card, an Ethernet interface, or USB itself. However, in your case, I believe you don’t have Ethernet port on your custom carrier board, and you cannot access SD card yet due to the voltage level issue that you mentioned. Also, you cannot install through USB device since your custom carrier board can access only USB instance 0 (chicken and egg problem here). I believe the solution is to fix the SD card issue first.

Hi @rudhi.tx ,

Thanks for your input. we are able to test the latest image of u-boot.I have updated the image with the below commands.

=> mmc dev 0 1
=> fatload mmc 1 ${loadaddr} tiboot3-am62x-hs-fs-verdin.bin
=> mmc write ${loadaddr} 0x0 0x400
=> fatload mmc 1 ${loadaddr} tispl.bin
=> mmc write ${loadaddr} 0x400 0x1000
=> fatload mmc 1 ${loadaddr} u-boot.img
=> mmc write ${loadaddr} 0x1400 0x2000

with respect to the usb0, yes we are able to see that the usb0 is getting scanned for devices.

currently u-boot image is placed in a SD card and connected to the MMC1 interface and the commands above are entered to update the u-boot.

in case i want to try the usb, i have tried the below commands , but which seems to be not working.

below is the screenshot of commands and reply from the verdin.

Verdin AM62 # usb start
starting USB...
Bus usb@31000000: generic_phy_get_bulk : no phys property
Register 1000840 NbrPorts 1
Starting the controller
USB XHCI 1.10
Bus usb@31100000: generic_phy_get_bulk : no phys property
Register 1000840 NbrPorts 1
Starting the controller
USB XHCI 1.10
scanning bus usb@31000000 for devices... 1 USB Device(s) found
scanning bus usb@31100000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Verdin AM62 # fatload usb 0 ${loadaddr} u-boot.img
** Bad device specification usb 0 **
Couldn't find partition usb 0
Can't set block device
Verdin AM62 # fatload usb 0 ${loadaddr} u-boot.img
** Bad device specification usb 0 **
Couldn't find partition usb 0
Can't set block device
Verdin AM62 #

With respect to the SPL, currently it checks for MMC1 first and then MMC0, we want to change this order as well.

Kindly check this and let me know

Hi @rudhi.tx ,

any updates on this issue?

Hi @naveenkumar.muthusam,

@sahil.tx will support you on this topic soon. Thanks for understanding.

Hi @rudhi.tx @sahil.tx ,

Any updates on this issue?

Hi @naveenkumar.muthusam ,
Sorry I was not available, I will check and update you asap.

Hi @naveenkumar.muthusam ,
Sorry I was occupied with some other unavoidable tasks.
Let me know if you were able to make some progress, or shall I resume to look into it from where we left?