Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Device Tree Support on ARM Linux 趙至敏  (Chih-Min Chao) [email_address] http://gplus.to/cmchao COSCUP 2011 in Taiwan
Who am I <ul><li>Experience </li></ul><ul><ul><li>2010/04~2011/07 IGS (International Games System </li></ul></ul><ul><ul><...
Device Tree (DT) <ul><li>Data structure for describing hardware configuration  </li></ul><ul><ul><li>Standard interface be...
DT Can’t DO <ul><li>Doesn't replace board-specific code </li></ul><ul><ul><li>Good for common-case </li></ul></ul><ul><ul>...
PPC’s Problems <ul><li>bd_info is used to pass hardware configuration </li></ul><ul><ul><li>Lots of defines </li></ul></ul...
Progress on ARM Linux <ul><li>Grant Likely & Jeremy Kerr are two of leading developers and start about 2008 </li></ul><ul>...
Device Tree Work Flow Description Script Compiler Binary  Data Bootloader Platform Kernel Hardware configuration Carry Pas...
DTS (Device Tree Script) / {          model = &quot;ARM Versatile AB&quot;;          compatible = &quot;arm,versatile-ab&q...
DTS (Device Tree Script) / {          model = &quot;ARM Versatile AB&quot;;          compatible = &quot;arm,versatile-ab&q...
DTS (Device Tree Script) / {          model = &quot;ARM Versatile AB&quot;;          compatible  = &quot; arm , versatile-...
DTS (Device Tree Script) / {          model = &quot;ARM Versatile AB&quot;;          compatible = &quot;arm,versatile-ab&q...
DTS (Device Tree Script) /{                          i2c0: i2c@10002000 {                  #address-cells = <1>;          ...
DTS (Device Tree Script) <ul><li>Interrupt (cascade controller) </li></ul><ul><li>Clock </li></ul><ul><li>GPIO </li></ul><...
DTS - Driver Probing  #ifdef CONFIG_OF static const struct of_device_id smc91x_match[] = {          { .compatible = &quot;...
Device Tree Misc  <ul><li>Device Tree Compiler (DTC) </li></ul><ul><ul><li>compile DTS to DTB </li></ul></ul><ul><li>Devic...
Bootloader & Linux Support <ul><li>U-boot </li></ul><ul><ul><li>bootm kernel_addr initrd_addr dtb_addr </li></ul></ul><ul>...
Live Demo <ul><li>Beagle board on QEMU </li></ul><ul><li>Linux kernel 3.0 with patch </li></ul><ul><li>u-boot-linaro-stabl...
Reference <ul><li>http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf (full spec) </li></ul><ul><li>Lin...
Upcoming SlideShare
Loading in …5
×

Device tree support on arm linux

20,814 views

Published on

An introduction to devicetree in COSCOP 2011 in Taiwan

Published in: Technology

Device tree support on arm linux

  1. 1. Device Tree Support on ARM Linux 趙至敏 (Chih-Min Chao) [email_address] http://gplus.to/cmchao COSCUP 2011 in Taiwan
  2. 2. Who am I <ul><li>Experience </li></ul><ul><ul><li>2010/04~2011/07 IGS (International Games System </li></ul></ul><ul><ul><li>2007/03~2010/04 Andestech </li></ul></ul><ul><ul><li>1999~2005 NCTU EE </li></ul></ul><ul><li>Open source project </li></ul><ul><ul><li>pcmanx-gtk </li></ul></ul><ul><ul><li>QEMU </li></ul></ul><ul><ul><li>Buildroot </li></ul></ul><ul><ul><li>Crosstool-ng </li></ul></ul>
  3. 3. Device Tree (DT) <ul><li>Data structure for describing hardware configuration </li></ul><ul><ul><li>Standard interface between bootloader and OS </li></ul></ul><ul><ul><li>Avoid hardcoding platform details </li></ul></ul><ul><li>OpenFirmware’s specification </li></ul><ul><li>An Framework to easily support multiple SoC devices with a single kernel image </li></ul>
  4. 4. DT Can’t DO <ul><li>Doesn't replace board-specific code </li></ul><ul><ul><li>Good for common-case </li></ul></ul><ul><ul><li>Special cases are still specially handling </li></ul></ul><ul><li>Doesn't add features to your platform </li></ul><ul><li>Doesn't boot your platform fast </li></ul>
  5. 5. PPC’s Problems <ul><li>bd_info is used to pass hardware configuration </li></ul><ul><ul><li>Lots of defines </li></ul></ul><ul><ul><li>bd_info layout is not defined </li></ul></ul><ul><ul><li>no board information </li></ul></ul><ul><li>ppc and ppc64 merging provide an opportunity to unify hardware configuration description </li></ul><ul><li>http://www.kernel.org/doc/ols/2008/ols2008v2-pages-27-38.pdf </li></ul>
  6. 6. Progress on ARM Linux <ul><li>Grant Likely & Jeremy Kerr are two of leading developers and start about 2008 </li></ul><ul><li>To unify and generalize DT framework is the main work during 2008~2010 </li></ul><ul><li>Russell King (maintainer of ARM Linux) is against adding support for FDT to the ARM platform (2009/5) </li></ul><ul><ul><li>http://lkml.indiana.edu/hypermail/linux/kernel/0905.3/01942.html </li></ul></ul><ul><li>Linus is annoyed by the mess of ARM platform code (2011/5) </li></ul><ul><li>&quot;Gaah. Guys, this whole ARM thing is a f*cking pain in the ass.&quot; </li></ul><ul><ul><li>http://lwn.net/Articles/437170/ </li></ul></ul><ul><li>Basic support have been added to Linux 3.0 </li></ul><ul><li>Canonical, Linaro, Ozlabs, and Secretlab undertake the present development </li></ul>
  7. 7. Device Tree Work Flow Description Script Compiler Binary Data Bootloader Platform Kernel Hardware configuration Carry Pass Look up probe DTS DTC DTB
  8. 8. DTS (Device Tree Script) / {         model = &quot;ARM Versatile AB&quot;;         compatible = &quot;arm,versatile-ab&quot;;         #address-cells = <1>;         #size-cells = <1>;         interrupt-parent = <&vic>;              memory {                 reg = <0x0 0x08000000>;         };                        net@10010000 {                 compatible = &quot;smsc,lan91c111&quot;;                 reg = <0x10010000 0x10000>;                 interrupts = <25>;         }; };
  9. 9. DTS (Device Tree Script) / {         model = &quot;ARM Versatile AB&quot;;         compatible = &quot;arm,versatile-ab&quot;;         #address-cells = <1>;         #size-cells = <1>;         interrupt-parent = <&vic>;              memory {                 reg = <0x0 0x08000000>;         };                        net@10010000 {                 compatible = &quot;smsc,lan91c111&quot;;                 reg = <0x10010000 0x10000>;                 interrupts = <25>;         }; }; Initial Structure (root node’s property) Node 1 Node 2 Root Node
  10. 10. DTS (Device Tree Script) / {         model = &quot;ARM Versatile AB&quot;;         compatible = &quot; arm , versatile-ab &quot;;         #address-cells = <1>;         #size-cells = <1>;         interrupt-parent = <&vic>;              memory {                 reg = <0x0 0x08000000>;         };                        net@10010000 {                 compatible = &quot; smsc , lan91c111 &quot;;                 reg = <0x10010000 0x10000>;                 interrupts = <25>;         }; }; Device loop-up “ <manufacturer>,<model>”
  11. 11. DTS (Device Tree Script) / {         model = &quot;ARM Versatile AB&quot;;         compatible = &quot;arm,versatile-ab&quot;;         #address-cells = <1>;         #size-cells = <1>;         interrupt-parent = <&vic>;              memory {                 reg = < 0x0 0x08000000 >;         };                        net@ 10010000 {                 compatible = &quot;smsc,lan91c111&quot;;                 reg = < 0x10010000 0x10000 >;                 interrupts = <25>;         }; }; Unit : 32bit <addr_u0 addr_u1 ..size_u0..>
  12. 12. DTS (Device Tree Script) /{                         i2c0: i2c@10002000 {                 #address-cells = <1>;                 #size-cells = <0>;                 compatible = &quot;arm,versatile-i2c&quot;;                 reg = <0x10002000 0x1000>;                 rtc@68 {                         compatible = &quot;dallas,ds1338&quot;;                         reg = <0x68>;                 };         }; }; child node
  13. 13. DTS (Device Tree Script) <ul><li>Interrupt (cascade controller) </li></ul><ul><li>Clock </li></ul><ul><li>GPIO </li></ul><ul><li>PCI </li></ul><ul><li>http://devicetree.org/Device_Tree_Usage </li></ul>
  14. 14. DTS - Driver Probing #ifdef CONFIG_OF static const struct of_device_id smc91x_match[] = {         { .compatible = &quot;smsc,lan91c94&quot;, },         {  .compatible = &quot;smsc,lan91c111&quot; , },         {},}; MODULE_DEVICE_TABLE(of, smc91x_match); #else #define smc91x_match NULL #endif static struct platform_driver smc_driver = {         .driver         = {                 .name   = CARDNAME,                 .owner  = THIS_MODULE,                 .pm     = &smc_drv_pm_ops,                  .of_match_table = smc91x_match, }, }; net@10010000 {                  compatible = &quot; smsc,lan91c111 &quot;;                 reg = <0x10010000 0x10000>;                 interrupts = <25>;         };
  15. 15. Device Tree Misc <ul><li>Device Tree Compiler (DTC) </li></ul><ul><ul><li>compile DTS to DTB </li></ul></ul><ul><li>Device Tree Blob (DTB) </li></ul><ul><ul><li>binary data to store device tree information </li></ul></ul><ul><li>http://ozlabs.org/people/dgibson/papers/dtc-paper.pdf </li></ul><ul><li>http://www.t2-project.org/packages/dtc.html </li></ul>
  16. 16. Bootloader & Linux Support <ul><li>U-boot </li></ul><ul><ul><li>bootm kernel_addr initrd_addr dtb_addr </li></ul></ul><ul><ul><ul><li>ex: bootm 0x44000000 - 0x45000000 </li></ul></ul></ul><ul><li>Linux </li></ul><ul><ul><li>kernel entry change </li></ul></ul><ul><ul><ul><li>Old : kernel_entry(0, mach_id, atag_addr ) </li></ul></ul></ul><ul><ul><ul><li>New : kernel_entry(0, mach_id, dtb_addr ) </li></ul></ul></ul><ul><ul><li>config </li></ul></ul><ul><ul><ul><li>Boot options->Flattened Device Tree support </li></ul></ul></ul><ul><ul><ul><li>Device Drivers->Device Tree and Open Firmware support->Support for device tree in /proc </li></ul></ul></ul><ul><ul><li>device tree script </li></ul></ul><ul><ul><ul><li>arch/arm/boot/dts </li></ul></ul></ul><ul><ul><li>/proc/device-tree </li></ul></ul>
  17. 17. Live Demo <ul><li>Beagle board on QEMU </li></ul><ul><li>Linux kernel 3.0 with patch </li></ul><ul><li>u-boot-linaro-stable </li></ul><ul><li>Linaro-image-tools and root files system </li></ul>
  18. 18. Reference <ul><li>http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf (full spec) </li></ul><ul><li>Linux/Document/devicetree </li></ul><ul><li>http://lwn.net/Articles/414016/ </li></ul><ul><li>http://lwn.net/Articles/448502/ </li></ul><ul><li>Maillist : devicetree-discuss@lists.ozlabs.org </li></ul>

×