SlideShare a Scribd company logo
Device Tree
Rouyun Pan
緣起
• 某年某⽉月的某⼀一天... 

神⼈人Linus Torvalds寫了⼀一封信
有⼀一堆闌尾在⽴立法院, 可割可棄!!!
So, 割闌尾~
• 科科跟宅宅們參考了PowerPC等其他體系架構下
已經使⽤用的Flattened Device Tree(FDT).起源於
OpenFirmware IEEE 1275 device-tree notion.
• ⽇日後決定採⽤用Device Tree為描述硬體平台的資料
結構.
Device Tree
• 由⼀一系列被命名的結點(Node)和屬性
(Property)來組成. Node可包含Sub-Node.
Property是成對的name和value. 可讀性⾼高.
• 可以在開機的時候, 在透過它將訊息傳遞給作業系
統,⽽而不需要在把這些資訊放在程式碼中.
• 未來也很⽅方便增減修改Device Tree, 容易⽀支援不同
的Soc或硬體週邊.
Z > B!!!
How to work with device tree
complier
Device tree
description
binary data
bootloader kernel
platform
probe
carry
HW configuration
pass
DTS
DTC
DTB
Device tree misc.
• DTS

- device tree source file
• DTC

- device tree compiler, It compiles DTS to DTB.
• DTB

- device tree blob, the binary data to store the
information of DTS.
DTS Format(1)
/{!
! properties = ”value as string” | <value as u32 list> | [ value as byte stream ] |
<&node name>!
! child_node[@address] {!
! ! child_properties!
! }!
}!
!
&node_name {!
! compatible = "<manufacturer>,<model>"!
! properties!
}!
“/“ 表⽰示根節點, 不需要寫節點名稱
屬性Properties可以⽤用混合格式表⽰示,
如“字串”,或<32位元整數列表>,或[位元組流]或

<&其他參考節點名稱>
每個 Node 都會有⼀一個’compatible’ property. 格式為
"<manufacturer>,<model>",第⼀一個字串表⽰示確切名
稱,第⼆二個字串表⽰示可兼容的其他設備。
DTS Format(2)
/{!
! properties = ”value as string” | <value as u32 list> | [ value as byte stream ] |
<&node name>!
! child_node[@address] {!
! ! child_properties!
! }!
}!
!
&node_name {!
! compatible = "<manufacturer>,<model>"!
! properties!
}!
結點的命名,遵循的格式為:
<name>[@address]

