Hello,
I have a very simple device tree change that I want to do.
/ {
aliases {
rtc2 = &ds1339;
};
bus@0 {
i2c@c240000 {
status = "okay";
ds1339: rtc@68 {
compatible = "dallas,ds1339";
trickle-resistor-ohms = <2000>;
reg = <0x68>;
};
};
};
};
What I discovered by reading the documentation and forum is that I either create a device tree overlay or directly modify the provided device tree.
1. Device Tree Overlay
/dts-v1/;
/plugin/;
/ {
overlay-name = "Test Overlay";
aliases {
rtc2 = &ds1339;
};
fragment@0 {
target-path = "/";
__overlay__ {
bus@0 {
i2c@c240000 {
status = "okay";
ds1339: rtc@68 {
compatible = "dallas,ds1339";
trickle-resistor-ohms = <2000>;
reg = <0x68>;
};
};
};
};
};
};
- When I take a look at the existing overlays /Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay some do have overlay-name and compatible and some do not. Is this property therefore not required?
- Is there a documentation what we need to add into compatible when we want to support for example Jetson Orin Nano and Jetson Orin NX or can we leave compatible out when it does not matter?
After creating the .dts file compile it with:
dtc -O dtb -o some_overlay.dtbo -@ some_overlay.dts
And copy it:
cp some_overlay.dtbo Linux_for_Tegra/kernel/dtb/
And add it to my custom.conf file used for flashing:
...
OVERLAY_DTB_FILE+=",some_overlay.dtbo";
...
2. Adding it to existing device tree
- which of the device tree files should I edit in Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public?
- probably different ones when I want to make changes for example only to Orin Nano or common for all
- how can I do it modular and keep my device tree files separate (f.i. by including it as a .dtsi file)
- are there additional steps required like for the device tree overlay?
To sum it up. What is the recommended way to add a custom device tree (L4T 36.4.3)? Which of the two ways is easier and less prone to errors?