Jump to content

NVIDIA Jetson - Device Tree Overlay: Difference between revisions

Line 109: Line 109:
==Device tree overlay nodes==
==Device tree overlay nodes==


Since in a device tree overlay some symbols can not be defined, since they are defined in the device tree, then is required overlay nodes to manage this cases.
In a device tree overlay, symbols and labels that are not defined in the device tree overlay can not be used, since they are defined in the original device tree. To manage these cases the device tree overlay defines extra nodes to define symbols and labels that are not defined.
To show the device tree node, we are going to create a device tree overlay to add a change the GPIO configuration for Jetson TX2 Developer Kit as example.
This extra node can be defined manually or you can use the tag /plugin/ and the device tree compiler dynamic resolves all the references to the device tree
/plugin/; /* allow undefined label references and record them */
To show the device tree nodes, we are going to create a device tree overlay to add a change the GPIO configuration for Jetson TX2 Developer Kit.
Create a file named tx2-uart-overlay.dts on the target platform with the following contents:
Create a file named tx2-uart-overlay.dts on the target platform with the following contents:


Line 151: Line 153:
};
};
</source>
</source>
Compile the device tree and use <code>fdtdump</code> to see the device tree overlay content


<source lang="bash">
dtc -O dtb -o tx2-uart-overlay.dtbo -@ tx2-uart-overlay.dts
fdtdump tx2-uart-overlay.dtbo
</source>
This is the fdtdump tool output
<source lang="bash">
/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x394 (916)
// off_dt_struct: 0x38
// off_dt_strings: 0x2f0
// off_mem_rsvmap: 0x28
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0xa4
// size_dt_struct: 0x2b8
/ {
    overlay-name = "d3_overlay_v4";
    compatible = "nvidia,p2597-0000+p3310-1000";
    fragment@0 {
        target = <0xffffffff>;
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <0x00000001>;
            header-40pin-pinmux {
                phandle = <0x00000001>;
                pin8 {
                    nvidia,function = "uarta";
                    nvidia,pins = "uart1_tx_pt0";
                    nvidia,pull = <0x00000000>;
                    nvidia,tristate = <0x00000000>;
                    nvidia,enable-input = <0x00000000>;
                    nvidia,lpdr = <0x00000000>;
                };
                pin10 {
                    nvidia,function = "uarta";
                    nvidia,pins = "uart1_rx_pt1";
                    nvidia,pull = <0x00000002>;
                    nvidia,tristate = <0x00000001>;
                    nvidia,enable-input = <0x00000001>;
                    nvidia,lpdr = <0x00000000>;
                };
            };
        };
    };
    __symbols__ {
        hdr40_pinmux = "/fragment@0/__overlay__/header-40pin-pinmux";
    };
    __fixups__ {
        pinmux = "/fragment@0:target:0";
    };
    __local_fixups__ {
        fragment@0 {
            __overlay__ {
                pinctrl-0 = <0x00000000>;
            };
        };
    };
};
</source>
===Nodes===


*'''__overlay__''': contains the body of which is added to the target node.
*'''__overlay__''': contains the body of which is added to the target node.
214

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.