name是⼀一個ASCII字串,⽤用於描述結點對應的
裝置類型. 如果⼀一個結點描述的裝置有記憶體地
址,則填⼊入@address。多個相同類型設備結點
的name可以⼀一樣,只要address不同即可
DTS format(3)
/ {
compatible = "acme,coyotes-revenge";
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "arm,cortex-a9";
reg = <0>;
};
cpu@1 {
compatible = "arm,cortex-a9";
reg = <1>;
};
};
serial@1010adbd {
compatible = "arm,pl011";
reg = <0x101abcd 0x1000>;
reg_name = “”
};
節點1
節點2!
⼦子節點1!
⼦子節點2!
根節點
DTS format(4)/ {
compatible = "acme,coyotes-revenge";
#address-cells = <1>; !
#size-cells = <1>;
interrupt-parent = <&intc>;
cpus {
#address-cells = <1>; !
#size-cells = <0>;
cpu@0 {
compatible = "arm,cortex-a9";
reg = <0>;
};
cpu@1 {
compatible = "arm,cortex-a9";
reg = <1>;
};
};
serial@1010adbd {
compatible = "arm,pl011";
reg = <0x101abcd 0x1000>;!
! reg_name = “”!
};
有位址的裝置會使⽤用
#address-cells 和 #size-cells 來決定⼦子結點
的’reg’屬性的格式怎麼填
reg = <address1 length1 [address2 length2] ... >
#size-cells = <0>; 表⽰示只填⼊入Reg的starting address
#address-cells = <1>; !
#size-cells = <1>; !
填⼊入格式為 Reg = <Starting_address Size>
.dts & dtsi
• .dts 是採⽤用ASCII 格式的Device Tree描述檔⽂文件.
⼀一般放置位在 kernel/arch/arm/boot/dts/。
• ⼀一個SoC可能拿來開發多個產品線,為了⽅方便,
把SoC公⽤用的硬體設定或不同產品的共同部分提
煉為.dtsi,類似C語⾔言的.h。其他不同產品的.dts
可以引⽤用這些共通的.dtsi。
Modularization
msm1234-abc.dts
msm1234-abc.dtsi
panel-abc.dtsi msm1234.dtsi
msm1234-gpu.dtsi
msm1234-
iommu.dtsi
msm1234-
mdss.dtsi
for example - Driver probe
@mdss_mdp.cpp
static const struct of_device_id mdss_mdp_dt_match[] =
.compatible = "qcom,mdss_mdp"
MODULE_DEVICE_TABLE (of, mdss_mdp_dt_match);
!
static struct platform_driver mdss_mdp_driver = {
.probe = mdss_mdp_probe,
.driver = {
.name = "mdp",
.of_match_table = mdss_mdp_dt_match,
}
}
!
static int __init mdss_mdp_driver_init (void) {
platform_driver_register( &mdss_mdp_driver );
}
@msm1234-mdss.dtsi
&soc {
!
mdss_mdp: qcom,mdss_mdp@12340000 {
compatible = "qcom,mdss_mdp";
reg = <0x12340000 0xff00>
reg-names = "mdp_phys", "vbif_phys";
…
!
mdss_dsi0: qcom,mdss_dsi@12345000 {
compatible = "qcom,mdss-dsi-ctrl";
qcom,mdss-mdp = <&mdss_mdp>;
…
!
qcom,mdss_wb_panel {
compatible = "qcom,mdss_wb";
…
…
Parsing APIs of Device Tree
property * of_find_property();
device_node * of_find_node_by_name();
of_find_node_by_type();

of_find_compatible_node();

of_find_matching_node_and_match();

of_find_node_by_path(); 

of_find_node_by_phandle();
void * of_get_property();
int of_property_read_u32_index() 

of_property_read_u8_array();

of_property_read_u16_array(); 

of_property_read_u32_array();

of_property_read_string();

of_property_read_string_index();
int of_parse_phandle_with_args(),
of_parse_phandle_with_fixed_args(),
of_count_phandle_with_args()
Reference
• http://www.devicetree.org/Main_Page
• http://www.devicetree.org/Device_Tree_Usage
• Device Tree Support on ARM Linux

Chih-Min Chao) http://gplus.to/cmchao COSCUP
2011 in Taiwan
• http://blog.csdn.net/21cnbao/article/details/
8457546

More Related Content

What's hot

Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
RuggedBoardGroup
 
I2c drivers
I2c driversI2c drivers
I2c drivers
pradeep_tewani
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
I2c drivers
I2c driversI2c drivers
I2c drivers
Pradeep Tewani
 
Linux kernel
Linux kernelLinux kernel
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
iamumr
 
Bootloaders
BootloadersBootloaders
Bootloaders
Anil Kumar Pugalia
 
Spi drivers
Spi driversSpi drivers
Spi drivers
pradeep_tewani
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
linuxlab_conf
 
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux KernelHardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
Kernel TLV
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
Saurabh Bangad
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
艾鍗科技
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
Adrian Huang
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
Omkar Rane
 

What's hot (20)

Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
I2c drivers
I2c driversI2c drivers
I2c drivers
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
I2c drivers
I2c driversI2c drivers
I2c drivers
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
 
Bootloaders
BootloadersBootloaders
Bootloaders
 
Spi drivers
Spi driversSpi drivers
Spi drivers
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Hardware Probing in the Linux Kernel
Hardware Probing in the Linux KernelHardware Probing in the Linux Kernel
Hardware Probing in the Linux Kernel
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 

Similar to Device tree

Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPIKernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Anne Nicolas
 
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device ConfigurationLAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
Linaro
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
Stefano Stabellini
 
Nick Stephens-how does someone unlock your phone with nose
Nick Stephens-how does someone unlock your phone with noseNick Stephens-how does someone unlock your phone with nose
Nick Stephens-how does someone unlock your phone with nose
GeekPwn Keen
 
HPCC Systems vs Hadoop
HPCC Systems vs HadoopHPCC Systems vs Hadoop
HPCC Systems vs Hadoop
Fujio Turner
 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User Group
Adam Hutson
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
Nugroho Gito
 
Cassandra for Sysadmins
Cassandra for SysadminsCassandra for Sysadmins
Cassandra for Sysadmins
Nathan Milford
 
Script of Scripts Polyglot Notebook and Workflow System
Script of ScriptsPolyglot Notebook and Workflow SystemScript of ScriptsPolyglot Notebook and Workflow System
Script of Scripts Polyglot Notebook and Workflow System
Bo Peng
 
High Availability in 37 Easy Steps
High Availability in 37 Easy StepsHigh Availability in 37 Easy Steps
High Availability in 37 Easy Steps
Tim Serong
 
Oracle Database Appliance - RAC in a box Some strings attached
Oracle Database Appliance - RAC in a box Some strings attached Oracle Database Appliance - RAC in a box Some strings attached
Oracle Database Appliance - RAC in a box Some strings attached Fuad Arshad
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
Prajal Kulkarni
 
1 network intro
1 network intro1 network intro
1 network intro
Samit Singh
 
System Device Tree update: Bus Firewalls and Lopper
System Device Tree update: Bus Firewalls and LopperSystem Device Tree update: Bus Firewalls and Lopper
System Device Tree update: Bus Firewalls and Lopper
Stefano Stabellini
 
Linux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, futureLinux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, future
Neil Armstrong
 
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
Kim Berg Hansen
 
Linux Networking Commands
Linux Networking CommandsLinux Networking Commands
Linux Networking Commands
tmavroidis
 
2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat
Shawn Wells
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
Vandana Salve
 

Similar to Device tree (20)

Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPIKernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
 
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device ConfigurationLAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Nick Stephens-how does someone unlock your phone with nose
Nick Stephens-how does someone unlock your phone with noseNick Stephens-how does someone unlock your phone with nose
Nick Stephens-how does someone unlock your phone with nose
 
HPCC Systems vs Hadoop
HPCC Systems vs HadoopHPCC Systems vs Hadoop
HPCC Systems vs Hadoop
 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User Group
 
Ui disk & terminal drivers
Ui disk & terminal driversUi disk & terminal drivers
Ui disk & terminal drivers
 
RHCSA EX200 - Summary
RHCSA EX200 - SummaryRHCSA EX200 - Summary
RHCSA EX200 - Summary
 
Cassandra for Sysadmins
Cassandra for SysadminsCassandra for Sysadmins
Cassandra for Sysadmins
 
Script of Scripts Polyglot Notebook and Workflow System
Script of ScriptsPolyglot Notebook and Workflow SystemScript of ScriptsPolyglot Notebook and Workflow System
Script of Scripts Polyglot Notebook and Workflow System
 
High Availability in 37 Easy Steps
High Availability in 37 Easy StepsHigh Availability in 37 Easy Steps
High Availability in 37 Easy Steps
 
Oracle Database Appliance - RAC in a box Some strings attached
Oracle Database Appliance - RAC in a box Some strings attached Oracle Database Appliance - RAC in a box Some strings attached
Oracle Database Appliance - RAC in a box Some strings attached
 
Attack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and KibanaAttack monitoring using ElasticSearch Logstash and Kibana
Attack monitoring using ElasticSearch Logstash and Kibana
 
1 network intro
1 network intro1 network intro
1 network intro
 
System Device Tree update: Bus Firewalls and Lopper
System Device Tree update: Bus Firewalls and LopperSystem Device Tree update: Bus Firewalls and Lopper
System Device Tree update: Bus Firewalls and Lopper
 
Linux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, futureLinux Conference Australia 2018 : Device Tree, past, present, future
Linux Conference Australia 2018 : Device Tree, past, present, future
 
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
 
Linux Networking Commands
Linux Networking CommandsLinux Networking Commands
Linux Networking Commands
 
2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat2012-03-15 What's New at Red Hat
2012-03-15 What's New at Red Hat
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
 

More from Rouyun Pan

調色筆記
調色筆記調色筆記
調色筆記
Rouyun Pan
 
有點硬又不會太硬的DNN加速器
有點硬又不會太硬的DNN加速器有點硬又不會太硬的DNN加速器
有點硬又不會太硬的DNN加速器
Rouyun Pan
 
深度學習工作流程
深度學習工作流程深度學習工作流程
深度學習工作流程
Rouyun Pan
 
Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontroller
Rouyun Pan
 
Google edge tpu
Google edge tpuGoogle edge tpu
Google edge tpu
Rouyun Pan
 
用Adobe Camera raw 進行膚色校正
用Adobe Camera raw 進行膚色校正用Adobe Camera raw 進行膚色校正
用Adobe Camera raw 進行膚色校正
Rouyun Pan
 
給攝影師的古典藝術構圖
給攝影師的古典藝術構圖給攝影師的古典藝術構圖
給攝影師的古典藝術構圖
Rouyun Pan
 
照片直方圖解析
照片直方圖解析照片直方圖解析
照片直方圖解析
Rouyun Pan
 
Deep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & FutureDeep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & Future
Rouyun Pan
 
Deep learning
Deep learningDeep learning
Deep learning
Rouyun Pan
 
VR解密
VR解密VR解密
VR解密
Rouyun Pan
 
「轉貼」移動互聯網行業盤點
「轉貼」移動互聯網行業盤點「轉貼」移動互聯網行業盤點
「轉貼」移動互聯網行業盤點
Rouyun Pan
 
The overview of VR solutions
The overview of VR solutionsThe overview of VR solutions
The overview of VR solutions
Rouyun Pan
 
Render thead of hwui
Render thead of hwuiRender thead of hwui
Render thead of hwui
Rouyun Pan
 
Project Tango
Project TangoProject Tango
Project Tango
Rouyun Pan
 
[轉貼] 社群大數據 - 輿情觀測及分析應用
[轉貼] 社群大數據 - 輿情觀測及分析應用[轉貼] 社群大數據 - 輿情觀測及分析應用
[轉貼] 社群大數據 - 輿情觀測及分析應用
Rouyun Pan
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overview
Rouyun Pan
 
Android 待機與操作耗電檢查
Android 待機與操作耗電檢查Android 待機與操作耗電檢查
Android 待機與操作耗電檢查Rouyun Pan
 
Analyzing Display and Performance with Systrace
Analyzing Display and Performance with SystraceAnalyzing Display and Performance with Systrace
Analyzing Display and Performance with SystraceRouyun Pan
 

More from Rouyun Pan (20)

調色筆記
調色筆記調色筆記
調色筆記
 
有點硬又不會太硬的DNN加速器
有點硬又不會太硬的DNN加速器有點硬又不會太硬的DNN加速器
有點硬又不會太硬的DNN加速器
 
深度學習工作流程
深度學習工作流程深度學習工作流程
深度學習工作流程
 
Tensorflow lite for microcontroller
Tensorflow lite for microcontrollerTensorflow lite for microcontroller
Tensorflow lite for microcontroller
 
Google edge tpu
Google edge tpuGoogle edge tpu
Google edge tpu
 
用Adobe Camera raw 進行膚色校正
用Adobe Camera raw 進行膚色校正用Adobe Camera raw 進行膚色校正
用Adobe Camera raw 進行膚色校正
 
給攝影師的古典藝術構圖
給攝影師的古典藝術構圖給攝影師的古典藝術構圖
給攝影師的古典藝術構圖
 
照片直方圖解析
照片直方圖解析照片直方圖解析
照片直方圖解析
 
Deep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & FutureDeep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & Future
 
Deep learning
Deep learningDeep learning
Deep learning
 
VR解密
VR解密VR解密
VR解密
 
「轉貼」移動互聯網行業盤點
「轉貼」移動互聯網行業盤點「轉貼」移動互聯網行業盤點
「轉貼」移動互聯網行業盤點
 
The overview of VR solutions
The overview of VR solutionsThe overview of VR solutions
The overview of VR solutions
 
Render thead of hwui
Render thead of hwuiRender thead of hwui
Render thead of hwui
 
Project Tango
Project TangoProject Tango
Project Tango
 
[轉貼] 社群大數據 - 輿情觀測及分析應用
[轉貼] 社群大數據 - 輿情觀測及分析應用[轉貼] 社群大數據 - 輿情觀測及分析應用
[轉貼] 社群大數據 - 輿情觀測及分析應用
 
財報分析1
財報分析1財報分析1
財報分析1
 
WebRTC overview
WebRTC overviewWebRTC overview
WebRTC overview
 
Android 待機與操作耗電檢查
Android 待機與操作耗電檢查Android 待機與操作耗電檢查
Android 待機與操作耗電檢查
 
Analyzing Display and Performance with Systrace
Analyzing Display and Performance with SystraceAnalyzing Display and Performance with Systrace
Analyzing Display and Performance with Systrace
 

Recently uploaded

Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 

Recently uploaded (20)

Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 

Device tree

  • 2. 緣起 • 某年某⽉月的某⼀一天... 
 神⼈人Linus Torvalds寫了⼀一封信 有⼀一堆闌尾在⽴立法院, 可割可棄!!!
  • 3. So, 割闌尾~ • 科科跟宅宅們參考了PowerPC等其他體系架構下 已經使⽤用的Flattened Device Tree(FDT).起源於 OpenFirmware IEEE 1275 device-tree notion. • ⽇日後決定採⽤用Device Tree為描述硬體平台的資料 結構.
  • 4. Device Tree • 由⼀一系列被命名的結點(Node)和屬性 (Property)來組成. Node可包含Sub-Node. Property是成對的name和value. 可讀性⾼高. • 可以在開機的時候, 在透過它將訊息傳遞給作業系 統,⽽而不需要在把這些資訊放在程式碼中. • 未來也很⽅方便增減修改Device Tree, 容易⽀支援不同 的Soc或硬體週邊. Z > B!!!
  • 5. How to work with device tree complier Device tree description binary data bootloader kernel platform probe carry HW configuration pass DTS DTC DTB
  • 6. Device tree misc. • DTS
 - device tree source file • DTC
 - device tree compiler, It compiles DTS to DTB. • DTB
 - device tree blob, the binary data to store the information of DTS.
  • 7. DTS Format(1) /{! ! properties = ”value as string” | <value as u32 list> | [ value as byte stream ] | <&node name>! ! child_node[@address] {! ! ! child_properties! ! }! }! ! &node_name {! ! compatible = "<manufacturer>,<model>"! ! properties! }! “/“ 表⽰示根節點, 不需要寫節點名稱 屬性Properties可以⽤用混合格式表⽰示, 如“字串”,或<32位元整數列表>,或[位元組流]或
 <&其他參考節點名稱> 每個 Node 都會有⼀一個’compatible’ property. 格式為 "<manufacturer>,<model>",第⼀一個字串表⽰示確切名 稱,第⼆二個字串表⽰示可兼容的其他設備。
  • 8. DTS Format(2) /{! ! properties = ”value as string” | <value as u32 list> | [ value as byte stream ] | <&node name>! ! child_node[@address] {! ! ! child_properties! ! }! }! ! &node_name {! ! compatible = "<manufacturer>,<model>"! ! properties! }! 結點的命名,遵循的格式為: <name>[@address]
 name是⼀一個ASCII字串,⽤用於描述結點對應的 裝置類型. 如果⼀一個結點描述的裝置有記憶體地 址,則填⼊入@address。多個相同類型設備結點 的name可以⼀一樣,只要address不同即可
  • 9. DTS format(3) / { compatible = "acme,coyotes-revenge"; #address-cells = <1>; #size-cells = <1>; interrupt-parent = <&intc>; cpus { #address-cells = <1>; #size-cells = <0>; cpu@0 { compatible = "arm,cortex-a9"; reg = <0>; }; cpu@1 { compatible = "arm,cortex-a9"; reg = <1>; }; }; serial@1010adbd { compatible = "arm,pl011"; reg = <0x101abcd 0x1000>; reg_name = “” }; 節點1 節點2! ⼦子節點1! ⼦子節點2! 根節點
  • 10. DTS format(4)/ { compatible = "acme,coyotes-revenge"; #address-cells = <1>; ! #size-cells = <1>; interrupt-parent = <&intc>; cpus { #address-cells = <1>; ! #size-cells = <0>; cpu@0 { compatible = "arm,cortex-a9"; reg = <0>; }; cpu@1 { compatible = "arm,cortex-a9"; reg = <1>; }; }; serial@1010adbd { compatible = "arm,pl011"; reg = <0x101abcd 0x1000>;! ! reg_name = “”! }; 有位址的裝置會使⽤用 #address-cells 和 #size-cells 來決定⼦子結點 的’reg’屬性的格式怎麼填 reg = <address1 length1 [address2 length2] ... > #size-cells = <0>; 表⽰示只填⼊入Reg的starting address #address-cells = <1>; ! #size-cells = <1>; ! 填⼊入格式為 Reg = <Starting_address Size>
  • 11. .dts & dtsi • .dts 是採⽤用ASCII 格式的Device Tree描述檔⽂文件. ⼀一般放置位在 kernel/arch/arm/boot/dts/。 • ⼀一個SoC可能拿來開發多個產品線,為了⽅方便, 把SoC公⽤用的硬體設定或不同產品的共同部分提 煉為.dtsi,類似C語⾔言的.h。其他不同產品的.dts 可以引⽤用這些共通的.dtsi。
  • 13. for example - Driver probe @mdss_mdp.cpp static const struct of_device_id mdss_mdp_dt_match[] = .compatible = "qcom,mdss_mdp" MODULE_DEVICE_TABLE (of, mdss_mdp_dt_match); ! static struct platform_driver mdss_mdp_driver = { .probe = mdss_mdp_probe, .driver = { .name = "mdp", .of_match_table = mdss_mdp_dt_match, } } ! static int __init mdss_mdp_driver_init (void) { platform_driver_register( &mdss_mdp_driver ); } @msm1234-mdss.dtsi &soc { ! mdss_mdp: qcom,mdss_mdp@12340000 { compatible = "qcom,mdss_mdp"; reg = <0x12340000 0xff00> reg-names = "mdp_phys", "vbif_phys"; … ! mdss_dsi0: qcom,mdss_dsi@12345000 { compatible = "qcom,mdss-dsi-ctrl"; qcom,mdss-mdp = <&mdss_mdp>; … ! qcom,mdss_wb_panel { compatible = "qcom,mdss_wb"; … …
  • 14. Parsing APIs of Device Tree property * of_find_property(); device_node * of_find_node_by_name(); of_find_node_by_type();
 of_find_compatible_node();
 of_find_matching_node_and_match();
 of_find_node_by_path(); 
 of_find_node_by_phandle(); void * of_get_property(); int of_property_read_u32_index() 
 of_property_read_u8_array();
 of_property_read_u16_array(); 
 of_property_read_u32_array();
 of_property_read_string();
 of_property_read_string_index(); int of_parse_phandle_with_args(), of_parse_phandle_with_fixed_args(), of_count_phandle_with_args()
  • 15. Reference • http://www.devicetree.org/Main_Page • http://www.devicetree.org/Device_Tree_Usage • Device Tree Support on ARM Linux
 Chih-Min Chao) http://gplus.to/cmchao COSCUP 2011 in Taiwan • http://blog.csdn.net/21cnbao/article/details/ 8457546