1. 06 Feb, 2020 1 commit
    • Maxime Ripard's avatar
      dtc: add ability to make nodes conditional on them being referenced · 5ed2dc56
      Maxime Ripard authored
      This is needed when importing mainline DTs into U-Boot, as some started
      using this /omit-if-no-ref/ tag, so won't compile with U-Boot's current
      dtc copy. This is just a cherry-pick of the patch introducing this
      feature.
      Original commit message from Maxime:
      ------------------
      A number of platforms have a need to reduce the number of DT nodes,
      mostly because of two similar constraints: the size of the DT blob, and
      the time it takes to parse it.
      
      As the DT is used in more and more SoCs, and by more projects, some
      constraints start to appear in bootloaders running from SRAM with an
      order of magnitude of 10kB. A typical DT is in the same order of
      magnitude, so any effort to reduce the blob size is welcome in such an
      environment.
      
      Some platforms also want to reach very fast boot time, and the time it
      takes to parse a typical DT starts to be noticeable.
      
      Both of these issues can be mitigated by reducing the number of nodes in
      the DT. The biggest provider of nodes is usually the pin controller and
      its subnodes, usually one for each valid pin configuration in a given
      SoC.
      
      Obviously, a single, fixed, set of these nodes will be used by a given
      board, so we can introduce a node property that will tell the DT
      compiler to drop the nodes when they are not referenced in the tree, and
      as such wouldn't be useful in the targetted system.
      Signed-off-by: Maxime Ripard's avatarMaxime Ripard <maxime.ripard@bootlin.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      5ed2dc56
  2. 30 Jan, 2020 2 commits
  3. 23 Nov, 2019 1 commit
  4. 05 Nov, 2019 4 commits
  5. 15 Oct, 2019 4 commits
    • Giulio Benetti's avatar
      4ab6a45e
    • Matthias Brugger's avatar
      libfdt: Allow #size-cells of 0 · 8076fc29
      Matthias Brugger authored
      The commit "libfdt: fdt_address_cells() and fdt_size_cells()" introduced
      a bug as it consolidated code between the helpers for getting
      be 0, and is frequently found so in practice for /cpus.  IEEE1275 only
      requires implementations to handle 1..4 for #address-cells, although one
      could make a case for #address-cells == #size-cells == 0 being used to
      represent a bridge with a single port.
      
      While we're there, it's not totally obvious that the existing implicit
      cast of a u32 to int will give the correct results according to strict C,
      although it does work in practice.  Straighten that up to cast only after
      we've made our range checks.
      
      This is based on upstream commit:
      b8d6eca ("libfdt: Allow #size-cells of 0")
      but misses the test cases,as we don't implement them in U-Boot.
      Signed-off-by: Matthias Brugger's avatarMatthias Brugger <mbrugger@suse.com>
      8076fc29
    • Matthias Brugger's avatar
      libfdt: return correct value if #size-cells property is not present · 0ba41ce1
      Matthias Brugger authored
      According to the device tree specification, the default value for
      was not present.
      
      This patch also makes fdt_address_cells() and fdt_size_cells() conform
      to the behaviour documented in libfdt.h. The defaults are only returned
      if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error
      is returned.
      
      This is based on upstream commit:
      aa7254d ("libfdt: return correct value if #size-cells property is not present")
      but misses the test case part, as we don't implement them in U-Boot.
      Signed-off-by: Matthias Brugger's avatarMatthias Brugger <mbrugger@suse.com>
      0ba41ce1
    • Matthias Brugger's avatar
      libfdt: fdt_address_cells() and fdt_size_cells() · ce2dae3a
      Matthias Brugger authored
      Add internal fdt_cells() to avoid copy and paste. Fix typo in
      fdt_size_cells() documentation comment.
      
      This is based in upstream commit:
      c12b2b0 ("libfdt: fdt_address_cells() and fdt_size_cells()")
      but misses the test cases, as we don't implement them in U-Boot.
      Signed-off-by: Matthias Brugger's avatarMatthias Brugger <mbrugger@suse.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ce2dae3a
  6. 29 Jul, 2019 1 commit
    • Simon Glass's avatar
      libfdt: Copy the struct region in fdt_resize() · 89d66907
      Simon Glass authored
      At present this function appears to copy only the data before the struct
      region and the data in the string region. It does not seem to copy the
      struct region itself.
      
      >From the arguments of this function it seems that it should support fdt
      and buf being different. This patch attempts to fix this problem.
      
      Upstream commit: c72fa77 libfdt: Copy the struct region in fdt_resize()
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      89d66907
  7. 12 Apr, 2019 1 commit
    • Thierry Reding's avatar
      libfdt: Add phandle generation helper · ea1df3e0
      Thierry Reding authored
      The new fdt_generate_phandle() function can be used to generate a new,
      unused phandle given a specific device tree blob. The implementation is
      somewhat naive in that it simply walks the entire device tree to find
      the highest phandle value and then returns a phandle value one higher
      than that. A more clever implementation might try to find holes in the
      current set of phandle values and fill them. But this implementation is
      relatively simple and works reliably.
      
      Also add a test that validates that phandles generated by this new API
      are indeed unique.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ea1df3e0
  8. 15 Jan, 2019 1 commit
  9. 28 Sep, 2018 1 commit
  10. 08 Aug, 2018 1 commit
    • Simon Glass's avatar
      libfdt: Update to latest pylibfdt implementation · 50c59522
      Simon Glass authored
      The enhanced pylibfdt support in U-Boot needed for binman was a
      placeholder while upstreaming of this work continued. This is now
      complete, so bring in the changes and update the tools as needed.
      
      There are quite a few changes since we decided to split the
      implementation into three fdt classes instead of two.
      
      The Fdt.del_node() method was unfortunately missed in this process and
      will be dealt with later. It exists in U-Boot but not upstream.
      
      Further syncing of libfdt probably needs to wait until we assess the
      code-size impact of all the new checking code on SPL and possibly provide
      a way to disable it.
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      50c59522
  11. 09 Jul, 2018 3 commits
  12. 31 May, 2018 3 commits
    • Eugeniu Rosca's avatar
      scripts/dtc: Re-sync with Linux 4.17-rc4 · 82bca362
      Eugeniu Rosca authored
      To achieve a DTC state (more or less) equivalent to Linux 4.17-rc4,
      backport the DTC-specific part from below Linux commits:
      
      b23d1a241f4eb4 ("kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically")
      9a8dfb394c0467 ("kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile")
      59889300274569 (".gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore")
      e039139be8c251 ("scripts/dtc: generate lexer and parser during build instead of shipping")
      b24413180f5600 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")
      
      With this commit, the diff between Linux and U-boot common DTC files is:
      $ git diff --stat --diff-filter=M v4.17-rc4 <this-commit> -- scripts/dtc
        scripts/dtc/.gitignore | 2 +-
        scripts/dtc/Makefile   | 3 +++
      
      The delta is coming from U-boot commits:
      * v2017.11 de163ece ("scripts: dtc: Add .gitignore")
      * v2018.01 15b97f5c ("pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile")
      Signed-off-by: default avatarEugeniu Rosca <erosca@de.adit-jv.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      82bca362
    • Rob Herring's avatar
      scripts/dtc: Update to upstream version v1.4.6-9-gaadd0b65c987 · db405d19
      Rob Herring authored
      This adds the following commits from upstream:
      
      aadd0b65c987 checks: centralize printing of property names in failure messages
      88960e398907 checks: centralize printing of node path in check_msg
      f1879e1a50eb Add limited read-only support for older (V2 and V3) device tree to libfdt.
      37dea76e9700 srcpos: drop special handling of tab
      65893da4aee0 libfdt: overlay: Add missing license
      962a45ca034d Avoid installing pylibfdt when dependencies are missing
      cd6ea1b2bea6 Makefile: Split INSTALL out into INSTALL_{PROGRAM,LIB,DATA,SCRIPT}
      51b3a16338df Makefile.tests: Add LIBDL make(1) variable for portability sake
      333d533a8f4d Attempt to auto-detect stat(1) being used if not given proper invocation
      e54388015af1 dtc: Bump version to v1.4.6
      a1fe86f380cb fdtoverlay: Switch from using alloca to malloc
      c8d5472de3ff tests: Improve compatibility with other platforms
      c81d389a10cc checks: add chosen node checks
      e671852042a7 checks: add aliases node checks
      d0c44ebe3f42 checks: check for #{size,address}-cells without child nodes
      18a3d84bb802 checks: add string list check for *-names properties
      8fe94fd6f19f checks: add string list check
      6c5730819604 checks: add a string check for 'label' property
      a384191eba09 checks: fix sound-dai phandle with arg property check
      b260c4f610c0 Fix ambiguous grammar for devicetree rule
      fe667e382bac tests: Add some basic tests for the pci_bridge checks
      7975f6422260 Fix widespread incorrect use of strneq(), replace with new strprefixeq()
      fca296445eab Add strstarts() helper function
      cc392f089007 tests: Check non-matching cases for fdt_node_check_compatible()
      bba26a5291c8 livetree: avoid assertion of orphan phandles with overlays
      c8f8194d76cc implement strnlen for systems that need it
      c8b38f65fdec libfdt: Remove leading underscores from identifiers
      3b62fdaebfe5 Remove leading underscores from identifiers
      2d45d1c5c65e Replace FDT_VERSION() with stringify()
      2e6fe5a107b5 Fix some errors in comments
      b0ae9e4b0ceb tests: Correct warning in sw_tree1.c
      
      Commit c8b38f65fdec upstream ("libfdt: Remove leading underscores from
      identifiers") changed the multiple inclusion define protection, so the
      kernel's libfdt_env.h needs the corresponding update.
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      [ Linux commit: 9130ba884640328bb78aaa4840e5ddf06ccafb1c ]
      [erosca: - Fixup conflicts in include/linux/libfdt_env.h caused by v2018.03-rc4
                 commit b08c8c48 ("libfdt: move headers to <linux/libfdt.h>
      	   and <linux/libfdt_env.h>")
      	 - Fix build errors in lib/libfdt/fdt_ro.c, tools/libfdt/fdt_rw.c by:
      	   - s/_fdt_mem_rsv/fdt_mem_rsv_/
      	   - s/_fdt_offset_ptr/fdt_offset_ptr_/
      	   - s/_fdt_check_node_offset/fdt_check_node_offset_/
      	   - s/_fdt_check_prop_offset/fdt_check_prop_offset_/
      	   - s/_fdt_find_add_string/fdt_find_add_string_/]
      Signed-off-by: default avatarEugeniu Rosca <erosca@de.adit-jv.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      db405d19
    • Rob Herring's avatar
      scripts/dtc: Update to upstream version v1.4.5-6-gc1e55a5513e9 · 072a2995
      Rob Herring authored
      Pickup the fix for handling unresolved phandles in overlays.
      
      This adds the following commits from upstream:
      
      c1e55a5513e9 checks: fix handling of unresolved phandles for dts plugins
      f8872e29ce06 tests: Avoid 64-bit arithmetic in assembler
      48c91c08bcfa libfdt: add stringlist functions to linker script
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      [ Linux commit: e45fe7f788dd1395befe5639149ad8dacfbd94ab ]
      Signed-off-by: default avatarEugeniu Rosca <erosca@de.adit-jv.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Reviewed-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      072a2995
  13. 24 May, 2018 1 commit
  14. 07 May, 2018 1 commit
    • Tom Rini's avatar
      SPDX: Convert all of our multiple license tags to Linux Kernel style · 4549e789
      Tom Rini authored
      When U-Boot started using SPDX tags we were among the early adopters and
      there weren't a lot of other examples to borrow from.  So we picked the
      area of the file that usually had a full license text and replaced it
      with an appropriate SPDX-License-Identifier: entry.  Since then, the
      Linux Kernel has adopted SPDX tags and they place it as the very first
      line in a file (except where shebangs are used, then it's second line)
      and with slightly different comment styles than us.
      
      In part due to community overlap, in part due to better tag visibility
      and in part for other minor reasons, switch over to that style.
      
      This commit changes all instances where we have multiple licenses (in
      these cases, dual license) declared in the SPDX-License-Identifier tag.
      In this case we change from listing "LICENSE-A LICENSE-B" or "LICENSE-A
      or LICENSE-B" or "(LICENSE-A OR LICENSE-B)" to "LICENSE-A OR LICENSE-B"
      as per the Linux Kernel style document.  Note that parenthesis are
      allowed so when they were used before we continue to use them.
      Reviewed-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      4549e789
  15. 28 Jan, 2018 1 commit
  16. 17 Nov, 2017 4 commits
    • Masahiro Yamada's avatar
      pylibfdt: compile pylibfdt only when dtoc/binman is necessary · d6a0c78a
      Masahiro Yamada authored
      Currently, pylibfdt is always compiled if swig is installed on your
      machine.  It is really annoying because most of targets (excepts
      x86, sunxi, rockchip) do not use dtoc or binman.
      
      "checkbinman" and "checkdtoc" are wrong.  It is odd that the final
      build stage checks if we have built necessary tools.  If your platform
      depends on dtoc/binman, you must be able to build pylibfdt.  If swig
      is not installed, it should fail immediately.
      
      I added PYLIBFDT, DTOC, BINMAN entries to Kconfig.  They should be
      property select:ed by platforms that need them.  Kbuild will descend
      into scripts/dtc/pylibfdt/ only when CONFIG_PYLIBFDT is enabled.
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      d6a0c78a
    • Masahiro Yamada's avatar
      pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile · 15b97f5c
      Masahiro Yamada authored
      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's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      15b97f5c
    • Masahiro Yamada's avatar
      scripts/dtc: Update to upstream version v1.4.5-3-gb1a60033c110 · 999a78d5
      Masahiro Yamada authored
      This adds the following commits from upstream:
      
      b1a6003 tests: Add a test for overlays syntactic sugar
      737b2df overlay: Add syntactic sugar version of overlays
      497432f checks: Use proper format modifier for size_t
      22a65c5 dtc: Bump version to v1.4.5
      c575d80 Add fdtoverlay to .gitignore
      b6a6f94 fdtoverlay: Sanity check blob size
      8c1eb15 pylibfdt: Use Python2 explicitly
      ee3d26f checks: add interrupts property check
      c1e7738 checks: add gpio binding properties check
      b3bbac0 checks: add phandle with arg property checks
      
      [ sync with Linux commit: 4201d057ea91c3d6efd2db65219bc91fae413bc2 ]
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      999a78d5
    • Rob Herring's avatar
      scripts/dtc: add fdt_overlay.c and fdt_addresses.c to sync script · 0d821618
      Rob Herring authored
      libfdt has gained some new files. We need to include them in the
      kernel's copy.
      Reported-by: default avatarKyle Yan <kyan@codeaurora.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      
      [ Linux commit: 4322323058f010274564006d61945187a15b6361 ]
      0d821618
  17. 02 Oct, 2017 1 commit
  18. 23 Sep, 2017 3 commits
    • Tom Rini's avatar
      scripts/dtc: Update to upstream version v1.4.4-50-gfe50bd1ecc1d · 2d4c2259
      Tom Rini authored
      This adds the following commits from upstream:
      
      fe50bd1ecc1d fdtget: Split out cell list display into a new function
      62d812308d11 README: Add a note about test_tree1.dts
      5bed86aee9e8 pylibfdt: Add support for fdt_subnode_offset()
      46f31b65b3b3 pylibfdt: Add support for fdt_node_offset_by_phandle()
      a3ae43723687 pylibfdt: Add support for fdt_parent_offset()
      a198af80344c pylibfdt: Add support for fdt_get_phandle()
      b9eba92ea50f tests: Return a failure code when any tests fail
      155faf6cc209 pylibfdt: Use local pylibfdt module
      50e5cd07f325 pylibfdt: Add a test for use of uint32_t
      ab78860f09f5 pylibfdt: Add stdint include to fix uint32_t
      36f511fb1113 tests: Add stacked overlay tests on fdtoverlay
      1bb00655d3e5 fdt: Allow stacked overlays phandle references
      a33c2247ac8d Introduce fdt_setprop_placeholder() method
      0016f8c2aa32 dtc: change default phandles to ePAPR style instead of both
      e3b9a9588a35 tests: fdtoverlay unit test
      42409146f2db fdtoverlay: A tool that applies overlays
      aae22722fc8d manual: Document missing options
      13ce6e1c2fc4 dtc: fix sprintf() format string error, again
      d990b8013889 Makefile: Fix build on MSYS2 and Cygwin
      51f56dedf8ea Clean up shared library compile/link options
      21a2bc896e3d Suppress expected error message in fdtdump test
      2a42b14d0d03 dtc: check.c fix compile error
      a10cb3c818d3 Fix get_node_by_path string equality check
      548aea2c436a fdtdump: Discourage use of fdtdump
      c2258841a785 fdtdump: Fix over-zealous version check
      9067ee4be0e6 Fix a few whitespace and style nits
      e56f2b07be38 pylibfdt: Use setup.py to build the swig file
      896f1c133265 pylibfdt: Use Makefile constructs to implement NO_PYTHON
      90db6d9989ca pylibfdt: Allow setup.py to operate stand-alone
      e20d9658cd8f Add Coverity Scan support
      b04a2cf08862 pylibfdt: Fix code style in setup.py
      1c5170d3a466 pylibfdt: Rename libfdt.swig to libfdt.i
      580a9f6c2880 Add a libfdt function to write a property placeholder
      ab15256d8d02 pylibfdt: Use the call function to simplify the Makefile
      9f2e3a3a1f19 pylibfdt: Use the correct libfdt version in the module
      e91c652af215 pylibfdt: Enable installation of Python module
      8a892fd85d94 pylibfdt: Allow building to be disabled
      741cdff85d3e .travis.yml: Add builds with and without Python library prerequisites
      14c4171f4f9a pylibfdt: Use package_dir to set the package directory
      89a5062ab231 pylibfdt: Use environment to pass C flags and files
      4e0e0d049757 pylibfdt: Allow pkg-config to be supplied in the environment
      6afd7d9688f5 Correct typo: s/pylibgfdt/pylibfdt/
      756ffc4f52f6 Build pylibfdt as part of the normal build process
      8cb3896358e9 Adjust libfdt.h to work with swig
      b40aa8359aff Mention pylibfdt in the documentation
      12cfb740cc76 Add tests for pylibfdt
      50f250701631 Add an initial Python library for libfdt
      cdbb2b6c7a3a checks: Warn on node name unit-addresses with '0x' or leading 0s
      4c15d5da17cc checks: Add bus checks for simple-bus buses
      33c3985226d3 checks: Add bus checks for PCI buses
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      2d4c2259
    • Tom Rini's avatar
      scripts/dtc: Update to upstream version v1.4.4 · d6fc90ce
      Tom Rini authored
      This adds the following commits from upstream:
      
      558cd81bdd43 dtc: Bump version to v1.4.4
      c17a811c62eb fdtput: Remove star from value_len documentation
      194d5caaefcb fdtget: Use @return to document the return value
      d922ecdd017b tests: Make realloc_fdt() really allocate *fdt
      921cc17fec29 libfdt: overlay: Check the value of the right variable
      9ffdf60bf463 dtc: Simplify asm_emit_string() implementation
      881012e44386 libfdt: Change names of sparse helper macros
      bad5b28049e5 Fix assorted sparse warnings
      672ac09ea04d Clean up gcc attributes
      49300f2ade6a dtc: Don't abuse struct fdt_reserve_entry
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      d6fc90ce
    • Tom Rini's avatar
      scripts/dtc: Update to upstream version v1.4.3 · c0e032e0
      Tom Rini authored
      Using the update-dtc-source.sh script from Linux v4.14-rc1 import the
      portions of dtc that we require.  We bring in update-dtc-source.sh and
      scripts/dtc/Makefile from Linux v4.14-rc1.  Rework DTC_FLAGS handling to
      not require a test.
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      c0e032e0