Reference device tree?

Ok, so I’m trying to apply Auvidea’s modifications to the device tree of TX2 module that came with the Dev kit.

AFAIK, there’re three different versions of binary device tree’s present on the device:

  1. /boot/tegra186-quill-p3310-1000-c03-00-base.dtb
  2. /dev/mmcblk0p15
  3. /sys/firmware/fdt

#1 is the smallest one of the three. Here’s the additions #2 has over #1:

root@tx2:/boot# diff -u tegra186-quill-p3310-1000-c03-00-base.dts original_from_flash.dts
--- tegra186-quill-p3310-1000-c03-00-base.dts	2018-01-06 18:22:09.710997578 -0500
+++ original_from_flash.dts	2018-01-06 21:34:18.807574114 -0500
@@ -13543,9 +13543,16 @@
 	};
 
 	chosen {
+		bootargs = "root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:0 net.ifnames=0  ";
 		board-has-eeprom;
-		bootargs = "console=ttyS0,115200";
 		stdout-path = "/serial@3100000";
+
+		plugin-manager {
+
+			odm-data {
+				l4t;
+			};
+		};
 	};
 
 	firmware {

And #3 is the largest, presumably having additinal device specific info passed from u-boot, like hardware MAC addresses, device S/N, etc. Here’s the diff:

root@tx2:/boot# diff -u tegra186-quill-p3310-1000-c03-00-base.dts original.dts
--- tegra186-quill-p3310-1000-c03-00-base.dts	2018-01-06 18:22:09.710997578 -0500
+++ original.dts	2018-01-06 18:22:52.010620883 -0500
@@ -1,7 +1,9 @@
 /dts-v1/;
 
 /memreserve/	0x0000000080000000 0x0000000000010000;
+/memreserve/	0x0000000092000000 0x0000000000042000;
 / {
+	serial-number = "0322117079514";
 	compatible = "nvidia,quill", "nvidia,tegra186";
 	interrupt-parent = <0x1>;
 	#address-cells = <0x2>;
@@ -5259,16 +5261,13 @@
 		};
 
 		ramoops_carveout {
+			reg = <0x0 0x96080000 0x0 0x200000>;
 			compatible = "nvidia,ramoops";
-			size = <0x0 0x200000>;
 			alignment = <0x0 0x10000>;
-			alloc-ranges = <0x0 0x0 0x1 0x0>;
 			no-map;
 		};
 
 		vpr-carveout {
-			compatible = "nvidia,vpr-carveout";
-			size = <0x0 0x2a000000>;
 			alignment = <0x0 0x400000>;
 			alloc-ranges = <0x0 0x80000000 0x0 0x70000000>;
 			reusable;
@@ -7523,6 +7522,8 @@
 	};
 
 	bpmp {
+		carveout-size = <0x200000>;
+		carveout-start = <0x77800000>;
 		compatible = "nvidia,tegra186-bpmp";
 		#stream-id-cells = <0x1>;
 		reg = <0x0 0xd000000 0x0 0x800000 0x0 0x3004e000 0x0 0x1000 0x0 0x3004f000 0x0 0x1000>;
@@ -13543,9 +13544,75 @@
 	};
 
 	chosen {
+		nvidia,ether-mac = "00:04:4b:8c:ce:f5";
+		nvidia,bluetooth-mac = "00:04:4b:8c:ce:f4";
+		nvidia,wifi-mac = "00:04:4b:8c:ce:f3";
+		linux,initrd-end = <0x9c000000>;
+		linux,initrd-start = <0x9c000000>;
+		bootargs = "root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 OS=l4t fbcon=map:0 net.ifnames=0 memtype=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x03100000 nvdumper_reserved=0x2772e0000 gpt tegraid=18.1.2.0.0 tegra_keep_boot_clocks maxcpus=6 androidboot.serialno=0322117079514 bl_prof_dataptr=0x10000@0x277240000 sdhci_tegra.en_boot_part_access=1 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 modprobe.blacklist=bcmdhd";
 		board-has-eeprom;
-		bootargs = "console=ttyS0,115200";
 		stdout-path = "/serial@3100000";
+
+		reset {
+
+			pmic-reset-reason {
+				reason = "NIL_OR_MORE_THAN_1_BIT";
+				register-value = "0x00";
+			};
+
+			pmc-reset-reason {
+				reset-level = [31 00];
+				reset-source = "MAINSWRST";
+			};
+		};
+
+		plugin-manager {
+
+			chip-id {
+				A02P = <0x1>;
+			};
+
+			configs {
+				3310-display-config = <0x0>;
+				3310-touch-config = <0x0>;
+				3310-modem-config = <0x0>;
+				3310-misc-config = <0x0>;
+				3310-power-config = <0x0>;
+				3310-mem-type = <0x0>;
+			};
+
+			ids {
+				3310-1000-B01-D = <0x1>;
+				3310-1000-B01 = "/i2c@c250000:module@0x50";
+
+				connection {
+
+					i2c@c250000 {
+
+						module@0x50 {
+							3310-1000-B01 = "/i2c@c250000:module@0x50";
+						};
+					};
+				};
+			};
+
+			odm-data {
+				enable-sata-on-uphy-lane5 = <0x1>;
+				enable-pcie-on-uphy-lane4 = <0x1>;
+				enable-pcie-on-uphy-lane2 = <0x1>;
+				enable-pcie-on-uphy-lane1 = <0x1>;
+				enable-xusb-on-uphy-lane0 = <0x1>;
+				normal-flashed = <0x1>;
+				no-battery = <0x1>;
+				disable-sdmmc-hwcq = <0x1>;
+				disable-pmic-wdt = <0x1>;
+				enable-denver-wdt = <0x1>;
+				android-build = <0x1>;
+				enable-debug-console = <0x1>;
+				disable-tegra-wdt = <0x1>;
+				l4t;
+			};
+		};
 	};
 
 	firmware {
@@ -13558,6 +13625,6 @@
 
 	memory@80000000 {
 		device_type = "memory";
-		reg = <0x0 0x80000000 0x0 0x70000000>;
+		reg = <0x0 0x80000000 0x0 0x70000000 0x0 0xf0110000 0x1 0x85e00000>;
 	};
 };

Which one should I use as a reference to apply Auvidea’s modifications to? Would it be #1 or #2?

-albertr

This assumes R28.1 (earlier releases were different). I have no knowledge of the Auvidea board or device tree.

mmcblk0p15 is used during boot as expected.

The dtb in “/boot” is not used (there is no FDT entry in this extlinux.conf…if there were, then a large part of this tree would be ignored or applied too late and not do as expected). In earlier releases this was used via the FDT key/value pair entry in extlinux.conf.

The tree from “/sys” is what the “/proc/device-tree/” symbolic link points to, and is not a real file…this is the kernel’s idea of the current running system. I beleive this is not useful for writing to…think of it as a tool for observation. It is possible there is an effect from writing to this tree (if it is even possible to write to), but it is unlikely to be the effect you expect or desire. If you create a dts file from this you see the sum total of all device tree edits from the start of boot up until Linux begins…it shows the final effect, but not necessarily the timing in cases where the tree is loaded in pieces.

You can create a dts file via:

dtc -I fs -O dts -o extracted.dts /proc/device-tree

I would expect this tree to be an authority on what you currently have. I would expect this tree to change if you change mmcblk0p15. I would expect this tree to fail to change if you change a “/boot” dtb file. If you compare your Auvidea tree to the extracted tree and want to make changes, then I would expect the place to change the tree would be in mmcblk0p15, with a result of “/sys” following that change.

linuxdev, when poking around last night I realized that #2 (one from /dev/mmcblk0p15 partition) is the one used. Looks like #1 is being copied over to /boot by JetPack installer. Also, I found a copy of #2 in /boot/dtb directory as well, probably also copied over by JetPack installer. Thanks for confirmation!

-albertr

The copy over to “/boot” by the JetPack installer is left-over behavior from when the FDT entry of extlinux.conf still worked. It is possible that reverse compiling that dtb would be an exact copy of the one in mmcblk0p15, but I’m not sure. I am sure that installing a new dtb to mmcblk0p15 works and will be reflected upon boot from the “/proc/device-tree/” listing.

Yes, the exact copy of /dev/mmcblk0p15 is /boot/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb.

-albertr