We would like to permanently set the USB 2.0 Eye Diagram related registers to fixed values during system boot, rather than applying them manually each time.
Question:
Is there a way to configure these values permanently, such as through device tree (padctl settings) or a boot-time initialization script, so that they are applied automatically on each boot?
We are working on a Jetson Orin Nano, running L4T 36.4.3
*** Please note that this reply is generated by LLM automatically ***
To permanently set the USB 2.0 Eye Diagram related registers to fixed values during system boot on a Jetson Orin Nano running L4T 36.4.3, you have a few options to consider. The goal is to automate the process of applying these register values, so they are set automatically on each boot, rather than manually executing commands each time.
Option 1: Device Tree Settings
The Device Tree is a data structure that describes the hardware components of a system, and it’s used by the operating system to configure and manage these components. Modifying the Device Tree to include your specific register settings is a viable approach. This involves creating or modifying a Device Tree Binary (DTB) file that includes the desired register settings.
For the Jetson Orin Nano, you would need to:
Identify the Correct Device Tree File: Determine which DTB file is being used by your system. This information can be found in the boot logs or by checking the /boot directory.
Modify the Device Tree Source: You’ll need to modify the Device Tree source files (.dts or .dtsi) to include your register settings. This requires knowledge of the Device Tree syntax and the specific register addresses you’re modifying.
Compile the Device Tree: After modifying the source files, you’ll need to compile them into a DTB file using the Device Tree compiler (dtc).
Flash the New DTB: Use the flash.sh command to flash the new DTB file to your device. Ensure you’re using the correct flash.sh command for your device and configuration.
Option 2: Boot-time Initialization Script
Another approach is to create a boot-time initialization script that applies these register settings automatically during each boot. This can be achieved by:
Creating a Script: Write a script that applies the desired register settings using the appropriate commands (e.g., devmem2 or another tool suitable for your register modifications).
Making the Script Executable: Ensure your script has execute permissions.
Adding to Boot Process: You’ll need to add your script to the system’s boot process. This can typically be done by placing the script in a directory like /etc/rc.local or by adding it to a systemd service that runs at boot time.
Comparison and Considerations
Device Tree Modifications:
Pros: Applies settings at a very low level, potentially before the operating system fully boots. Can be more robust as it’s less dependent on the state of the system at boot time.
Cons: Requires knowledge of Device Tree syntax and compilation. Incorrect modifications can prevent the system from booting.
Boot-time Initialization Script:
Pros: Easier to implement for those familiar with scripting. Less risk of causing boot issues if done correctly.
Cons: May apply settings slightly later in the boot process, potentially after some system components have already been initialized.
Conclusion
Both methods can achieve your goal of permanently setting USB 2.0 Eye Diagram related registers on a Jetson Orin Nano. The choice between modifying the Device Tree and using a boot-time initialization script depends on your specific requirements, your team’s expertise, and the exact nature of the register settings you’re applying. If you’re looking for a more integrated, low-level solution, Device Tree modifications might be preferable. However, if ease of implementation and less risk of boot issues are more important, a boot-time script could be the better choice.
*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***
We should consider backporting the tegra_xusb_lane_parse_dt function from JP5.1.5’s xusb.c to restore support for the "nvidia,hs_curr_level_offset" device tree property, so that the driver will use “usb2->hs_curr_level_offset” to update the “XUSB_PADCTL_USBX_OTG_PAD0_CTL_0_0” register.
int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane,
struct device_node *np)
{
struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane);
struct device *dev = &lane->pad->dev;
const char *function;
s32 offset;
int err;
err = of_property_read_string(np, "nvidia,function", &function);
if (err < 0)
return err;
err = match_string(lane->soc->funcs, lane->soc->num_funcs, function);
if (err < 0) {
dev_err(dev, "invalid function \"%s\" for lane \"%pOFn\"\n",
function, np);
return err;
}
lane->function = err;
err = of_property_read_s32(np, "nvidia,hs_curr_level_offset", &offset);
if (err == 0)
usb2->hs_curr_level_offset = offset;
/* this property is optional, ignore -EINVAL error */
if (err == -EINVAL)
err = 0;
return err;
}