05 Mar, 2018

1 commit

  • Thomas reported U-Boot failed to build host tools if libfdt-devel
    package is installed because tools include libfdt headers from
    /usr/include/ instead of using internal ones.

    This commit moves the header code:
    include/libfdt.h -> include/linux/libfdt.h
    include/libfdt_env.h -> include/linux/libfdt_env.h

    and replaces include directives:
    #include -> #include
    #include -> #include

    Reported-by: Thomas Petazzoni
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

29 Jan, 2018

2 commits

  • There is tons of code duplication between lib/libfdt/libfdt.h and
    scripts/dtc/libfdt/libfdt.h. Evacuate the U-Boot own code to
    include/libfdt.h and remove lib/libfdt/libfdt.h.

    For host tools, should include scripts/dtc/libfdt/libfdt.h,
    which is already suitable for user-space.

    For compiling U-Boot, should be included because we
    need a different libfdt_env.h .

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The only difference between scripts/dtc/libfdt/fdt_rw.c and
    lib/libfdt/fdt_rw.c is fdt_remove_unused_strings().

    It is only used by fdtgrep, so we do not need to compile it for U-Boot
    image. Move it to tools/libfdt/fdw_rw.c so that lib/libfdt/fdt_rw.c
    can be a wrapper of scripts/dtc/libfdt/fdt_rw.c.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

04 Dec, 2017

2 commits


17 Nov, 2017

