Device tree is for describe the peripheral HW. It not noly can describe the detectable devices, but also can be used for non-detectable devices
non-detectable device: Like memory information, flash information, UARTs, GPIOs β¦etc.
/ {
name = "device-tree-example";
model = "device model name";
compatiable = "deive-tree";
#address-cells = <2>;
#size-cells = <2>;
# linux,phandle = <0>;
}
[aliae_name:] node-name[@unit-address] {
[properties definitions]
[child nodes]
};
[]: means option
describe the node property
the property can be no assigned value. e.g properties = [value]
ββββββββββββaddress = <1>;
ββββββββββββaddress2 = [0x00001 0x20000];
ββββββββββββdevice_type = "memory";
ββββββββββββname = "PowerPC,970";
properties attirbute:
Standard Properties
Here are list some special properites.
The #address-cells and #size-cells properties may be used in any device node that has children in the devicetree hierarchy and describes how child device nodes should be addressed.
The #address-cells property defines the number of <u32> cells used to encode the address field in a child nodeβs reg property.
The #size-cells property defines the number of <u32> cells used to encode the size field in a child nodeβs reg property
ββββββββ e.g:
ββββββββ #address-cells = <2>;
ββββββββ #size-celss = <2>;
ββββββββ memory@0 {
ββββββββ device_type = "memory";
ββββββββ reg = <0x000000000 0x00000000 0x00000000 0x80000000>;
ββββββββ };
reg will use <address1, size1, address2, size2, β¦>
A phandle value is a way to reference another node in the devicetree
ββββββββmydevice: mydev {
ββββββββ compatiable = "mydevice_list";
ββββββββ pincontrol = <&my_pin_ctrl>;
ββββββββ}
ββββββββ
ββββββββmaybe in another dtsi
ββββββββ
ββββββββmy_pin_ctrl: my_pin_ctrl {
ββββββββ ....
ββββββββ};
ββββββββlabel:node {
ββββββββ #address-cell = <1>;
ββββββββ #size-cells = <0>;
ββββββββ}
ββββββββ&label {
ββββββββ ...;
ββββββββ};
This means
ββββββββlabel:node {
ββββββββ #address-cell = <1>;
ββββββββ #size-cells = <0>;
ββββββββ ....;
ββββββββ}
[TBD]
$ dtc -@ -I dts -O dtb -o <output>.dtbo <src>.dts
Introduction to Linux kernel
driver programming
Device TreeοΌδΊοΌοΌεΊζ¬ζ¦εΏ΅
Device TreeοΌδΈοΌοΌδ»£η εζ
Device TreeοΌεοΌοΌζδ»Άη»ζθ§£ζ
example in linux kernel