Device Tree Source Undocumented

From eLinux.org
Jump to: navigation, search

Top Device Tree page

< &{/path/to/node} >

A phandle reference does not require a label on the target node. An example of referring to a node directly is

interrupt-parent = < &{/soc/pic@10000000} >;

For a more complete explaination of how this is used, see Device_Tree_Mysteries#explain_some_more.

Deleting nodes and properties

Node can be deleted with the /delete-node/ directive.

Properties can be deleted with the /delete-property/ directive.

Examples of syntax in a source file and resulting output from dtc are:

$ cat test_delete_syntax_B.dts

/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
		node-2-pa = "def";
	};


	node-3@3 {
		node-3-pa = "ghi";
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pa = "mno";
	};

	node_5_label: node-5@5 {
		node-5-pa = "pqr";
	};

};

/ {

	node-2@2 {
		/delete-property/ node-2-pa;
	};

	node-3@3 {
		/delete-property/ node-3-pa;
	};

	/delete-node/ node-4@4;

};

/delete-node/ &node_5_label;

/ {

	node-4@4 {
		node-4-pc = "stu";
		node-4-pd = "vwx";
	};

};



$ dtc -O dts test_delete_syntax_A.dts
/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
	};

	node-3@3 {
		node-3-pb = "jkl";
	};
};
$ cat test_delete_syntax_A.dts

/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
		node-2-pa = "def";
	};


	node-3@3 {
		node-3-pa = "ghi";
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pa = "mno";
	};

	node_5_label: node-5@5 {
		node-5-pa = "pqr";
	};

};

/ {

	node-2@2 {
		/delete-property/ node-2-pa;
	};

	node-3@3 {
		/delete-property/ node-3-pa;
	};

	/delete-node/ node-4@4;

};

/delete-node/ &node_5_label;



$ dtc -O dts test_delete_syntax_B.dts
/dts-v1/;

/ {

	node-1@1 {
		node-1-pa = "abc";
	};

	node-2@2 {
	};

	node-3@3 {
		node-3-pb = "jkl";
	};

	node-4@4 {
		node-4-pc = "stu";
		node-4-pd = "vwx";
	};
};

Overlays

Overlay support in the dtc compiler and in the Linux kernel is under development and may change from what appears here.

Things that may be currently visible in out of tree locations are:
Some overlay related syntax is:

  • /plugin/ directive
  • __overlay__ node
  • __symbols__ node
  • __fixups__ node
  • __local_fixups__ node

The node names that begin with an underscore should be considered to be internal implentation of overlay information, and should not be hand coded in a dts source file. They should be automatically generated by the dtc compiler. Some of them do currently appear in dts source files since the dtc compiler has not fully implemented the features needed to avoid the hand coding.

These items require an out of tree dtc compiler the dtc compiler in Linux 4.12 or later, with the "-@" option.

Pantelis Antoniou has created dtc patches to allow "syntax sugar". This syntax allows the device tree source file to contain a reference to a node and dtc automatically creates the __*__ nodes.

If the "syntax sugar" is available, then the need to allow node names in device tree source to begin with an underscore is removed, and hopefully dtc will be further modified to disallow node names beginning with an underscore in device tree source files.