[U-Boot] [PATCH v3 6/6] fdt: add decode helper library

Kumar Gala galak at kernel.crashing.org
Fri Oct 14 20:12:53 CEST 2011


On Oct 11, 2011, at 5:26 PM, Simon Glass wrote:

> This library provides useful functions to drivers which want to use
> the fdt to control their operation. Functions are provided to:
> 
> - look up and enumerate a device type (for example assigning i2c bus 0,
> i2c bus 1, etc.)
> - decode basic types from the fdt, like addresses and integers
> 
> While this library is not strictly necessary, it helps to minimise the
> changes to a driver, in order to make it work under fdt control. Less
> code is required, and so the barrier to switch drivers over is lower.
> 
> Additional functions to read arrays and GPIOs could be made available
> here also.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v2:
> - Add example proposed decode helper library
> 
> Changes in v3:
> - Simplify decode library to remove provide only primitive functions
> - Remove i2c decode function
> - Rename fdt_decode to fdtdec, since it will be used a lot
> - Moved fdt_decode.c to /lib
> - Export almost all functions from fdtdec, to allow widespread use
> - Remove use of FDT_ERR_MISSING which is not strictly needed now
> 
> include/fdtdec.h |  122 ++++++++++++++++++++++++++++++++++++++++++++++++++
> lib/Makefile     |    1 +
> lib/fdtdec.c     |  131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 254 insertions(+), 0 deletions(-)
> create mode 100644 include/fdtdec.h
> create mode 100644 lib/fdtdec.c

I think this is the wrong approach.  If we intend to go down the path of embedded a device tree we should look at produce a live tree structure that can be used like Linux has.

There are a lot of places we are manipulate device tree blobs that would be more efficient if we had a live tree structure in place.

I think that will only get worse with the addition of embedding a tree.

- k



More information about the U-Boot mailing list