4 commits

  • lib/libfdt/ and scripts/dtc/libfdt have the same copies for the
    followings 6 files:
    fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c
    fdt_sw.c

    Make them a wrapper of scripts/dtc/libfdt/*. This is exactly what
    Linux does to sync libfdt. In order to make is possible, import
    and from Linux 4.14-rc5.

    Unfortunately, U-Boot locally modified the following 3 files:
    fdt_ro.c fdt_wip.c fdt_rw.c

    The fdt_region.c is U-Boot own file.

    I did not touch them in order to avoid unpredictable impact.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Fortunately, U-Boot did not modify libfdt_internal.h locally.

    Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be
    periodically synced with the upstream DTC (or kernel).

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Fortunately, U-Boot did not modify fdt.h locally.

    Change it to a wrapper of scripts/dtc/libfdt/fdt.h, which will be
    periodically synced with the upstream DTC (or kernel).

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The pylibfdt is used by dtoc (and, indirectly by binman), but there
    is no reason why it must be generated in the tools/ directory.

    Recently, U-Boot switched over to the bundled DTC, and the directory
    structure under scripts/dtc/ now mirrors the upstream DTC project.
    So, scripts/dtc/pylibfdt is the best location.

    I also rewrote the Makefile in a cleaner Kbuild style.

    The scripts from the upstream have been moved as follows:

    lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
    lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

    The .i_shipped is coped to .i during building because the .i must be
    located in the objtree when we build it out of tree.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

15 Sep, 2017

3 commits

  • This patch enables an overlay to refer to a previous overlay's
    labels by performing a merge of symbol information at application
    time.

    In a nutshell it allows an overlay to refer to a symbol that a previous
    overlay has defined. It requires both the base and all the overlays
    to be compiled with the -@ command line switch so that symbol
    information is included.

    base.dts
    --------

    /dts-v1/;
    / {
    foo: foonode {
    foo-property;
    };
    };

    $ dtc -@ -I dts -O dtb -o base.dtb base.dts

    bar.dts
    -------

    /dts-v1/;
    /plugin/;
    / {
    fragment@1 {
    target = ;
    __overlay__ {
    overlay-1-property;
    bar: barnode {
    bar-property;
    };
    };
    };
    };

    $ dtc -@ -I dts -O dtb -o bar.dtb bar.dts

    baz.dts
    -------

    /dts-v1/;
    /plugin/;
    / {
    fragment@1 {
    target = ;
    __overlay__ {
    overlay-2-property;
    baz: baznode {
    baz-property;
    };
    };
    };
    };

    $ dtc -@ -I dts -O dtb -o baz.dtb baz.dts

    Applying the overlays:

    $ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb

    Dumping:

    $ fdtdump target.dtb
    / {
    foonode {
    overlay-1-property;
    foo-property;
    linux,phandle = ;
    phandle = ;
    barnode {
    overlay-2-property;
    phandle = ;
    linux,phandle = ;
    bar-property;
    baznode {
    phandle = ;
    linux,phandle = ;
    baz-property;
    };
    };
    };
    __symbols__ {
    baz = "/foonode/barnode/baznode";
    bar = "/foonode/barnode";
    foo = "/foonode";
    };
    };

    Signed-off-by: Pantelis Antoniou
    Signed-off-by: David Gibson
    Acked-by: Simon Glass

    Pantelis Antoniou
     
  • Report Coverity log:
    The code uses a variable that has not
    been initialized, leading to unpredictable
    or unintended results.

    Reported-by: Coverity (CID: 60519)
    Signed-off-by: Tien Fong Chee

    Tien Fong Chee
     
  • Add upstream changes to U-Boot:

    - new pylibfdt functions
    - fdt_setprop_placeholder()

    Signed-off-by: Simon Glass

    Simon Glass
     

12 Sep, 2017

1 commit


10 Jul, 2017

1 commit

  • This error code has not been upstreamed and is not really needed since it
    is unlikely to be triggered. Drop it to maintain compatability with
    upstream.

    Reported-by: Peter Robinson

    Signed-off-by: Simon Glass
    Tested-by: Peter Robinson

    Simon Glass
     

03 Jun, 2017

5 commits


14 Apr, 2017

1 commit


11 Apr, 2017

2 commits

  • For some reason Python 3 seems to think it does not need to build
    the library. Using the --force parameter makes sure that the library
    gets built always. This is especially important since we move the
    library in the next step of the Makefile, hence forcing a rebuild
    every time the higher level Makefile triggers a rebuild is required
    to make sure the library is always there.

    Signed-off-by: Stefan Agner
    Acked-by: Simon Glass

    Stefan Agner
     
  • This a few minor changes down from upstream since the last sync.

    Signed-off-by: Simon Glass

    Simon Glass
     

14 Jan, 2017

1 commit

  • The fdt_overlay_apply() function purports to support the edge cases where
    an overlay has no fixups to be applied, or a base tree which has no
    symbols (the latter can only work if the former is also true). However it
    gets it wrong in a couple of small ways:

    * In the no fixups case, it doesn't fail immediately, but will attempt
    fdt_for_each_property_offset() giving -FDT_ERR_NOTFOUND as the node
    offset, which will fail. Instead it should succeed immediately, since
    there's nothing to do.
    * In the case of no symbols, it again doesn't fail immediately. However
    if there is an actual fixup it will fail with an unexpected error,
    because -FDT_ERR_NOTFOUND is passed to fdt_getprop() when attempting to
    look up the symbols. We should instead return -FDT_ERR_NOTFOUND
    directly.

    Both of these errors lead to the code returning misleading error codes in
    failing cases.

    [ DTC commit: 7d8ef6e1db9794f72805a0855f4f7f12fadd03d3 ]

    Signed-off-by: David Gibson
    Signed-off-by: Stefan Agner
    Acked-by: Simon Glass

    David Gibson
     

24 Oct, 2016

3 commits


14 Oct, 2016

5 commits

  • The fdt_path_offset() function is not inlined in upstream libfdt. Adjust
    U-Boot's version to match.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • The signature for this macro has changed. Bring in the upstream version and
    adjust U-Boot's usages to suit.

    Signed-off-by: Simon Glass
    Update to drivers/power/pmic/palmas.c:
    Signed-off-by: Keerthy

    Change-Id: I6cc9021339bfe686f9df21d61a1095ca2b3776e8

    Simon Glass
     
  • These have now landed upstream. The naming is different and in one case the
    function signature has changed. Update the code to match.

    This applies the following upstream commits by
    Thierry Reding :

    604e61e fdt: Add functions to retrieve strings
    8702bd1 fdt: Add a function to get the index of a string
    2218387 fdt: Add a function to count strings

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This includes small changes to the following functions, from upstream
    commit 6d1832c:

    - fdt_get_max_phandle() (upstream commit 84e0e134)
    - fdt_node_check_compatible (upstream commit 53bf130b)
    - fdt_setprop_inplace_namelen_partial() to remove useless brackets and
    use idx instead of index
    - _fdt_resize_property() to use idx instead of index
    - _fdt_splice() (upstream commit d4c7c25c)

    It also includes various typo fixes in libfdt.h

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Using pointer arithmetic to generate a pointer outside a known object is,
    technically, undefined behaviour in C. Unfortunately, we were using that
    in fdt_offset_ptr() to detect overflows.

    To fix this we need to do our bounds / overflow checking on the offsets
    before constructing pointers from them.

    Reported-by: David Binderman
    Signed-off-by: David Gibson
    Signed-off-by: Simon Glass

    David Gibson
     

24 Sep, 2016

1 commit


19 Sep, 2016

4 commits


20 Aug, 2016

4 commits

  • This adds a bunch of unit tests for the "fdt apply" command.

    They've all been run successfully in the sandbox. However, as you still
    require an out-of-tree dtc with overlay support, this is disabled by
    default.

    Acked-by: Simon Glass
    Acked-by: Pantelis Antoniou
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • The device tree overlays are a good way to deal with user-modifyable
    boards or boards with some kind of an expansion mechanism where we can
    easily plug new board in (like the BBB or the raspberry pi).

    However, so far, the usual mechanism to deal with it was to have in Linux
    some driver detecting the expansion boards plugged in and then request
    these overlays using the firmware interface.

    That works in most cases, but in some cases, you might want to have the
    overlays applied before the userspace comes in. Either because the new
    board requires some kind of an early initialization, or because your root
    filesystem is accessed through that expansion board.

    The easiest solution in such a case is to simply have the component before
    Linux applying that overlay, removing all these drawbacks.

    Reviewed-by: Stefan Agner
    Acked-by: Pantelis Antoniou
    Acked-by: Simon Glass
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • The device tree overlays are a good way to deal with user-modifyable
    boards or boards with some kind of an expansion mechanism where we can
    easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

    Add a new function to merge overlays with a base device tree.

    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • Add a function to modify inplace only a portion of a property..

    This is especially useful when the property is an array of values, and you
    want to update one of them without changing the DT size.

    Signed-off-by: Maxime Ripard
    Acked-by: Simon Glass

    Maxime Ripard