Jetson Tx2 Custom Board Custom Device Tree Flow Jetpack 4.3 L4T v32 r3.1

Hello,

I have one question regarding the generation of the DTB file for a Jetson Tx2 on a custom carrier board.
My version of Jetpack is 4.3 with L4T version 32 Revision 3.1
I’ve design a custom board following all the hardware related guidelines. I’m following the design checklists presents at these links:

Hardware Checklist
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fadaptation_and_bringup_checklists.html%23

Software Checklist.
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fadaptation_and_bringup_checklists.html%23wwpID0EPHA

The main document for Platform adaptation which I’m following is:

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fadaptation_and_bringup_tx2.html%23

I’ve managed to create the dtsi file for PINMUX and PADVOLTAGE with the pinmux spreadsheet and convert it to .CFG with the pinmux-dts2cfg.py scripts.
But there’s something in the “Jetson TX2 Platform Adaptation and Bring-Up” that I didn’t understand. I’m stuck at “Porting the Linux Kernel” section.

Let’s say I want to change the USB supply to enable the usb or change some regulator parameters. My board doesn’t have ina3221 for power metering and the GPIO Expander

The guide says to look the file “tegra186-quill-power-tree-p3310-1000-a00-00.dtsi”.

“As a best practice, create your own set of .dts files based on the Quill files already present. Rename your newly created files to the name of your board.”

I’v done that and change the includes in the
tegra186-quill-p3310-1000-a00-00-base.dts

This is an include in the main .dts file: tegra186-quill-p3310-1000-a00-00-base.dts

All these file are in the sources/hardware/… subfolders downloaded with ./source_sync.sh

The guide then says:
“Use fdtdump or dtc to generate a .dts from the final .dtb file and check if your changes have taken effect.”

So basically it tells me how to check if the changes I have made have taken effect but not how to make these changes…

If I try to compile this latter file using the DTC command:
dtc -I dts -O dtb -o tegra186-quill-p3310-1000-a00-00-base.dtb tegra186-quill-p3310-1000-a00-00-base.dts

I receive the following error:
Error: tegra186-quill-p3310-1000-a00-00-base.dts:16.1-2 syntax error
FATAL ERROR: Unable to parse input tree

because (I’m guessing, I’m a beginner with linux platform) the #include statements are preprocessor statement that the dtc command couldn’t resolve?

So:

1 - How can I make a the DTB starting with the main .dts with all the included custom .dtsi files without reverse compile the base.dts with DTC, modding it, and recompile?
(I would not prefer to work on a >14000 lines code file with hexadecimal values for obvious reason, it became very difficult to track the modification)

2 - I must build the whole kernel everytime I made a device tree change or there’s a much more smart way?

Thank you,

hello mrco89,

below error caused by DT compile cannot find the property definition, which should be undefined, or it’s included in other source files.

I would suggest you create your own dtsi source file, and modify the original DT source to include it for compile.
it should be the better way to generate (also, to maintain) your customize DTB binary.

the building time would be shorter once you build the kernel completely.

Hello JerryChang,

thank you for the reply.

I actually done that, here’s the beginning of my tegra186-quill-p3310-1000-a00-00-base.dts file:

/*
 * tegra186-quill-p3310-a00-00-base.dts Quill A00 Board
 *
 * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#include <t18x-common-platforms/tegra186-quill-common-p3310-1000-a00.dtsi>
#include <t18x-common-platforms/tegra186-quill-power-tree-p3310-1000-a00-00-spartacus1.dtsi>
#include <t18x-common-platforms/tegra186-quill-camera-modules.dtsi>
#include <t18x-common-modules/tegra186-display-e3320-1000-a00.dtsi>

/* comms dtsi file should be included after gpio dtsi file */
#include <t18x-common-platforms/tegra186-quill-comms.dtsi>
#include <t18x-common-plugin-manager/tegra186-quill-p3310-1000-a00-plugin-manager.dtsi>
#include <t18x-common-modules/tegra186-super-module-e2614-p2597-1000-a00.dtsi>
#include <t18x-common-plugin-manager/tegra186-quill-display-plugin-manager.dtsi>
#include <t18x-common-prod/tegra186-priv-quill-p3310-1000-a00-prod.dtsi>
#include <t18x-common-plugin-manager/tegra186-quill-camera-plugin-manager.dtsi>

you can see that the line,
include <t18x-common-platforms/tegra186-quill-power-tree-p3310-1000-a00-00-spartacus1.dtsi>
is not the original <tegra186-quill-power-tree-p3310-1000-a00-00.dtsi> but a modded one. This file is in the same directory as the original one:
/Linux_for_Tegra/sources/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms
If you have any suggestion on how to investigate in the problem let me know.

I’ve notice that if I try to compile with DTC the original tegra186-quill-p3310-1000-a00-00-base.dts, with the original includes, it gives me the same “Unable to parse input tree” error. So I’m guess I’m missing something in the procedure. could you be more specific on where to put the edited dtsi file in the sources directories, and tell me if there’s a different commands to compile the DTB?

You could confirm also that the procedure to generate the new DTB that I’m following (main .dts with included .dtsi) is right?

Regards,

Marco