[U-Boot] [PATCH 0/8] dm: core: abolish "u-boot, dm-pre-reloc" property and various refactorings

Masahiro Yamada yamada.m at jp.panasonic.com
Mon Nov 17 09:19:37 CET 2014


I am implemting Device Tree support for Panasonic UniPhier platform,
but while I was working on that, I noticed some problems in DM core
implementation.

What I want to solve the most here is the inconsistency in terms of
how to pass the pre-reloc attribute.

The driver model provides two ways to pass the device information,
platform data and device tree.

In the platform data way, the pre-reloc DM scan checks if each driver
has DM_FLAG_PRE_RELOC flag, that is, each **driver** has the pre-reloc
attribute.

In the device tree control, the existence of "u-boot,dm-pre-reloc" is
checked for each device node.  The driver flag "DM_FLAG_PRE_RELOC" is
never checked.  That is, each **device** owns the pre-reloc attribute.

Drivers should generally work both with platform data and device tree,
but this inconsitency has made our life difficult.

This series aims to abolish "u-boot,dm-pre-reloc" property because:

 - Having a U-Boot specific property makes it difficult to share the
   device tree sources between Linux and U-Boot.

 - The number of devices is generally larger than that of drivers.
   Each driver often has multiple devices with different base
   addresses.  It seems more reasonable to add the pre-reloc attribute
   to drivers than devices.

8/8 commit abolishes "u-boot,dm-pre-reloc" property and replaces it
with some *driver* attribute.
When I am working on that, I came up with another idea.
I thought it is unefficient to scan all the drivers and then check
the DM_FLAG_PRE_RELOC.  Becuase the DM_FLAG_PRE_RELOC is a static
data, we know if each driver is a pre-reloc one or not.  So, 6/8
introduces more efficient driver scanning.

1/8 thru 5/8 are some cleanups before I do new things.


Masahiro Yamada (8):
  dm: core: a trivial clean up
  dm: core: remove meaningless if conditional
  dm: core: remove unnecessary return condition in driver lookup
  dm: core: remove unnecessary return condition in uclass lookup
  dm: core: refactor linker lists lookup code
  dm: core: look up drivers more efficiently
  dm: core: declare pre-reloc drivers with U_BOOT_DRIVER_F
  dm: core: abolish u-boot,dm-pre-reloc property

 arch/arm/dts/exynos5.dtsi        |  1 -
 doc/driver-model/README.txt      |  5 ++--
 drivers/core/device.c            |  4 +--
 drivers/core/lists.c             | 57 ++++++++++++++++++----------------------
 drivers/core/root.c              | 13 ++++-----
 drivers/core/simple-bus.c        |  2 +-
 drivers/serial/sandbox.c         |  3 +--
 drivers/serial/serial_mxc.c      |  3 +--
 drivers/serial/serial_omap.c     |  3 +--
 drivers/serial/serial_pl01x.c    |  3 +--
 drivers/serial/serial_s5p.c      |  3 +--
 drivers/serial/serial_uniphier.c |  3 +--
 include/dm/device.h              | 11 ++++----
 include/dm/lists.h               | 29 +++++++++++++++-----
 include/dm/root.h                | 20 +++++++-------
 test/dm/test-driver.c            |  3 +--
 test/dm/test-fdt.c               |  2 +-
 test/dm/test.dts                 |  2 --
 18 files changed, 80 insertions(+), 87 deletions(-)

-- 
1.9.1



More information about the U-Boot mailing list