[PATCH] devicetree probe support

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 12 16:06:32 EDT 2012


Hi All,

The following patch series adds support for probing barebox from
devicetree.

Most of the of helper code is taken directly from the Linux Kernel,
only little glue code is needed to populate the barebox devicetree
from a dtb.

Currently the dtb can be probed with 'oftree -p <dtb>'. After calling
this command the devices found in the dtb are probed. Devices which
were present before are not probed again, instead the corresponding
device nodes are attached to the barebox devices.

Further directions could be that barebox takes the dtb directly from
a first stage loader, so a second stage barebox could be started just
like a Linux Kernel. I have some experimental code for that. Another
possibility would be to compile a dtb into barebox, but this is not
done yet.

This series contains support for the basic probing, GPIO, SPI and
several i.MX devices. The devicetree probe support nearly compiles
away if disabled and takes about 6k in an uncompressed image when
enabled.

Here is an example session:

barebox at Phytec phyCORE-i.MX27:/ oftree -p mnt/tftp/sha-oftree-pcm038
barebox at Phytec phyCORE-i.MX27:/ devinfo 1000c000.serial
resources:
num   : 0
start : 0x1000c000
size  : 0x00001000
driver: imx_serial

no info available for 1000c000.serial
no parameters available

device node: /soc/aipi at 10000000/serial at 1000c000
serial at 1000c000 {
        compatible: "fsl,imx27-uart", "fsl,imx21-uart"
        reg: <0x1000c000 0x1000>
        interrupts: <0x12>
        status: "okay"
        fsl,uart-has-rtscts:
};

Sascha


The following changes since commit c9556d4a54db100a1786506ce199c86d3b231a3b:

  drivers/net/ksz8864rmn: add driver for Micrel KSZ8864RMN Ethernet Switch (2012-09-11 16:10:23 +0200)

are available in the git repository at:

  git://git.pengutronix.de/git/barebox.git work/dt

for you to fetch changes up to c931520ecb121b299bf362b4c2481fc5f7e232cc:

  ARM i.MX: Add devicetree support for clocksource driver (2012-09-12 21:32:29 +0200)

----------------------------------------------------------------
Sascha Hauer (15):
      driver: add dev_get_drvdata function
      of: add devicetree probing support
      oftree command: Add devicetree probe support
      of: Add devicetree partition parsing
      spi: add oftree support
      ARM i.MX: Use platform_device_id for gpio driver
      ARM i.MX: implement clocksource as driver
      serial i.MX: oftree support
      net fec_imx: oftree support
      spi imx: dt support
      mfd mc13xxx: Add devicetree support
      cfi-flash: Add devicetree probe support
      mci i.MX esdhc: Add oftree support
      ARM i.MX: add devicetree support for gpio driver
      ARM i.MX: Add devicetree support for clocksource driver

 arch/arm/mach-imx/clocksource.c             |   85 ++-
 arch/arm/mach-imx/gpio.c                    |  111 +++-
 arch/arm/mach-imx/imx1.c                    |    9 +-
 arch/arm/mach-imx/imx21.c                   |   13 +-
 arch/arm/mach-imx/imx25.c                   |   10 +-
 arch/arm/mach-imx/imx27.c                   |   15 +-
 arch/arm/mach-imx/imx31.c                   |    7 +-
 arch/arm/mach-imx/imx35.c                   |    7 +-
 arch/arm/mach-imx/imx51.c                   |    9 +-
 arch/arm/mach-imx/imx53.c                   |   16 +-
 arch/arm/mach-imx/imx6.c                    |   15 +-
 arch/arm/mach-imx/include/mach/imx1-regs.h  |   23 -
 arch/arm/mach-imx/include/mach/imx21-regs.h |   24 -
 arch/arm/mach-imx/include/mach/imx25-regs.h |   27 -
 arch/arm/mach-imx/include/mach/imx27-regs.h |   23 -
 arch/arm/mach-imx/include/mach/imx31-regs.h |   27 -
 arch/arm/mach-imx/include/mach/imx35-regs.h |   28 -
 arch/arm/mach-imx/include/mach/imx51-regs.h |   19 -
 arch/arm/mach-imx/include/mach/imx53-regs.h |   19 -
 arch/arm/mach-imx/include/mach/imx6-regs.h  |   19 -
 commands/Kconfig                            |   12 +-
 commands/oftree.c                           |   28 +-
 common/oftree.c                             |    4 +-
 drivers/Kconfig                             |    1 +
 drivers/Makefile                            |    1 +
 drivers/base/driver.c                       |   35 +-
 drivers/base/platform.c                     |    5 +
 drivers/mci/imx-esdhc.c                     |   25 +-
 drivers/mfd/mc13xxx.c                       |   12 +
 drivers/net/fec_imx.c                       |   34 +-
 drivers/nor/cfi_flash.c                     |   29 +-
 drivers/of/Kconfig                          |    2 +
 drivers/of/Makefile                         |    3 +
 drivers/of/base.c                           |  802 +++++++++++++++++++++++++++
 drivers/of/gpio.c                           |   28 +
 drivers/of/partition.c                      |   64 +++
 drivers/serial/serial_imx.c                 |   17 +-
 drivers/spi/imx_spi.c                       |   49 +-
 drivers/spi/spi.c                           |   34 +-
 include/driver.h                            |   10 +
 include/of.h                                |  113 ++++
 include/spi/spi.h                           |    6 +
 42 files changed, 1493 insertions(+), 327 deletions(-)
 create mode 100644 drivers/of/Kconfig
 create mode 100644 drivers/of/Makefile
 create mode 100644 drivers/of/base.c
 create mode 100644 drivers/of/gpio.c
 create mode 100644 drivers/of/partition.c



More information about the barebox mailing list