ELC2009 – Developer Diary: The Device Tree

Speaker

  Wolfram Sang

Links

  http://www.celinuxforum.org/CelfPubWiki/ELCEurope2009Presentations
  http://www.pengutronix.de/index_en.html

Introduction

Wolfram’s talk was presented on Friday 16th October 2009 to a small crowd of about 40 attendees. He warned that the talk would not be for attendees unfamiliar with device trees and instead he would focus on his real world attempts.

Main points

  • There is a lack of documentation on how to convert a driver to the device tree way.
  • There is little awareness to exactly what a device tree based driver should look like.
  • Device tree’s are very specific but some drivers are very generic which poses a problem.

Background

Despite his warnings, Wolfram did give a little back ground on device trees stating that they were:

  • A hardware description in tree form.
  • OS and hardware independent (or should be).
  • A tree like structure of key-value pairs in each of its nodes.
  • Easily defined and parsed.
  • Compatible (but aren’t because of wrong implementations).

Example 1: I2C

I2C is the generic eprom driver in the Linux kernel. Wolfram discussed how he failed to define the properties of the driver effectively in the device tree format. Two attempts have been made to submit code to the Linux kernel, both have been rejected.

At the same time Wolfram noticed that some drivers where accepted without proper approval. He highlighted one example where a device-tree based driver got through Andrew Morton’s tree to the mainline even though some of the device node properties were clearly wrong. He cited a lack of understanding leading to a lack of discussion about the patch.

Example 2: UIO

UIO allows drivers to be written in userspace as it exposes interrupts and maps certain registers. Again Wolfram discussed two failed attempts to push a device tree based driver to mainline, both failed. Again a lack of documentation on how to convert a driver to device-tree format was cited as a contributing factor along with the inability to describe some things effectively.

Example 3: GPIO

As you probably would guess, Wolfram cited lack of clear documentation as a factor why his GPIO attempt was rejected. He went on to explain that device tree’s are very specific but some drivers are very generic which causes problems.