Skip to contentSkip to conversation

An effort to bring DT bindings compliance within U-boot

PATCH Superseded Sumit Garg 9 participants 52 messages Dec 14, 2023 – Dec 28, 2023

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

cover An effort to bring DT bindings compliance within U-boot

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows::

$ git subtree pull --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-boot maintainers here [4]. Now we would like to reach out to wider U-boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-boot to run devicetree bindings schema checks which will bring compliance to U-boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

It is also possible to run checks with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.

$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

Sumit Garg (8):
Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks
Makefile: Add support for DT bindings schema checks scripts/Makefile.lib: Statically define *-u-boot.dtsi files location
dts: Add alternative location for upstream DTB builds
doc: devicetree: Updates for devicetree-rebasing subtree
MAINTAINERS: Add myself as devicetree-rebasing maintainer
dts: meson-gxbb: Switch to using upstream DT
dts: meson-gxbb: Drop redundant devicetree files

 .azure-pipelines.yml                    |   3 +-
 MAINTAINERS                             |   6 +
 Makefile                                |  20 +-
 arch/arm/dts/Makefile                   |   8 -
 arch/arm/dts/meson-gxbb-kii-pro.dts     | 140 ----
 arch/arm/dts/meson-gxbb-nanopi-k2.dts   | 415 ------------
 arch/arm/dts/meson-gxbb-odroidc2.dts    | 418 ------------
 arch/arm/dts/meson-gxbb-p200.dts        | 100 ---
 arch/arm/dts/meson-gxbb-p201.dts        |  26 -
 arch/arm/dts/meson-gxbb-p20x.dtsi       | 250 -------
 arch/arm/dts/meson-gxbb-wetek-hub.dts   |  58 --
 arch/arm/dts/meson-gxbb-wetek-play2.dts | 119 ----
 arch/arm/dts/meson-gxbb-wetek.dtsi      | 292 --------
 arch/arm/dts/meson-gxbb.dtsi            | 856 ------------------------
 configs/nanopi-k2_defconfig             |   3 +-
 configs/odroid-c2_defconfig             |   3 +-
 configs/p200_defconfig                  |   3 +-
 configs/p201_defconfig                  |   3 +-
 configs/videostrong-kii-pro_defconfig   |   3 +-
 configs/wetek-hub_defconfig             |   3 +-
 configs/wetek-play2_defconfig           |   3 +-
 doc/develop/devicetree/control.rst      | 108 ++-
 dts/Kconfig                             |  11 +
 dts/Makefile                            |  17 +-
 dts/arch/arm64/Makefile                 |  23 +
 dts/arch/arm64/amlogic                  |   1 +
 scripts/Makefile.lib                    |  42 +-
 27 files changed, 204 insertions(+), 2730 deletions(-)
 delete mode 100644 arch/arm/dts/meson-gxbb-kii-pro.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p200.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p201.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p20x.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb.dtsi
 create mode 100644 dts/arch/arm64/Makefile
 create mode 120000 dts/arch/arm64/amlogic
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/8 Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks

---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +2 -1
index d6f3fa423c6..f100c4493e6 100644
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
   - job: docs
     displayName: 'Build documentation'
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/8] Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks

Quoted 10 lines · Sumit Garg
---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +0 -0
index d6f3fa423c6..f100c4493e6 100644

.azure-pipelines.yml stages: · line 72

Quoted 9 lines
.azure-pipelines.yml +2 -1
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
   - job: docs
     displayName: 'Build documentation'

The GitLab tests needs an equivalent change.

Signature · 1 line
Tom
author
#3 lore raw

Re: [PATCH 1/8] Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks

Quoted 19 lines · Tom Rini
Quoted 17 lines · Sumit Garg
---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +2 -1
index d6f3fa423c6..f100c4493e6 100644
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
Quoted 5 lines

.azure-pipelines.yml stages: · line 72

Quoted 2 lines
.azure-pipelines.yml +0 -0
   - job: docs
     displayName: 'Build documentation'

The GitLab tests needs an equivalent change.

Sure I will do that in the next spin of this patch-set, thanks for catching it.

-Sumit

Quoted 2 lines

--
Tom

#4 lore raw

Re: [PATCH 1/8] Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks

Hi Sumit,

Quoted 21 lines · Sumit Garg
Quoted 19 lines · Tom Rini
Quoted 17 lines · Sumit Garg
---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +2 -1
index d6f3fa423c6..f100c4493e6 100644
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
Quoted 7 lines
Quoted 5 lines

.azure-pipelines.yml stages: · line 72

Quoted 2 lines
.azure-pipelines.yml +0 -0
   - job: docs
     displayName: 'Build documentation'

The GitLab tests needs an equivalent change.

Sure I will do that in the next spin of this patch-set, thanks for catching it.

Also, please add a commit message with that :-)

Regards,
Simon

author
#5 lore raw

Re: [PATCH 1/8] Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks

Quoted 31 lines · Simon Glass

Hi Sumit,

Quoted 27 lines · Sumit Garg
Quoted 24 lines · Tom Rini
Quoted 10 lines · Sumit Garg
---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +0 -0
index d6f3fa423c6..f100c4493e6 100644

.azure-pipelines.yml stages: · line 72

Quoted 9 lines
.azure-pipelines.yml +2 -1
@@ -65,7 +65,8 @@ stages:
       # have no matches.
       - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
                   :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
-                  :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
+                  :^include/linux/kconfig.h :^tools/ :^devicetree-rebasing/ &&
+                  exit 1 || exit 0
 
   - job: docs
     displayName: 'Build documentation'

The GitLab tests needs an equivalent change.

Quoted 4 lines
Quoted 1 line

Sure I will do that in the next spin of this patch-set, thanks for catching it.

Also, please add a commit message with that :-)

Ack.

-Sumit

Quoted 2 lines

Regards,
Simon

author
#6 lore raw

PATCH 2/8 Makefile: Add support for DT bindings schema checks

In reply to Sumit Garg

This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing directory to provide the DT bindings.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip::

pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems::

apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:

$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings.

---
 Makefile             | 20 ++++++++++++++++++--
 scripts/Makefile.lib | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
Makefile +18 -2
index 750bbdb1b71..d8d168cd4c3 100644
@@ -1158,12 +1158,28 @@ endif
 	@# disabling OF_BOARD.
 	$(call cmd,ofcheck,$(KCONFIG_CONFIG))
 
-PHONY += dtbs
+PHONY += dtbs dtbs_check
 dtbs: dts/dt.dtb
 	@:
-dts/dt.dtb: u-boot
+dts/dt.dtb: dtbs_prepare u-boot
 	$(Q)$(MAKE) $(build)=dts dtbs
 
+dtbs_prepare: prepare3
+
+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
+export CHECK_DTBS=y
+endif
+
+ifneq ($(CHECK_DTBS),)
+dtbs_prepare: dt_binding_check
+endif
+
+dtbs_check: dt_binding_check dtbs
+
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+dt_binding_check: scripts_dtc
+	$(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) $(DT_BINDING_DIR)/processed-schema.json
+
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
scripts/Makefile.lib +15 -2
index 16bbc277a9f..27b9437027c 100644
@@ -356,8 +356,21 @@ endif
 
 dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
 
-$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
-	$(call if_changed_dep,dtc)
+ifneq ($(CHECK_DTBS),)
+DT_CHECKER ?= dt-validate
+DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
+
+quiet_cmd_dtb = DTC_CHK $@
+      cmd_dtb = $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+else
+quiet_cmd_dtb = $(quiet_cmd_dtc)
+      cmd_dtb = $(cmd_dtc)
+endif
+
+$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE
+	$(call if_changed_dep,dtb)
 
 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH 2/8] Makefile: Add support for DT bindings schema checks

Hi Sumit,

Quoted 105 lines · Sumit Garg

This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing directory to provide the DT bindings.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip::

pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems::

apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:

$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings.

---
 Makefile             | 20 ++++++++++++++++++--
 scripts/Makefile.lib | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
Makefile +18 -2
index 750bbdb1b71..d8d168cd4c3 100644
@@ -1158,12 +1158,28 @@ endif
        @# disabling OF_BOARD.
        $(call cmd,ofcheck,$(KCONFIG_CONFIG))
 
-PHONY += dtbs
+PHONY += dtbs dtbs_check
 dtbs: dts/dt.dtb
        @:
-dts/dt.dtb: u-boot
+dts/dt.dtb: dtbs_prepare u-boot
        $(Q)$(MAKE) $(build)=dts dtbs
 
+dtbs_prepare: prepare3
+
+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
+export CHECK_DTBS=y
+endif
+
+ifneq ($(CHECK_DTBS),)
+dtbs_prepare: dt_binding_check
+endif
+
+dtbs_check: dt_binding_check dtbs
+
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+dt_binding_check: scripts_dtc
+       $(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) $(DT_BINDING_DIR)/processed-schema.json
+
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
scripts/Makefile.lib +15 -3
index 16bbc277a9f..27b9437027c 100644
@@ -356,8 +356,21 @@ endif
 
 dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
 
-$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
-       $(call if_changed_dep,dtc)
+ifneq ($(CHECK_DTBS),)
+DT_CHECKER ?= dt-validate
+DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
+
+quiet_cmd_dtb = DTC_CHK $@
+      cmd_dtb = $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+else
+quiet_cmd_dtb = $(quiet_cmd_dtc)
+      cmd_dtb = $(cmd_dtc)
+endif
+
+$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE
+       $(call if_changed_dep,dtb)
 
 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
--
Quoted 2 lines

2.34.1

This is great.

Can you put the commit message in doc/ somewhere?

Regards,
Simon

author
#8 lore raw

Re: [PATCH 2/8] Makefile: Add support for DT bindings schema checks

Quoted 114 lines · Simon Glass

Hi Sumit,

Quoted 105 lines · Sumit Garg

This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing directory to provide the DT bindings.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip::

pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems::

apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:

$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings.

---
 Makefile             | 20 ++++++++++++++++++--
 scripts/Makefile.lib | 17 +++++++++++++++--
 2 files changed, 33 insertions(+), 4 deletions(-)
Makefile +18 -2
index 750bbdb1b71..d8d168cd4c3 100644
@@ -1158,12 +1158,28 @@ endif
        @# disabling OF_BOARD.
        $(call cmd,ofcheck,$(KCONFIG_CONFIG))
 
-PHONY += dtbs
+PHONY += dtbs dtbs_check
 dtbs: dts/dt.dtb
        @:
-dts/dt.dtb: u-boot
+dts/dt.dtb: dtbs_prepare u-boot
        $(Q)$(MAKE) $(build)=dts dtbs
 
+dtbs_prepare: prepare3
+
+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
+export CHECK_DTBS=y
+endif
+
+ifneq ($(CHECK_DTBS),)
+dtbs_prepare: dt_binding_check
+endif
+
+dtbs_check: dt_binding_check dtbs
+
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+dt_binding_check: scripts_dtc
+       $(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) $(DT_BINDING_DIR)/processed-schema.json
+
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
scripts/Makefile.lib +15 -3
index 16bbc277a9f..27b9437027c 100644
@@ -356,8 +356,21 @@ endif
 
 dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
 
-$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
-       $(call if_changed_dep,dtc)
+ifneq ($(CHECK_DTBS),)
+DT_CHECKER ?= dt-validate
+DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
+DT_BINDING_DIR := devicetree-rebasing/Bindings
+DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
+
+quiet_cmd_dtb = DTC_CHK $@
+      cmd_dtb = $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+else
+quiet_cmd_dtb = $(quiet_cmd_dtc)
+      cmd_dtb = $(cmd_dtc)
+endif
+
+$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) $(DT_TMP_SCHEMA) FORCE
+       $(call if_changed_dep,dtb)
 
 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
--
Quoted 2 lines

2.34.1

This is great.

Quoted 1 line

Can you put the commit message in doc/ somewhere?

As per your comment on the doc patch, this is already addressed.

-Sumit

Quoted 3 lines

Regards,
Simon

author
#9 lore raw

PATCH 3/8 scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

In reply to Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---
 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +14 -11
index 27b9437027c..4a002b0e0ca 100644
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-	$(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-	$(wildcard $(dir $<)u-boot.dtsi))
+UBOOT_DTSI_LOC = $(srctree)/arch/$(ARCH)/dts/
+
+u_boot_dtsi_options = $(strip $(wildcard $(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi) \
+	$(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
+	$(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
+	$(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
+	$(wildcard $(UBOOT_DTSI_LOC)u-boot.dtsi))
 
 u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
-	$(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
-	$(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
-	$(dir $<)u-boot.dtsi ... \
+	$(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi \
+	$(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+	$(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+	$(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+	$(UBOOT_DTSI_LOC)u-boot.dtsi ... \
 	found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 $(UBOOTINCLUDE)                                         \
 		 -I$(dir $<)                                             \
+		 -I$(UBOOT_DTSI_LOC)                                     \
 		 -I$(srctree)/arch/$(ARCH)/dts/include                   \
 		 -I$(srctree)/include                                    \
 		 -D__ASSEMBLY__                                          \
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 	  echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
 	$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
 	$(DTC) -O dtb -o $@ -b 0 \
-		-i $(dir $<) $(DTC_FLAGS) \
+		-i $(dir $<) -i $(UBOOT_DTSI_LOC) $(DTC_FLAGS) \
 		-d $(depfile).dtc.tmp $(dtc-tmp) || \
 		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
 		; \
Signature · 1 line
2.34.1
#10 lore raw

Re: [PATCH 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Hi Sumit,

Quoted 20 lines · Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---
 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +0 -0
index 27b9437027c..4a002b0e0ca 100644

scripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 162

Quoted 9 lines
scripts/Makefile.lib +1 -5
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dir $<)u-boot.dtsi))
+UBOOT_DTSI_LOC = $(srctree)/arch/$(ARCH)/dts/

How about lower case since it is internal. Also we know it is U-Boot, so perhap dtsi_loc ?

Otherwise looks OK to me.

Quoted 39 lines
scripts/Makefile.lib +13 -7
+
+u_boot_dtsi_options = $(strip $(wildcard $(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)u-boot.dtsi))
 
 u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
-       $(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
-       $(dir $<)u-boot.dtsi ... \
+       $(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)u-boot.dtsi ... \
        found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
                 $(UBOOTINCLUDE)                                         \
                 -I$(dir $<)                                             \
+                -I$(UBOOT_DTSI_LOC)                                     \
                 -I$(srctree)/arch/$(ARCH)/dts/include                   \
                 -I$(srctree)/include                                    \
                 -D__ASSEMBLY__                                          \
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
          echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
        $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
        $(DTC) -O dtb -o $@ -b 0 \
-               -i $(dir $<) $(DTC_FLAGS) \
+               -i $(dir $<) -i $(UBOOT_DTSI_LOC) $(DTC_FLAGS) \
                -d $(depfile).dtc.tmp $(dtc-tmp) || \
                (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
                ; \
--
Quoted 2 lines

2.34.1

Regards,
Simon

author
#11 lore raw

Re: [PATCH 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Quoted 26 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---
 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +0 -0
index 27b9437027c..4a002b0e0ca 100644
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
Quoted 10 lines

scripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 162

Quoted 7 lines
scripts/Makefile.lib +1 -5
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dir $<)u-boot.dtsi))
+UBOOT_DTSI_LOC = $(srctree)/arch/$(ARCH)/dts/

How about lower case since it is internal. Also we know it is U-Boot, so perhap ?

Although I just named it after *-u-boot.dtsi, I am fine with dtsi_loc too. So I will use that instead.

Quoted 2 lines

Otherwise looks OK to me.

Thanks,
-Sumit

Quoted 45 lines
Quoted 40 lines
scripts/Makefile.lib +13 -7
+
+u_boot_dtsi_options = $(strip $(wildcard $(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
+       $(wildcard $(UBOOT_DTSI_LOC)u-boot.dtsi))
 
 u_boot_dtsi_options_raw = $(warning Automatic .dtsi inclusion: options: \
-       $(dir $<)$(basename $(notdir $<))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
-       $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
-       $(dir $<)u-boot.dtsi ... \
+       $(UBOOT_DTSI_LOC)$(basename $(notdir $<))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi \
+       $(UBOOT_DTSI_LOC)u-boot.dtsi ... \
        found: $(if $(u_boot_dtsi_options),"$(u_boot_dtsi_options)",nothing!))
 
 # Uncomment for debugging
@@ -190,6 +192,7 @@ dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
                 $(UBOOTINCLUDE)                                         \
                 -I$(dir $<)                                             \
+                -I$(UBOOT_DTSI_LOC)                                     \
                 -I$(srctree)/arch/$(ARCH)/dts/include                   \
                 -I$(srctree)/include                                    \
                 -D__ASSEMBLY__                                          \
@@ -328,7 +331,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
          echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
        $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
        $(DTC) -O dtb -o $@ -b 0 \
-               -i $(dir $<) $(DTC_FLAGS) \
+               -i $(dir $<) -i $(UBOOT_DTSI_LOC) $(DTC_FLAGS) \
                -d $(depfile).dtc.tmp $(dtc-tmp) || \
                (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
                ; \
--
Quoted 2 lines

2.34.1

Regards,
Simon

#12 lore raw

Re: [PATCH 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Quoted 38 lines · Sumit Garg
Quoted 26 lines · Simon Glass

Hi Sumit,

Quoted 22 lines · Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---
 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +0 -0
index 27b9437027c..4a002b0e0ca 100644
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
Quoted 10 lines

scripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 162

Quoted 7 lines
scripts/Makefile.lib +1 -5
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dir $<)u-boot.dtsi))
+UBOOT_DTSI_LOC = $(srctree)/arch/$(ARCH)/dts/

How about lower case since it is internal. Also we know it is U-Boot, so perhap ?

Quoted 2 lines

Although I just named it after *-u-boot.dtsi, I am fine with dtsi_loc too. So I will use that instead.

I was going to say lets use "uboot_dtsi_loc" so it's both clear what the variable does and for future re-syncs.

Signature · 1 line
Tom
author
#13 lore raw

Re: [PATCH 3/8] scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Quoted 40 lines · Tom Rini
Quoted 38 lines · Sumit Garg
Quoted 36 lines · Simon Glass

Hi Sumit,

Quoted 20 lines · Sumit Garg

Allow u-boot to build DTB from a different directory tree such that *-u-boot.dtsi files can be included from a common location. Currently that location is arch/$(ARCH)/dts/, so statically define that common location.

This is needed for platform owners to start building DTB files from devicetree-rebasing directory but still being able to include *-u-boot.dtsi files.

---
 scripts/Makefile.lib | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
scripts/Makefile.lib +0 -0
index 27b9437027c..4a002b0e0ca 100644

scripts/Makefile.lib cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \ · line 162

Quoted 9 lines
scripts/Makefile.lib +1 -5
@@ -159,18 +159,20 @@ cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE)     \
 ld_flags       = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
 
 # Try these files in order to find the U-Boot-specific .dtsi include file
-u_boot_dtsi_options = $(strip $(wildcard $(dir $<)$(basename $(notdir $<))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_SOC))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_CPU))-u-boot.dtsi) \
-       $(wildcard $(dir $<)$(subst $\",,$(CONFIG_SYS_VENDOR))-u-boot.dtsi) \
-       $(wildcard $(dir $<)u-boot.dtsi))
+UBOOT_DTSI_LOC = $(srctree)/arch/$(ARCH)/dts/

How about lower case since it is internal. Also we know it is U-Boot, so perhap ?

Quoted 5 lines
Quoted 2 lines

Although I just named it after *-u-boot.dtsi, I am fine with dtsi_loc too. So I will use that instead.

I was going to say lets use "uboot_dtsi_loc" so it's both clear what the variable does and for future re-syncs.

Okay that makes further sense. I will use it if I don't see any objection from Simon.

-Sumit

Quoted 3 lines

--
Tom

author
#14 lore raw

PATCH 4/8 dts: Add alternative location for upstream DTB builds

In reply to Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +11 -0
index 00c0aeff893..96396f12b67 100644
@@ -85,6 +85,17 @@ config OF_LIVE
 	  enables a live tree which is available after relocation,
 	  and can be adjusted as needed.
 
+config OF_UPSTREAM
+	bool "Enable use of devicetree imported from Linux kernel release"
+	help
+	  Traditionally, U-boot platforms used to have their custom devicetree
+	  files or copy devicetree files from Linux kernel which are hard to
+	  maintain and can usually get out-of-sync from Linux kernel. This
+	  option enables platforms to migrate to devicetree-rebasing repo where
+	  a regular sync will be maintained every major Linux kernel release
+	  cycle. However, platforms can still have some custom u-boot specific
+	  bits maintained as part of *-u-boot.dtsi files.
+
 choice
 	prompt "Provider of DTB for DT control"
 	depends on OF_CONTROL
dts/Makefile +14 -3
index 3437e54033d..8098bf8191a 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64
+else
+DEVICE_TREE_LOC := dts/arch/$(ARCH)
+endif
+else
+DEVICE_TREE_LOC := arch/$(ARCH)/dts
+endif
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(DEVICE_TREE_LOC)/$(DEVICE_TREE).dtb
 endif
 
 $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
@@ -41,7 +51,7 @@ $(DTB): arch-dtbs
 
 PHONY += arch-dtbs
 arch-dtbs:
-	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+	$(Q)$(MAKE) $(build)=$(DEVICE_TREE_LOC) dtbs
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -65,4 +75,5 @@ clean-files := dt.dtb.S
 # Let clean descend into dts directories
 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts	\
 	   ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts	\
-	   ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
+	   ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts	\
+	   ./arch/arm64 ./arch/$(ARCH)
dts/arch/arm64/Makefile new file +14 -0
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+	@:
+
+clean-files := */*.dtb */*.dtbo */*_HS
Signature · 1 line
2.34.1
#15 lore raw

Re: [PATCH 4/8] dts: Add alternative location for upstream DTB builds

Hi Sumit,

Quoted 5 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

Also add a new Makefile for arm64.

Quoted 17 lines

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..96396f12b67 100644

dts/Kconfig config OF_LIVE · line 91

Quoted 7 lines
dts/Kconfig +4 -0
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-boot platforms used to have their custom devicetree

U-Boot

(I think I mentioned this, but you thought I said U-boot...but it really is U-Boot). Perhaps grep your patches next time.

dts/Kconfig config OF_LIVE · line 97

Quoted 6 lines
dts/Kconfig +6 -0
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.

I'm a bit nervous about this. It means that boards chose between this dir of the local files. It means there is some effort to switch.

I wonder if we could default to using the rebasing thing, with boards having to 'opt out'? So this should be 'default y' ?

Quoted 9 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +0 -0
index 3437e54033d..8098bf8191a 100644

dts/Makefile ifeq ($(DEVICE_TREE),) · line 15

Quoted 6 lines
dts/Makefile +3 -0
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64

dt_dir ?

Should we move the arm64 DTs to arch/arm64 ?

What about the subdirs used in Linux?

Quoted 54 lines
dts/Makefile +8 -1
+else
+DEVICE_TREE_LOC := dts/arch/$(ARCH)
+endif
+else
+DEVICE_TREE_LOC := arch/$(ARCH)/dts
+endif
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 
 
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(DEVICE_TREE_LOC)/$(DEVICE_TREE).dtb
 endif

$(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE

dts/Makefile +3 -2
@@ -41,7 +51,7 @@ $(DTB): arch-dtbs
 
 PHONY += arch-dtbs
 arch-dtbs:
-       $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+       $(Q)$(MAKE) $(build)=$(DEVICE_TREE_LOC) dtbs
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -65,4 +75,5 @@ clean-files := dt.dtb.S
 # Let clean descend into dts directories
 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts     \
           ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts     \
-          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
+          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts        \
+          ./arch/arm64 ./arch/$(ARCH)
dts/arch/arm64/Makefile new file +14 -1
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := */*.dtb */*.dtbo */*_HS
--
Quoted 1 line

2.34.1

Regards,
Simon

author
#16 lore raw

Re: [PATCH 4/8] dts: Add alternative location for upstream DTB builds

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Sumit,

Quoted 5 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

Also add a new Makefile for arm64.

I suppose you are referring to dts/arch/arm64/Makefile which has been added by this patch.

Quoted 28 lines
Quoted 18 lines

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..96396f12b67 100644

dts/Kconfig config OF_LIVE · line 91

Quoted 7 lines
dts/Kconfig +4 -0
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-boot platforms used to have their custom devicetree

U-Boot

Quoted 2 lines

(I think I mentioned this, but you thought I said U-boot...but it really is U-Boot). Perhaps grep your patches next time.

Ah, I see. It looks like I missed that bit, and will take care of it in the next revision.

Quoted 8 lines

dts/Kconfig config OF_LIVE · line 97

Quoted 7 lines
dts/Kconfig +6 -0
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.
Quoted 5 lines

I'm a bit nervous about this. It means that boards chose between this dir of the local files. It means there is some effort to switch.

I wonder if we could default to using the rebasing thing, with boards having to 'opt out'? So this should be 'default y' ?

Ideally that should be our migration path going forward once we get enough boards migrated to use rebasing repo. But at this initial stage we have to put some effort on migrating boards to use rebasing subtree, although effort should be just adding (given DT bindings compliance) following to defconfig (see patch #7):

CONFIG_OF_UPSTREAM=y CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"

and create a mirrored copy of:
../../../devicetree-rebasing/src/arm64/amlogic/ into dts/arch/arm64/amlogic/ with modifications to add targets to dts/arch/arm64/Makefile.

I am happy to put in that effort but certainly for new board support that would like to import DT from Linux it should be the default. That stands true for the Qcom platform series for which Caleb is currently working on.

Quoted 14 lines
Quoted 14 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +0 -0
index 3437e54033d..8098bf8191a 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
Quoted 5 lines

dts/Makefile ifeq ($(DEVICE_TREE),) · line 15

Quoted 3 lines
dts/Makefile +3 -0
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64

dt_dir ?

Okay I will rename it.

Quoted 2 lines

Should we move the arm64 DTs to arch/arm64 ?

IMO, the migration path should be to use rebasing subtree via dts/arch/arm64/ and dropping DTs except *-u-boot.dtsi from arch/$(ARCH)/dts. So moving DTs from arch/arm/ to arch/arm64/ seems like a redundant change to me.

Quoted 2 lines

What about the subdirs used in Linux?

I hope I have described above regarding how subdirs are mirrored. However, have a look at patch #7 for the amlogic/ subdir example.

-Sumit

Quoted 59 lines
Quoted 55 lines
dts/Makefile +8 -1
+else
+DEVICE_TREE_LOC := dts/arch/$(ARCH)
+endif
+else
+DEVICE_TREE_LOC := arch/$(ARCH)/dts
+endif
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 
 
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(DEVICE_TREE_LOC)/$(DEVICE_TREE).dtb
 endif

$(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE

dts/Makefile +3 -2
@@ -41,7 +51,7 @@ $(DTB): arch-dtbs
 
 PHONY += arch-dtbs
 arch-dtbs:
-       $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+       $(Q)$(MAKE) $(build)=$(DEVICE_TREE_LOC) dtbs
 
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
@@ -65,4 +75,5 @@ clean-files := dt.dtb.S
 # Let clean descend into dts directories
 subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts     \
           ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts     \
-          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
+          ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts        \
+          ./arch/arm64 ./arch/$(ARCH)
dts/arch/arm64/Makefile new file +14 -1
new file mode 100644
index 00000000000..16e9fea622d
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+include $(srctree)/scripts/Makefile.dts
+
+targets += $(dtb-y)
+
+# Add any required device tree compiler flags here
+DTC_FLAGS += -a 0x8
+
+PHONY += dtbs
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+       @:
+
+clean-files := */*.dtb */*.dtbo */*_HS
--
Quoted 1 line

2.34.1

Regards,
Simon

#17 lore raw

Re: [PATCH 4/8] dts: Add alternative location for upstream DTB builds

Hi Sumit,

Quoted 14 lines · Sumit Garg

Hi Simon,

Quoted 10 lines · Simon Glass

Hi Sumit,

Quoted 5 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

Quoted 4 lines
Quoted 1 line

Also add a new Makefile for arm64.

I suppose you are referring to dts/arch/arm64/Makefile which has been added by this patch.

Yes, I just mean that you should mention this in the commit message

Quoted 63 lines
Quoted 29 lines
Quoted 19 lines

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..96396f12b67 100644

dts/Kconfig config OF_LIVE · line 91

Quoted 7 lines
dts/Kconfig +4 -0
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-boot platforms used to have their custom devicetree

U-Boot

Quoted 2 lines

(I think I mentioned this, but you thought I said U-boot...but it really is U-Boot). Perhaps grep your patches next time.

Ah, I see. It looks like I missed that bit, and will take care of it in the next revision.

Quoted 8 lines

dts/Kconfig config OF_LIVE · line 97

Quoted 7 lines
dts/Kconfig +6 -0
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.
Quoted 5 lines

I'm a bit nervous about this. It means that boards chose between this dir of the local files. It means there is some effort to switch.

I wonder if we could default to using the rebasing thing, with boards having to 'opt out'? So this should be 'default y' ?

Ideally that should be our migration path going forward once we get enough boards migrated to use rebasing repo. But at this initial stage we have to put some effort on migrating boards to use rebasing subtree, although effort should be just adding (given DT bindings compliance) following to defconfig (see patch #7):

CONFIG_OF_UPSTREAM=y CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"

and create a mirrored copy of:
../../../devicetree-rebasing/src/arm64/amlogic/ into dts/arch/arm64/amlogic/ with modifications to add targets to dts/arch/arm64/Makefile.

Quoted 4 lines

I am happy to put in that effort but certainly for new board support that would like to import DT from Linux it should be the default. That stands true for the Qcom platform series for which Caleb is currently working on.

The problem I see is that this is board-by-board, so will never happen. Changing one board (e.g. rockpro64-rk3399) typically involves changing the .dtsi files it includes (e.g. rk3399.dtsi) so it is hard/impossible to do one board without doing all.

So this is why I believe the setting should be on an SoC basis, not on a board basis.

Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +0 -0
index 3437e54033d..8098bf8191a 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
Quoted 5 lines

dts/Makefile ifeq ($(DEVICE_TREE),) · line 15

Quoted 3 lines
dts/Makefile +3 -0
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64

dt_dir ?

Okay I will rename it.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Should we move the arm64 DTs to arch/arm64 ?

IMO, the migration path should be to use rebasing subtree via dts/arch/arm64/ and dropping DTs except *-u-boot.dtsi from arch/$(ARCH)/dts. So moving DTs from arch/arm/ to arch/arm64/ seems like a redundant change to me.

I can see that argument, but having two different directory structures would be confusing.

Quoted 6 lines
Quoted 3 lines

What about the subdirs used in Linux?

I hope I have described above regarding how subdirs are mirrored. However, have a look at patch #7 for the amlogic/ subdir example.

OK

Regards,
Simon

author
#18 lore raw

Re: [PATCH 4/8] dts: Add alternative location for upstream DTB builds

Quoted 18 lines · Simon Glass

Hi Sumit,

Quoted 14 lines · Sumit Garg

Hi Simon,

Quoted 10 lines · Simon Glass

Hi Sumit,

Quoted 5 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Also add a new Makefile for arm64.

I suppose you are referring to dts/arch/arm64/Makefile which has been added by this patch.

Yes, I just mean that you should mention this in the commit message

Okay, I will append the commit message.

Quoted 68 lines
Quoted 63 lines
Quoted 29 lines
Quoted 19 lines

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..96396f12b67 100644

dts/Kconfig config OF_LIVE · line 91

Quoted 7 lines
dts/Kconfig +4 -0
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-boot platforms used to have their custom devicetree

U-Boot

Quoted 2 lines

(I think I mentioned this, but you thought I said U-boot...but it really is U-Boot). Perhaps grep your patches next time.

Ah, I see. It looks like I missed that bit, and will take care of it in the next revision.

Quoted 8 lines

dts/Kconfig config OF_LIVE · line 97

Quoted 7 lines
dts/Kconfig +6 -0
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.
Quoted 5 lines

I'm a bit nervous about this. It means that boards chose between this dir of the local files. It means there is some effort to switch.

I wonder if we could default to using the rebasing thing, with boards having to 'opt out'? So this should be 'default y' ?

Ideally that should be our migration path going forward once we get enough boards migrated to use rebasing repo. But at this initial stage we have to put some effort on migrating boards to use rebasing subtree, although effort should be just adding (given DT bindings compliance) following to defconfig (see patch #7):

CONFIG_OF_UPSTREAM=y CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"

and create a mirrored copy of:
../../../devicetree-rebasing/src/arm64/amlogic/ into dts/arch/arm64/amlogic/ with modifications to add targets to dts/arch/arm64/Makefile.

Quoted 4 lines

I am happy to put in that effort but certainly for new board support that would like to import DT from Linux it should be the default. That stands true for the Qcom platform series for which Caleb is currently working on.

Quoted 7 lines

The problem I see is that this is board-by-board, so will never happen. Changing one board (e.g. rockpro64-rk3399) typically involves changing the .dtsi files it includes (e.g. rk3399.dtsi) so it is hard/impossible to do one board without doing all.

So this is why I believe the setting should be on an SoC basis, not on a board basis.

Sure, I will enable OF_UPSTREAM on a per SoC basis.

Quoted 27 lines
Quoted 27 lines
Quoted 16 lines
Quoted 16 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +0 -0
index 3437e54033d..8098bf8191a 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
Quoted 5 lines

dts/Makefile ifeq ($(DEVICE_TREE),) · line 15

Quoted 3 lines
dts/Makefile +3 -0
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64

dt_dir ?

Okay I will rename it.

Quoted 2 lines

Should we move the arm64 DTs to arch/arm64 ?

Quoted 7 lines
Quoted 4 lines

IMO, the migration path should be to use rebasing subtree via dts/arch/arm64/ and dropping DTs except *-u-boot.dtsi from arch/$(ARCH)/dts. So moving DTs from arch/arm/ to arch/arm64/ seems like a redundant change to me.

I can see that argument, but having two different directory structures would be confusing.

I can see your point but U-Boot arch arm64 code is also contained in arch/arm/. However, I would suggest first migrating to DT rebasing and then we can do a move for the leftovers (*-u-boot.dtsi and such). A double move won't add much value.

-Sumit

Quoted 12 lines
Quoted 7 lines
Quoted 4 lines

What about the subdirs used in Linux?

I hope I have described above regarding how subdirs are mirrored. However, have a look at patch #7 for the amlogic/ subdir example.

OK

Regards,
Simon

#19 lore raw

Re: [PATCH 4/8] dts: Add alternative location for upstream DTB builds

Hi Sumit,

Quoted 140 lines · Sumit Garg
Quoted 18 lines · Simon Glass

Hi Sumit,

Quoted 14 lines · Sumit Garg

Hi Simon,

Quoted 10 lines · Simon Glass

Hi Sumit,

Quoted 5 lines · Sumit Garg

Allow platform owners to mirror devicetree files from devitree-rebasing directory into dts/arch/$(ARCH) (special case for dts/arch/arm64). Then build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts directory.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Also add a new Makefile for arm64.

I suppose you are referring to dts/arch/arm64/Makefile which has been added by this patch.

Yes, I just mean that you should mention this in the commit message

Okay, I will append the commit message.

Quoted 68 lines
Quoted 63 lines
Quoted 29 lines
Quoted 19 lines

This will help easy migration for platforms which currently are compliant with upstream Linux kernel devicetree files.

---
 dts/Kconfig             | 11 +++++++++++
 dts/Makefile            | 17 ++++++++++++++---
 dts/arch/arm64/Makefile | 14 ++++++++++++++
 3 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 dts/arch/arm64/Makefile
dts/Kconfig +0 -0
index 00c0aeff893..96396f12b67 100644

dts/Kconfig config OF_LIVE · line 91

Quoted 7 lines
dts/Kconfig +4 -0
@@ -85,6 +85,17 @@ config OF_LIVE
          enables a live tree which is available after relocation,
          and can be adjusted as needed.
 
+config OF_UPSTREAM
+       bool "Enable use of devicetree imported from Linux kernel release"
+       help
+         Traditionally, U-boot platforms used to have their custom devicetree

U-Boot

Quoted 2 lines

(I think I mentioned this, but you thought I said U-boot...but it really is U-Boot). Perhaps grep your patches next time.

Ah, I see. It looks like I missed that bit, and will take care of it in the next revision.

Quoted 8 lines

dts/Kconfig config OF_LIVE · line 97

Quoted 7 lines
dts/Kconfig +6 -0
+         files or copy devicetree files from Linux kernel which are hard to
+         maintain and can usually get out-of-sync from Linux kernel. This
+         option enables platforms to migrate to devicetree-rebasing repo where
+         a regular sync will be maintained every major Linux kernel release
+         cycle. However, platforms can still have some custom u-boot specific
+         bits maintained as part of *-u-boot.dtsi files.
Quoted 5 lines

I'm a bit nervous about this. It means that boards chose between this dir of the local files. It means there is some effort to switch.

I wonder if we could default to using the rebasing thing, with boards having to 'opt out'? So this should be 'default y' ?

Ideally that should be our migration path going forward once we get enough boards migrated to use rebasing repo. But at this initial stage we have to put some effort on migrating boards to use rebasing subtree, although effort should be just adding (given DT bindings compliance) following to defconfig (see patch #7):

CONFIG_OF_UPSTREAM=y CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"

and create a mirrored copy of:
../../../devicetree-rebasing/src/arm64/amlogic/ into dts/arch/arm64/amlogic/ with modifications to add targets to dts/arch/arm64/Makefile.

Quoted 4 lines

I am happy to put in that effort but certainly for new board support that would like to import DT from Linux it should be the default. That stands true for the Qcom platform series for which Caleb is currently working on.

Quoted 7 lines

The problem I see is that this is board-by-board, so will never happen. Changing one board (e.g. rockpro64-rk3399) typically involves changing the .dtsi files it includes (e.g. rk3399.dtsi) so it is hard/impossible to do one board without doing all.

So this is why I believe the setting should be on an SoC basis, not on a board basis.

Sure, I will enable OF_UPSTREAM on a per SoC basis.

Quoted 32 lines
Quoted 31 lines
Quoted 16 lines
Quoted 16 lines
dts/Kconfig +1 -0
+
 choice
        prompt "Provider of DTB for DT control"
        depends on OF_CONTROL
dts/Makefile +0 -0
index 3437e54033d..8098bf8191a 100644
@@ -10,10 +10,20 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
Quoted 5 lines

dts/Makefile ifeq ($(DEVICE_TREE),) · line 15

Quoted 3 lines
dts/Makefile +3 -0
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+DEVICE_TREE_LOC := dts/arch/arm64

dt_dir ?

Okay I will rename it.

Quoted 2 lines

Should we move the arm64 DTs to arch/arm64 ?

IMO, the migration path should be to use rebasing subtree via dts/arch/arm64/ and dropping DTs except *-u-boot.dtsi from arch/$(ARCH)/dts. So moving DTs from arch/arm/ to arch/arm64/ seems like a redundant change to me.

Quoted 7 lines
Quoted 2 lines

I can see that argument, but having two different directory structures would be confusing.

I can see your point but U-Boot arch arm64 code is also contained in arch/arm/. However, I would suggest first migrating to DT rebasing and then we can do a move for the leftovers (*-u-boot.dtsi and such). A double move won't add much value.

OK, so long as you are planning to do that next?

Regards,
Simon

author
#20 lore raw

PATCH 5/8 doc: devicetree: Updates for devicetree-rebasing subtree

In reply to Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

---
 doc/develop/devicetree/control.rst | 108 +++++++++++++++++++++++------
 1 file changed, 86 insertions(+), 22 deletions(-)
doc/develop/devicetree/control.rst +86 -22
index cbb65c9b177..12ef55ed368 100644
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: GPL-2.0+
 .. sectionauthor:: Copyright 2011 The Chromium OS Authors
+.. Copyright 2023 Linaro Ltd.
 
 Devicetree Control in U-Boot
 ============================
@@ -22,12 +23,11 @@ for three reasons:
   hierarchical format
 - It is fairly efficient to read incrementally
 
-The arch/<arch>/dts directories contains a Makefile for building the devicetree
-blob and embedding it in the U-Boot image. This is useful since it allows
-U-Boot to configure itself according to what it finds there. If you have
-a number of similar boards with different peripherals, you can describe
-the features of each board in the devicetree file, and have a single
-generic source base.
+The U-boot Makefile infrastructure allows for building the devicetree blob
+and embedding it in the U-Boot image. This is useful since it allows U-Boot
+to configure itself according to what it finds there. If you have a number
+of similar boards with different peripherals, you can describe the features
+of each board in the devicetree file, and have a single generic source base.
 
 To enable this feature, add CONFIG_OF_CONTROL to your board config file.
 
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings
+at every Linux kernel major release or intermideate release candidates.
+
+In order to maintain devicetree files sync, U-boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash
+
+You may find that the `devicetee-rebasing/` sub-directory has a suitable
+devicetree file for your board. Look in `devicetree-rebasing/src/<arch>/`.
 
 If not you might find other boards with suitable files that you can
 modify to your needs. Look in the board directories for files with a
@@ -81,18 +94,21 @@ Failing that, you could write one from scratch yourself!
 Configuration
 -------------
 
-Use::
+Traditionally, U-boot placed copies of devicetree source files from Linux
+kernel into `arch/<arch>/dts/<name>.dts` which can be selected via::
 
-   #define CONFIG_DEFAULT_DEVICE_TREE	"<name>"
+    #define CONFIG_DEFAULT_DEVICE_TREE	"<name>"
 
-to set the filename of the devicetree source. Then put your devicetree
-file into::
+However, it has become combersome over time for each SoC/board maintainer to
+keep devicetree files in sync with Linux kernel. Thereby, SoC/board maintainers
+are encouraged to migrate to use mirrored copies from `devicetree-rebasing/`
+into `dts/arch/<arch>/<vendor>` via::
 
-   arch/<arch>/dts/<name>.dts
+    #define CONFIG_OF_UPSTREAM=y
+    #define CONFIG_DEFAULT_DEVICE_TREE	"<vendor>/<name>"
 
-This should include your CPU or SOC's devicetree file, placed in
-`arch/<arch>/dts`, and then make any adjustments required using a u-boot-dtsi
-file for your board.
+This should include your CPU or SOC's devicetree file. On top of that any U-boot
+specific tweaks (see: dttweaks_) can be made for your board.
 
 If CONFIG_OF_EMBED is defined, then it will be picked up and built into
 the U-Boot image (including u-boot.bin). This is suitable for debugging
@@ -156,8 +172,9 @@ ways:
 Adding tweaks for U-Boot
 ------------------------
 
-It is strongly recommended that devicetree files in U-Boot are an exact copy of
-those in Linux, so that it is easy to sync them up from time to time.
+With devicetee-rebasing Git subtree, it is ensured that devicetree files in
+U-Boot are an exact copy of those in Linux kernel via mirroring into
+`dts/arch/<arch>/<vendor>`.
 
 U-Boot is of course a very different project from Linux, e.g. it operates under
 much more restrictive memory and code-size constraints. Where Linux may use a
@@ -170,8 +187,8 @@ constraints are even more extreme and the devicetree is shrunk to remove
 unwanted nodes, or even turned into C code to avoid access overhead.
 
 U-Boot automatically looks for and includes a file with updates to the standard
-devicetree for your board, searching for them in the same directory as the
-main file, in this order::
+devicetree for your board, searching for them in `arch/<arch>/dts/` in this
+order::
 
    <orig_filename>-u-boot.dtsi
    <CONFIG_SYS_SOC>-u-boot.dtsi
@@ -200,6 +217,52 @@ to specify a list of .dtsi files that will also be included when
 building .dtb files.
 
 
+Devicetree bindings schema checks
+---------------------------------
+
+With devicetee-rebasing Git subtree, the devicetree bindings are also regularly
+synced with Linux kernel as `devicetree-rebasing/Bindings/` sub-directory. This
+allows U-boot to run devicetree bindings schema checks which will bring
+compliance to U-boot core/drivers regarding usage of devicetree.
+
+Dependencies
+~~~~~~~~~~~~
+
+The DT schema project must be installed in order to validate the DT schema
+binding documents and validate DTS files using the DT schema. The DT schema
+project can be installed with pip::
+
+    pip3 install dtschema
+
+Note that 'dtschema' installation requires 'swig' and Python development files
+installed first. On Debian/Ubuntu systems::
+
+    apt install swig python3-dev
+
+Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
+installed. Ensure they are in your PATH (~/.local/bin by default).
+
+Recommended is also to install yamllint (used by dtschema when present).
+
+Running checks
+~~~~~~~~~~~~~~
+
+In order to perform validation of DTB files, use the ``dtbs_check`` target::
+
+    make dtbs_check
+
+It is also possible to run checks with a subset of matching schema files by
+setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or
+patterns (partial match of a fixed string). Each file or pattern should be
+separated by ':'.
+
+::
+
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
+    make dtbs_check DT_SCHEMA_FILES=/gpio/
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml
+
+
 Relocation, SPL and TPL
 -----------------------
 
@@ -261,8 +324,9 @@ used it before Linux (e.g. snow). The two projects developed in parallel
 and there are still some differences in the bindings for certain boards.
 While there has been discussion of having a separate repository for devicetree
 files, in practice the Linux kernel Git repository has become the place where
-these are stored, with U-Boot taking copies and adding tweaks with u-boot.dtsi
-files.
+these are stored, with U-Boot taking copies via devicetree-rebasing repo
+(see: dtrepo_) and adding tweaks with u-boot.dtsi files.
 
 .. _dtspec: https://www.devicetree.org/specifications/
 .. _dtlist: https://www.spinics.net/lists/devicetree-compiler/
+.. _dtrepo: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
Signature · 1 line
2.34.1
#21 lore raw

Re: [PATCH 5/8] doc: devicetree: Updates for devicetree-rebasing subtree

Hi Sumit,

Quoted 185 lines · Sumit Garg

Encourage SoC/board maintainers to migrate to using devicetree-rebasing subtree and maintain a regular sync with Linux kernel devicetree files and bindings.

Along with that add documentation regarding how to run DT bindings schema checks.

---
 doc/develop/devicetree/control.rst | 108 +++++++++++++++++++++++------
 1 file changed, 86 insertions(+), 22 deletions(-)
doc/develop/devicetree/control.rst +86 -23
index cbb65c9b177..12ef55ed368 100644
@@ -1,5 +1,6 @@
 .. SPDX-License-Identifier: GPL-2.0+
 .. sectionauthor:: Copyright 2011 The Chromium OS Authors
+.. Copyright 2023 Linaro Ltd.
 
 Devicetree Control in U-Boot
 ============================
@@ -22,12 +23,11 @@ for three reasons:
   hierarchical format
 - It is fairly efficient to read incrementally
 
-The arch/<arch>/dts directories contains a Makefile for building the devicetree
-blob and embedding it in the U-Boot image. This is useful since it allows
-U-Boot to configure itself according to what it finds there. If you have
-a number of similar boards with different peripherals, you can describe
-the features of each board in the devicetree file, and have a single
-generic source base.
+The U-boot Makefile infrastructure allows for building the devicetree blob
+and embedding it in the U-Boot image. This is useful since it allows U-Boot
+to configure itself according to what it finds there. If you have a number
+of similar boards with different peripherals, you can describe the features
+of each board in the devicetree file, and have a single generic source base.
 
 To enable this feature, add CONFIG_OF_CONTROL to your board config file.
 
@@ -68,8 +68,21 @@ a binary file. U-Boot adds its own `fdtgrep` for creating subsets of the file.
 Where do I get a devicetree file for my board?
 ----------------------------------------------
 
-You may find that the Linux kernel has a suitable file. Look in the
-kernel source in arch/<arch>/boot/dts.
+Linux kernel Git repository has been the place where devicetree files along
+with devicetree bindings are stored and maintained. There is devicetee-rebasing
+(dtrepo_) which maintains a forked copy of devicetree files along with bindings
+at every Linux kernel major release or intermideate release candidates.
+
+In order to maintain devicetree files sync, U-boot maintains a Git subtree for
+devicetee-rebasing repo as `devicetee-rebasing/` sub-directory. It is regularly
+kept updated with every new kernel major release via subtree pull as follows::
+
+    git subtree pull --prefix devicetree-rebasing \
+        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
+        <release-tag> --squash
+
+You may find that the `devicetee-rebasing/` sub-directory has a suitable
+devicetree file for your board. Look in `devicetree-rebasing/src/<arch>/`.
 
 If not you might find other boards with suitable files that you can
 modify to your needs. Look in the board directories for files with a
@@ -81,18 +94,21 @@ Failing that, you could write one from scratch yourself!
 Configuration
 -------------
 
-Use::
+Traditionally, U-boot placed copies of devicetree source files from Linux
+kernel into `arch/<arch>/dts/<name>.dts` which can be selected via::
 
-   #define CONFIG_DEFAULT_DEVICE_TREE  "<name>"
+    #define CONFIG_DEFAULT_DEVICE_TREE "<name>"
 
-to set the filename of the devicetree source. Then put your devicetree
-file into::
+However, it has become combersome over time for each SoC/board maintainer to
+keep devicetree files in sync with Linux kernel. Thereby, SoC/board maintainers
+are encouraged to migrate to use mirrored copies from `devicetree-rebasing/`
+into `dts/arch/<arch>/<vendor>` via::
 
-   arch/<arch>/dts/<name>.dts
+    #define CONFIG_OF_UPSTREAM=y
+    #define CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"
 
-This should include your CPU or SOC's devicetree file, placed in
-`arch/<arch>/dts`, and then make any adjustments required using a u-boot-dtsi
-file for your board.
+This should include your CPU or SOC's devicetree file. On top of that any U-boot
+specific tweaks (see: dttweaks_) can be made for your board.
 
 If CONFIG_OF_EMBED is defined, then it will be picked up and built into
 the U-Boot image (including u-boot.bin). This is suitable for debugging
@@ -156,8 +172,9 @@ ways:
 Adding tweaks for U-Boot
 ------------------------
 
-It is strongly recommended that devicetree files in U-Boot are an exact copy of
-those in Linux, so that it is easy to sync them up from time to time.
+With devicetee-rebasing Git subtree, it is ensured that devicetree files in
+U-Boot are an exact copy of those in Linux kernel via mirroring into
+`dts/arch/<arch>/<vendor>`.
 
 U-Boot is of course a very different project from Linux, e.g. it operates under
 much more restrictive memory and code-size constraints. Where Linux may use a
@@ -170,8 +187,8 @@ constraints are even more extreme and the devicetree is shrunk to remove
 unwanted nodes, or even turned into C code to avoid access overhead.
 
 U-Boot automatically looks for and includes a file with updates to the standard
-devicetree for your board, searching for them in the same directory as the
-main file, in this order::
+devicetree for your board, searching for them in `arch/<arch>/dts/` in this
+order::
 
    <orig_filename>-u-boot.dtsi
    <CONFIG_SYS_SOC>-u-boot.dtsi
@@ -200,6 +217,52 @@ to specify a list of .dtsi files that will also be included when
 building .dtb files.
 
 
+Devicetree bindings schema checks
+---------------------------------
+
+With devicetee-rebasing Git subtree, the devicetree bindings are also regularly
+synced with Linux kernel as `devicetree-rebasing/Bindings/` sub-directory. This
+allows U-boot to run devicetree bindings schema checks which will bring
+compliance to U-boot core/drivers regarding usage of devicetree.
+
+Dependencies
+~~~~~~~~~~~~
+
+The DT schema project must be installed in order to validate the DT schema
+binding documents and validate DTS files using the DT schema. The DT schema
+project can be installed with pip::
+
+    pip3 install dtschema
+
+Note that 'dtschema' installation requires 'swig' and Python development files
+installed first. On Debian/Ubuntu systems::
+
+    apt install swig python3-dev
+
+Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
+installed. Ensure they are in your PATH (~/.local/bin by default).
+
+Recommended is also to install yamllint (used by dtschema when present).
+
+Running checks
+~~~~~~~~~~~~~~
+
+In order to perform validation of DTB files, use the ``dtbs_check`` target::
+
+    make dtbs_check
+
+It is also possible to run checks with a subset of matching schema files by
+setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or
+patterns (partial match of a fixed string). Each file or pattern should be
+separated by ':'.
+
+::
+
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
+    make dtbs_check DT_SCHEMA_FILES=/gpio/
+    make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml
+
+
 Relocation, SPL and TPL
 -----------------------
 
@@ -261,8 +324,9 @@ used it before Linux (e.g. snow). The two projects developed in parallel
 and there are still some differences in the bindings for certain boards.
 While there has been discussion of having a separate repository for devicetree
 files, in practice the Linux kernel Git repository has become the place where
-these are stored, with U-Boot taking copies and adding tweaks with u-boot.dtsi
-files.
+these are stored, with U-Boot taking copies via devicetree-rebasing repo
+(see: dtrepo_) and adding tweaks with u-boot.dtsi files.
 
 .. _dtspec: https://www.devicetree.org/specifications/
 .. _dtlist: https://www.spinics.net/lists/devicetree-compiler/
+.. _dtrepo: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
--
Quoted 2 lines

2.34.1

OK, ignore my comment about docs.

Regards,
Simon

author
#22 lore raw

PATCH 6/8 MAINTAINERS: Add myself as devicetree-rebasing maintainer

In reply to Sumit Garg
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 969514468cb..253092c345c 100644
@@ -951,6 +951,12 @@ F:	cmd/cyclic.c
 F:	common/cyclic.c
 F:	include/cyclic.h
 
+DEVICETREE REBASING SUBTREE
+M:	Sumit Garg <[email protected]>
+S:	Maintained
+F:	devicetree-rebasing/
+F:	dts/arch/
+
 DFU
 M:	Lukasz Majewski <[email protected]>
 M:	Mattijs Korpershoek <[email protected]>
Signature · 1 line
2.34.1
Reviewed-by on v1 6/8
#23 lore raw

Re: [PATCH 6/8] MAINTAINERS: Add myself as devicetree-rebasing maintainer

Quoted 24 lines · Sumit Garg
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -1
index 969514468cb..253092c345c 100644
@@ -951,6 +951,12 @@ F: cmd/cyclic.c
 F:     common/cyclic.c
 F:     include/cyclic.h
 
+DEVICETREE REBASING SUBTREE
+M:     Sumit Garg <[email protected]>
+S:     Maintained
+F:     devicetree-rebasing/
+F:     dts/arch/
+
 DFU
 M:     Lukasz Majewski <[email protected]>
 M:     Mattijs Korpershoek <[email protected]>
--
Quoted 2 lines

2.34.1

author
#24 lore raw

PATCH 7/8 dts: meson-gxbb: Switch to using upstream DT

In reply to Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---
 configs/nanopi-k2_defconfig           | 3 ++-
 configs/odroid-c2_defconfig           | 3 ++-
 configs/p200_defconfig                | 3 ++-
 configs/p201_defconfig                | 3 ++-
 configs/videostrong-kii-pro_defconfig | 3 ++-
 configs/wetek-hub_defconfig           | 3 ++-
 configs/wetek-play2_defconfig         | 3 ++-
 dts/arch/arm64/Makefile               | 9 +++++++++
 dts/arch/arm64/amlogic                | 1 +
 9 files changed, 24 insertions(+), 7 deletions(-)
 create mode 120000 dts/arch/arm64/amlogic
configs/nanopi-k2_defconfig +2 -1
index 41dbf7981f8..3db296916e9 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/odroid-c2_defconfig +2 -1
index 5f9f323e06e..65857ff478c 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p200_defconfig +2 -1
index cd579ef5f14..c1792db51fd 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p200"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p200"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p201_defconfig +2 -1
index b2f0a0ccdb4..202e1da5bcc 100644
@@ -7,7 +7,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p201"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p201"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/videostrong-kii-pro_defconfig +2 -1
index 3eda8f14a21..d09333d3b96 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-kii-pro"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-kii-pro"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-hub_defconfig +2 -1
index fd92b041e73..73f3d4aad5d 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-hub"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-play2_defconfig +2 -1
index b887419a6ba..26f57b4214a 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-play2"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xc81004c0
dts/arch/arm64/Makefile +9 -0
index 16e9fea622d..d548584cf5c 100644
@@ -1,5 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0+
 
+dtb-$(CONFIG_ARCH_MESON) += \
+	amlogic/meson-gxbb-kii-pro.dtb \
+	amlogic/meson-gxbb-nanopi-k2.dtb \
+	amlogic/meson-gxbb-odroidc2.dtb \
+	amlogic/meson-gxbb-p200.dtb \
+	amlogic/meson-gxbb-p201.dtb \
+	amlogic/meson-gxbb-wetek-hub.dtb \
+	amlogic/meson-gxbb-wetek-play2.dtb
+
 include $(srctree)/scripts/Makefile.dts
 
 targets += $(dtb-y)
dts/arch/arm64/amlogic new file +1 -0
new file mode 120000
index 00000000000..73f7c3e7bd0
@@ -0,0 +1 @@
+../../../devicetree-rebasing/src/arm64/amlogic/
\ No newline at end of file
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 7/8
#25 lore raw

Re: [PATCH 7/8] dts: meson-gxbb: Switch to using upstream DT

Quoted 146 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---
  configs/nanopi-k2_defconfig           | 3 ++-
  configs/odroid-c2_defconfig           | 3 ++-
  configs/p200_defconfig                | 3 ++-
  configs/p201_defconfig                | 3 ++-
  configs/videostrong-kii-pro_defconfig | 3 ++-
  configs/wetek-hub_defconfig           | 3 ++-
  configs/wetek-play2_defconfig         | 3 ++-
  dts/arch/arm64/Makefile               | 9 +++++++++
  dts/arch/arm64/amlogic                | 1 +
  9 files changed, 24 insertions(+), 7 deletions(-)

create mode 120000 dts/arch/arm64/amlogic

configs/nanopi-k2_defconfig +2 -1
index 41dbf7981f8..3db296916e9 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/odroid-c2_defconfig +2 -1
index 5f9f323e06e..65857ff478c 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p200_defconfig +2 -1
index cd579ef5f14..c1792db51fd 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p200"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p200"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p201_defconfig +2 -1
index b2f0a0ccdb4..202e1da5bcc 100644
@@ -7,7 +7,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p201"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p201"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/videostrong-kii-pro_defconfig +2 -1
index 3eda8f14a21..d09333d3b96 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-kii-pro"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-kii-pro"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-hub_defconfig +2 -1
index fd92b041e73..73f3d4aad5d 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-hub"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-play2_defconfig +2 -1
index b887419a6ba..26f57b4214a 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-play2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
dts/arch/arm64/Makefile +9 -0
index 16e9fea622d..d548584cf5c 100644
@@ -1,5 +1,14 @@
  # SPDX-License-Identifier: GPL-2.0+
 
+dtb-$(CONFIG_ARCH_MESON) += \
+	amlogic/meson-gxbb-kii-pro.dtb \
+	amlogic/meson-gxbb-nanopi-k2.dtb \
+	amlogic/meson-gxbb-odroidc2.dtb \
+	amlogic/meson-gxbb-p200.dtb \
+	amlogic/meson-gxbb-p201.dtb \
+	amlogic/meson-gxbb-wetek-hub.dtb \
+	amlogic/meson-gxbb-wetek-play2.dtb
+
  include $(srctree)/scripts/Makefile.dts
 
  targets += $(dtb-y)
dts/arch/arm64/amlogic new file +0 -0
new file mode 120000
index 00000000000..73f7c3e7bd0

dts/arch/arm64/amlogic line 1

Quoted 2 lines
dts/arch/arm64/amlogic new file +1 -0
@@ -0,0 +1 @@
+../../../devicetree-rebasing/src/arm64/amlogic/
\ No newline at end of file

Note: with https://lore.kernel.org/all/[email protected]/ merged it could be be extended to GXL/GXM aswell

Thanks,
Neil

author
#26 lore raw

Re: [PATCH 7/8] dts: meson-gxbb: Switch to using upstream DT

Quoted 141 lines · On Wed, 20 Dec 2023 at 16:23, <[email protected]> wrote:
Quoted 139 lines · Sumit Garg

Although there were still some variations in board DTS files based on meson-gxbb SoC but I think those were minor differences from upstream and shouldn't impact boot on these devices.

So switch to upstream DT via mirroring amlogic/ directory from devicetree-rebasing/src/arm64/amlogic/ directory. And thereby directly building DTB from there including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

---
  configs/nanopi-k2_defconfig           | 3 ++-
  configs/odroid-c2_defconfig           | 3 ++-
  configs/p200_defconfig                | 3 ++-
  configs/p201_defconfig                | 3 ++-
  configs/videostrong-kii-pro_defconfig | 3 ++-
  configs/wetek-hub_defconfig           | 3 ++-
  configs/wetek-play2_defconfig         | 3 ++-
  dts/arch/arm64/Makefile               | 9 +++++++++
  dts/arch/arm64/amlogic                | 1 +
  9 files changed, 24 insertions(+), 7 deletions(-)

create mode 120000 dts/arch/arm64/amlogic

configs/nanopi-k2_defconfig +2 -1
index 41dbf7981f8..3db296916e9 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-nanopi-k2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-nanopi-k2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/odroid-c2_defconfig +2 -1
index 5f9f323e06e..65857ff478c 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p200_defconfig +2 -1
index cd579ef5f14..c1792db51fd 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p200"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p200"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/p201_defconfig +2 -1
index b2f0a0ccdb4..202e1da5bcc 100644
@@ -7,7 +7,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-p201"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-p201"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/videostrong-kii-pro_defconfig +2 -1
index 3eda8f14a21..d09333d3b96 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-kii-pro"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-kii-pro"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-hub_defconfig +2 -1
index fd92b041e73..73f3d4aad5d 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-hub"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
configs/wetek-play2_defconfig +2 -1
index b887419a6ba..26f57b4214a 100644
@@ -6,7 +6,8 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
  CONFIG_ENV_SIZE=0x2000
  CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-wetek-play2"
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_DEBUG_UART_BASE=0xc81004c0
dts/arch/arm64/Makefile +9 -0
index 16e9fea622d..d548584cf5c 100644
@@ -1,5 +1,14 @@
  # SPDX-License-Identifier: GPL-2.0+
 
+dtb-$(CONFIG_ARCH_MESON) += \
+     amlogic/meson-gxbb-kii-pro.dtb \
+     amlogic/meson-gxbb-nanopi-k2.dtb \
+     amlogic/meson-gxbb-odroidc2.dtb \
+     amlogic/meson-gxbb-p200.dtb \
+     amlogic/meson-gxbb-p201.dtb \
+     amlogic/meson-gxbb-wetek-hub.dtb \
+     amlogic/meson-gxbb-wetek-play2.dtb
+
  include $(srctree)/scripts/Makefile.dts
 
Quoted 12 lines

dts/arch/arm64/amlogic line 1

Quoted 9 lines
dts/arch/arm64/Makefile +0 -0
  targets += $(dtb-y)
dts/arch/arm64/amlogic new file +1 -0
new file mode 120000
index 00000000000..73f7c3e7bd0
@@ -0,0 +1 @@
+../../../devicetree-rebasing/src/arm64/amlogic/
\ No newline at end of file

Thanks.

Quoted 1 line

Note: with https://lore.kernel.org/all/[email protected]/ merged it could be be extended to GXL/GXM aswell

Sure, I will convert GXL/GXM too once your PR is merged and this series lands.

-Sumit

Quoted 3 lines

Thanks,
Neil

author
#27 lore raw

PATCH 8/8 dts: meson-gxbb: Drop redundant devicetree files

In reply to Sumit Garg

Since meson-gxbb based boards switched to using upstream DT, so drop redundant files from arch/arm/dts directory. Only *-u-boot.dtsi files kept in arch/arm/dts directory for these boards.

---
 arch/arm/dts/Makefile                   |   8 -
 arch/arm/dts/meson-gxbb-kii-pro.dts     | 140 ----
 arch/arm/dts/meson-gxbb-nanopi-k2.dts   | 415 ------------
 arch/arm/dts/meson-gxbb-odroidc2.dts    | 418 ------------
 arch/arm/dts/meson-gxbb-p200.dts        | 100 ---
 arch/arm/dts/meson-gxbb-p201.dts        |  26 -
 arch/arm/dts/meson-gxbb-p20x.dtsi       | 250 -------
 arch/arm/dts/meson-gxbb-wetek-hub.dts   |  58 --
 arch/arm/dts/meson-gxbb-wetek-play2.dts | 119 ----
 arch/arm/dts/meson-gxbb-wetek.dtsi      | 292 --------
 arch/arm/dts/meson-gxbb.dtsi            | 856 ------------------------
 11 files changed, 2682 deletions(-)
 delete mode 100644 arch/arm/dts/meson-gxbb-kii-pro.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p200.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p201.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-p20x.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 delete mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi
 delete mode 100644 arch/arm/dts/meson-gxbb.dtsi
arch/arm/dts/Makefile +0 -8
index 5fc888680b3..45bd1166029 100644
@@ -212,14 +212,6 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-a1-ad401.dtb \
 	meson-axg-s400.dtb \
 	meson-axg-jethome-jethub-j100.dtb \
-	meson-gxbb-kii-pro.dtb \
-	meson-gxbb-nanopi-k2.dtb \
-	meson-gxbb-odroidc2.dtb \
-	meson-gxbb-nanopi-k2.dtb \
-	meson-gxbb-p200.dtb \
-	meson-gxbb-p201.dtb \
-	meson-gxbb-wetek-hub.dtb \
-	meson-gxbb-wetek-play2.dtb \
 	meson-gxl-s805x-libretech-ac.dtb \
 	meson-gxl-s905d-libretech-pc.dtb \
 	meson-gxl-s905w-jethome-jethub-j80.dtb \
arch/arm/dts/meson-gxbb-kii-pro.dts deleted +0 -140

140 lines not on this page · raw message

arch/arm/dts/meson-gxbb-nanopi-k2.dts deleted +0 -415

415 lines not on this page · raw message

arch/arm/dts/meson-gxbb-odroidc2.dts deleted +0 -418

418 lines not on this page · raw message

arch/arm/dts/meson-gxbb-p200.dts deleted +0 -100

100 lines not on this page · raw message

arch/arm/dts/meson-gxbb-p201.dts deleted +0 -26
deleted file mode 100644
index 150a82f3b2d..00000000000
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (c) 2016 Andreas Färber
- * Copyright (c) 2016 BayLibre, Inc.
- * Author: Kevin Hilman <[email protected]>
- */
-
-/dts-v1/;
-
-#include "meson-gxbb-p20x.dtsi"
-
-/ {
-	compatible = "amlogic,p201", "amlogic,meson-gxbb";
-	model = "Amlogic Meson GXBB P201 Development Board";
-};
-
-&ethmac {
-	status = "okay";
-	pinctrl-0 = <&eth_rmii_pins>;
-	pinctrl-names = "default";
-	phy-mode = "rmii";
-
-	snps,reset-gpio = <&gpio GPIOZ_14 0>;
-	snps,reset-delays-us = <0>, <10000>, <1000000>;
-	snps,reset-active-low;
-};
arch/arm/dts/meson-gxbb-p20x.dtsi deleted +0 -250

250 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek-hub.dts deleted +0 -58

58 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek-play2.dts deleted +0 -119

119 lines not on this page · raw message

arch/arm/dts/meson-gxbb-wetek.dtsi deleted +0 -292

292 lines not on this page · raw message

arch/arm/dts/meson-gxbb.dtsi deleted +0 -856

856 lines not on this page · raw message

Signature · 1 line
2.34.1
#28 lore raw
In reply to Sumit Garg

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Neil

Quoted 151 lines

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows::

$ git subtree pull --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-boot maintainers here [4]. Now we would like to reach out to wider U-boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-boot to run devicetree bindings schema checks which will bring compliance to U-boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

It is also possible to run checks with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.

$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

Sumit Garg (8):
Azure CI: Exclude devicetree-rebasing subtree for CONFIG checks
Makefile: Add support for DT bindings schema checks scripts/Makefile.lib: Statically define *-u-boot.dtsi files location
dts: Add alternative location for upstream DTB builds
doc: devicetree: Updates for devicetree-rebasing subtree
MAINTAINERS: Add myself as devicetree-rebasing maintainer
dts: meson-gxbb: Switch to using upstream DT
dts: meson-gxbb: Drop redundant devicetree files

  .azure-pipelines.yml                    |   3 +-
  MAINTAINERS                             |   6 +
  Makefile                                |  20 +-
  arch/arm/dts/Makefile                   |   8 -
  arch/arm/dts/meson-gxbb-kii-pro.dts     | 140 ----
  arch/arm/dts/meson-gxbb-nanopi-k2.dts   | 415 ------------
  arch/arm/dts/meson-gxbb-odroidc2.dts    | 418 ------------
  arch/arm/dts/meson-gxbb-p200.dts        | 100 ---
  arch/arm/dts/meson-gxbb-p201.dts        |  26 -
  arch/arm/dts/meson-gxbb-p20x.dtsi       | 250 -------
  arch/arm/dts/meson-gxbb-wetek-hub.dts   |  58 --
  arch/arm/dts/meson-gxbb-wetek-play2.dts | 119 ----
  arch/arm/dts/meson-gxbb-wetek.dtsi      | 292 --------
  arch/arm/dts/meson-gxbb.dtsi            | 856 ------------------------
  configs/nanopi-k2_defconfig             |   3 +-
  configs/odroid-c2_defconfig             |   3 +-
  configs/p200_defconfig                  |   3 +-
  configs/p201_defconfig                  |   3 +-
  configs/videostrong-kii-pro_defconfig   |   3 +-
  configs/wetek-hub_defconfig             |   3 +-
  configs/wetek-play2_defconfig           |   3 +-
  doc/develop/devicetree/control.rst      | 108 ++-
  dts/Kconfig                             |  11 +
  dts/Makefile                            |  17 +-
  dts/arch/arm64/Makefile                 |  23 +
  dts/arch/arm64/amlogic                  |   1 +
  scripts/Makefile.lib                    |  42 +-
  27 files changed, 204 insertions(+), 2730 deletions(-)

delete mode 100644 arch/arm/dts/meson-gxbb-kii-pro.dts delete mode 100644 arch/arm/dts/meson-gxbb-nanopi-k2.dts delete mode 100644 arch/arm/dts/meson-gxbb-odroidc2.dts delete mode 100644 arch/arm/dts/meson-gxbb-p200.dts delete mode 100644 arch/arm/dts/meson-gxbb-p201.dts delete mode 100644 arch/arm/dts/meson-gxbb-p20x.dtsi delete mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts delete mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts delete mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi delete mode 100644 arch/arm/dts/meson-gxbb.dtsi create mode 100644 dts/arch/arm64/Makefile create mode 120000 dts/arch/arm64/amlogic

#29 lore raw
Quoted 16 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

So I would plan on grabbing only full kernel releases and in to -next as soon as possible. Our cadences don't match up exactly, but I think do fairly well enough.

Signature · 1 line
Tom
#30 lore raw
Quoted 27 lines · Tom Rini
Quoted 16 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Quoted 9 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

Rob

#31 lore raw
Quoted 38 lines · Rob Herring
Quoted 27 lines · Tom Rini
Quoted 16 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Quoted 9 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

I think we'll be fine, but time will tell. And perhaps the more frequent re-syncing will make any sort of corner cases show up more quickly and be something we can figure out how to resolve going forward really.

Signature · 1 line
Tom
author
#32 lore raw
Quoted 48 lines · Tom Rini
Quoted 38 lines · Rob Herring
Quoted 27 lines · Tom Rini
Quoted 16 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Quoted 9 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

Quoted 4 lines

I think we'll be fine, but time will tell. And perhaps the more frequent re-syncing will make any sort of corner cases show up more quickly and be something we can figure out how to resolve going forward really.

Agree, frequent re-syncing is something we should aim for. However, if required then we can always revisit our approach.

-Sumit

Quoted 2 lines

--
Tom

#33 lore raw
In reply to Tom Rini
Quoted 47 lines · Tom Rini
Quoted 38 lines · Rob Herring
Quoted 27 lines · Tom Rini
Quoted 16 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
        git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
        v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Quoted 9 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

Quoted 4 lines

I think we'll be fine, but time will tell. And perhaps the more frequent re-syncing will make any sort of corner cases show up more quickly and be something we can figure out how to resolve going forward really.

Sure, I suppose I'll only switch the stable boards, and keep the in-progress ones with manual sync.
And I'll need to make a prerequisite to any breaking DT change to have the corresponding U-Boot change submitted before (and probably other OSes like *BSD*s)

Neil

#34 lore raw
In reply to Rob Herring
Quoted 11 lines · Rob Herring
Quoted 10 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

If some U-Boot platform decides to aggressively sync with kernel DTS, then probably the kernel subarch maintainer should be aware of it. Mentioned forward compatibility issue is a result of assumption that there are no out-of-tree upstream consumers of our DTS. I am certainly not aware of any such consumer for Samsung. If someone told me (me wearing Samsung hat), hey U-Boot now cares, I would start caring as well.

The usual argument of contributors wanting to break the backward and forward compatibility, is "there is no other OS depending on this" (recent discussion with Johan about order of interrupts:
https://lore.kernel.org/all/[email protected]/ ). You need to tell the maintainers of that platform, that now they have other OS/firmware/bootloader depending on DTS compatibility.

Best regards,
Krzysztof

#35 lore raw
Quoted 27 lines · Krzysztof Kozlowski
Quoted 11 lines · Rob Herring
Quoted 10 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

If some U-Boot platform decides to aggressively sync with kernel DTS, then probably the kernel subarch maintainer should be aware of it. Mentioned forward compatibility issue is a result of assumption that there are no out-of-tree upstream consumers of our DTS. I am certainly not aware of any such consumer for Samsung. If someone told me (me wearing Samsung hat), hey U-Boot now cares, I would start caring as well.

Quoted 6 lines

The usual argument of contributors wanting to break the backward and forward compatibility, is "there is no other OS depending on this" (recent discussion with Johan about order of interrupts:
https://lore.kernel.org/all/[email protected]/ ). You need to tell the maintainers of that platform, that now they have other OS/firmware/bootloader depending on DTS compatibility.

I think this hints at one of the bigger impacts this might have. Reminding everyone that other projects do use the device trees and have for years. Without rehashing history, BSD does use the trees as-is and for platforms U-Boot supports they are supposed to be re-synced periodically. This series moves us from an ad-hoc method to a defined schedule.

And presumably some of the Samsung platforms will get moved over to this framework, especially the newer ones being submitted recently :)

Signature · 1 line
Tom
#36 lore raw
Quoted 35 lines · Tom Rini
Quoted 27 lines · Krzysztof Kozlowski
Quoted 11 lines · Rob Herring
Quoted 10 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

If some U-Boot platform decides to aggressively sync with kernel DTS, then probably the kernel subarch maintainer should be aware of it. Mentioned forward compatibility issue is a result of assumption that there are no out-of-tree upstream consumers of our DTS. I am certainly not aware of any such consumer for Samsung. If someone told me (me wearing Samsung hat), hey U-Boot now cares, I would start caring as well.

Quoted 6 lines

The usual argument of contributors wanting to break the backward and forward compatibility, is "there is no other OS depending on this" (recent discussion with Johan about order of interrupts:
https://lore.kernel.org/all/[email protected]/ ). You need to tell the maintainers of that platform, that now they have other OS/firmware/bootloader depending on DTS compatibility.

Quoted 3 lines

I think this hints at one of the bigger impacts this might have. Reminding everyone that other projects do use the device trees and have for years.

TBF, we do try to ask these questions as much as possible, usually (for me at least) citing U-Boot or the BSDs as users. It largely seems to me like we are all bark and no bite though, so a project like U-Boot having a defined "schedule" as you suggest below would add more meaning to our questioning.

Quoted 3 lines

Without rehashing history, BSD does use the trees as-is and for platforms U-Boot supports they are supposed to be re-synced periodically.

I know this is the theory, but I also know that how well this is implemented varies wildly per-platform. I generally don't pay all that much attention to the various arm platforms, but I do pay attention to what's going on for RISC-V and there appear to be no active maintainers of individual platforms and the architecture maintainers are not aware of the status of the equivalent patches for Linux when they apply patches.

In recent memory, this has lead to the clock indices in the DT differing between U-Boot and Linux for one such platform, which, IMO, is an insidious difference that is hard to spot during review and highly unlikely to crop up while comparing dts files, since the defines were named identically. To be clear, I am not expecting the architecture code maintainers to be aware of the minutiae of the various RISC-V platforms, but rather suggesting they might have an easier time reviewing if both projects' dts files and binding headers were tied together.

That said, automatically synced devicetrees will, as has been pointed out, require the platform maintainers in Linux to be more aware of the affect of what they accept on other users, but it will also require the equivalent maintainers on the U-Boot side to engage too, so that the "upstream" dts files do not change in a way that screws the usecase in U-Boot.

Also, if people send fixes to the U-Boot copies of these devicetrees, would the plan be to request that these are sent to Linux and the fixes pulled in via a resync after each -rc release of Linux (or similar, just throwing some example schedule out there)?

Cheers,
Conor.

Quoted 5 lines

This series moves us from an ad-hoc method to a defined schedule.

And presumably some of the Samsung platforms will get moved over to this framework, especially the newer ones being submitted recently :)

#37 lore raw
Quoted 67 lines · Conor Dooley
Quoted 35 lines · Tom Rini
Quoted 27 lines · Krzysztof Kozlowski
Quoted 11 lines · Rob Herring
Quoted 10 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

If some U-Boot platform decides to aggressively sync with kernel DTS, then probably the kernel subarch maintainer should be aware of it. Mentioned forward compatibility issue is a result of assumption that there are no out-of-tree upstream consumers of our DTS. I am certainly not aware of any such consumer for Samsung. If someone told me (me wearing Samsung hat), hey U-Boot now cares, I would start caring as well.

Quoted 6 lines

The usual argument of contributors wanting to break the backward and forward compatibility, is "there is no other OS depending on this" (recent discussion with Johan about order of interrupts:
https://lore.kernel.org/all/[email protected]/ ). You need to tell the maintainers of that platform, that now they have other OS/firmware/bootloader depending on DTS compatibility.

Quoted 3 lines

I think this hints at one of the bigger impacts this might have. Reminding everyone that other projects do use the device trees and have for years.

TBF, we do try to ask these questions as much as possible, usually (for me at least) citing U-Boot or the BSDs as users. It largely seems to me like we are all bark and no bite though, so a project like U-Boot having a defined "schedule" as you suggest below would add more meaning to our questioning.

Quoted 3 lines

Without rehashing history, BSD does use the trees as-is and for platforms U-Boot supports they are supposed to be re-synced periodically.

I know this is the theory, but I also know that how well this is implemented varies wildly per-platform. I generally don't pay all that much attention to the various arm platforms, but I do pay attention to what's going on for RISC-V and there appear to be no active maintainers of individual platforms and the architecture maintainers are not aware of the status of the equivalent patches for Linux when they apply patches.

In recent memory, this has lead to the clock indices in the DT differing between U-Boot and Linux for one such platform, which, IMO, is an insidious difference that is hard to spot during review and highly unlikely to crop up while comparing dts files, since the defines were named identically. To be clear, I am not expecting the architecture code maintainers to be aware of the minutiae of the various RISC-V platforms, but rather suggesting they might have an easier time reviewing if both projects' dts files and binding headers were tied together.

Quoted 5 lines

That said, automatically synced devicetrees will, as has been pointed out, require the platform maintainers in Linux to be more aware of the affect of what they accept on other users, but it will also require the equivalent maintainers on the U-Boot side to engage too, so that the "upstream" dts files do not change in a way that screws the usecase in U-Boot.

Yeah, it will hopefully lead to better coordination between maintainers in some places. There are SoCs where the kernel DTS people are the U-Boot DTS people too. All in all, I should probably CC more people than I usually do on these resync patches just to try and head off any tricky changes like you've mentioned above.

Quoted 4 lines

Also, if people send fixes to the U-Boot copies of these devicetrees, would the plan be to request that these are sent to Linux and the fixes pulled in via a resync after each -rc release of Linux (or similar, just throwing some example schedule out there)?

The way we've always tried to operate is that changes should be pushed to Linux and resynced down, or at least submitted simultaneously. If there's some specific bugfixes that need to come in out of cycle I _think_ subtree handles cherry picked commits in a reasonable fashion.

Signature · 1 line
Tom
author
#38 lore raw
Quoted 75 lines · Tom Rini
Quoted 67 lines · Conor Dooley
Quoted 35 lines · Tom Rini
Quoted 27 lines · Krzysztof Kozlowski
Quoted 11 lines · Rob Herring
Quoted 10 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Quoted 7 lines

A common issue in the kernel is with forward compatibility when platforms add new resources from a new provider. Then the kernel expects a driver for the provider and waits for the dependency. Of course, older kernels don't have that provider driver and so the dependency is never met. Not sure if u-boot will have similar issues? At least you should/could know if the provider driver exists or not. (The kernel doesn't because modules.)

If some U-Boot platform decides to aggressively sync with kernel DTS, then probably the kernel subarch maintainer should be aware of it. Mentioned forward compatibility issue is a result of assumption that there are no out-of-tree upstream consumers of our DTS. I am certainly not aware of any such consumer for Samsung. If someone told me (me wearing Samsung hat), hey U-Boot now cares, I would start caring as well.

Quoted 6 lines

The usual argument of contributors wanting to break the backward and forward compatibility, is "there is no other OS depending on this" (recent discussion with Johan about order of interrupts:
https://lore.kernel.org/all/[email protected]/ ). You need to tell the maintainers of that platform, that now they have other OS/firmware/bootloader depending on DTS compatibility.

Quoted 3 lines

I think this hints at one of the bigger impacts this might have. Reminding everyone that other projects do use the device trees and have for years.

TBF, we do try to ask these questions as much as possible, usually (for me at least) citing U-Boot or the BSDs as users. It largely seems to me like we are all bark and no bite though, so a project like U-Boot having a defined "schedule" as you suggest below would add more meaning to our questioning.

Quoted 3 lines

Without rehashing history, BSD does use the trees as-is and for platforms U-Boot supports they are supposed to be re-synced periodically.

I know this is the theory, but I also know that how well this is implemented varies wildly per-platform. I generally don't pay all that much attention to the various arm platforms, but I do pay attention to what's going on for RISC-V and there appear to be no active maintainers of individual platforms and the architecture maintainers are not aware of the status of the equivalent patches for Linux when they apply patches.

In recent memory, this has lead to the clock indices in the DT differing between U-Boot and Linux for one such platform, which, IMO, is an insidious difference that is hard to spot during review and highly unlikely to crop up while comparing dts files, since the defines were named identically. To be clear, I am not expecting the architecture code maintainers to be aware of the minutiae of the various RISC-V platforms, but rather suggesting they might have an easier time reviewing if both projects' dts files and binding headers were tied together.

Quoted 5 lines

That said, automatically synced devicetrees will, as has been pointed out, require the platform maintainers in Linux to be more aware of the affect of what they accept on other users, but it will also require the equivalent maintainers on the U-Boot side to engage too, so that the "upstream" dts files do not change in a way that screws the usecase in U-Boot.

Quoted 5 lines

Yeah, it will hopefully lead to better coordination between maintainers in some places. There are SoCs where the kernel DTS people are the U-Boot DTS people too. All in all, I should probably CC more people than I usually do on these resync patches just to try and head off any tricky changes like you've mentioned above.

Makes sense.

Quoted 11 lines
Quoted 5 lines

Also, if people send fixes to the U-Boot copies of these devicetrees, would the plan be to request that these are sent to Linux and the fixes pulled in via a resync after each -rc release of Linux (or similar, just throwing some example schedule out there)?

The way we've always tried to operate is that changes should be pushed to Linux and resynced down, or at least submitted simultaneously. If there's some specific bugfixes that need to come in out of cycle I _think_ subtree handles cherry picked commits in a reasonable fashion.

Agree.

-Sumit

Quoted 2 lines

--
Tom

author
#39 lore raw
In reply to Tom Rini
Quoted 9 lines · Tom Rini
Quoted 7 lines · On Thu, Dec 14, 2023 at 03:53:11PM +0100, [email protected] wrote:

Hi,

Quoted 1 line · Sumit Garg

Prerquisite

s/Prerquisite/Prerequisite/

Ack.

Quoted 18 lines
Quoted 9 lines
Quoted 8 lines

-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash
Quoted 8 lines

So I think the big question is: when should the subtree be updated ?

Because as we discussed in the previous GH pull request, if a bindings changes was made in the upstream Linux DT, then the subtree update should wait until the u-boot support is merged before updating. This could cause a lot of frustration.

And this could cause a lot of regressions, even more if both Linux and U-boot are not maintained by the same people.

Quoted 9 lines

I think some of the important questions to ask are, how often / likely are the breakages to occur? It seems like these days it's either:
- U-Boot had an early version of the binding and we already state we don't support backwards compatibility here. It should be on the maintainer to be proactive in this case.
- It's a "the DT was wrong about the hardware, sorry not sorry it's an incompatible DTS change now". This too is hopefully the kind of thing that at least board maintainers will be more actively aware of needing to deal with in U-Boot, if it's really a problem.

Agree, also per discussion with Linux DT maintainers, they do care for DT backwards and forward compatibility. I expect the ABI changes to be rare. In case there is an ABI change then it will be great if Linux DT maintainers can ask contributors to CC corresponding U-boot platform maintainers too.

BTW, Rob is already working on a tool to detect ABI changes as he described here [1]. If U-boot platform maintainers have any ideas regarding what would constitute an ABI change then feel free to share those.

[1] https://lore.kernel.org/all/CAL_JsqLo4nXrJ93dDsfp3UYLs08V02aMnbCCnsDj0MBBomc35w@mail.gmail.com/

Quoted 4 lines

So I would plan on grabbing only full kernel releases and in to -next as soon as possible. Our cadences don't match up exactly, but I think do fairly well enough.

I suppose that would give ample time to the U-boot platform/board maintainer to fix any ABI change regression found in the -next branch. That being said we aren't completely immune to changes to devicetree-rebasing subtree. If there is an DT ABI change that will take significant effort to fix in U-boot then we are open to accepting a revert given that it will be fixed before next uprev.

-Sumit

Quoted 3 lines

--
Tom

#40 lore raw
In reply to Sumit Garg

Hi Sumit,

Quoted 100 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows::

$ git subtree pull --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-boot maintainers here [4]. Now we would like to reach out to wider U-boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-boot to run devicetree bindings schema checks which will bring compliance to U-boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check
Quoted 8 lines

It is also possible to run checks with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.

$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

Do you also plan to extend this to cover dt overlay + dt base generation and check it against DT schema.

Thanks,
Michal

author
#41 lore raw

Hi Michal,

Quoted 109 lines · Michal Simek

Hi Sumit,

Quoted 105 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       v6.6-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to Qcom platforms [1] which was about to import modified devicetree source files from Linux kernel. I suppose keeping devicetree files sync with Linux kernel without any DT bindings schema validation has been a pain for U-boot SoC/platform maintainers. There has been past discussions about a single DT repo but that hasn't come up and Linux kernel remained the place where DT source files as well as bindings are placed and maintained.

However, Linux kernel DT maintainers proposed [2] for U-boot to rather use devicetree-rebasing repo [3] which is a forked copy from Linux kernel for DT source files as well as bindings. It is tagged at every Linux kernel major release or intermideate release candidates. So here I have tried to reuse that to bring DT bingings compliance as well as a standard way to maintain a regular sync of DT source files with Linux kernel.

In order to maintain devicetree files sync, U-boot will maintains a Git subtree for devicetee-rebasing repo as devicetee-rebasing/ sub-directory. It will be regularly updated with every new kernel major release via subtree pull as follows::

$ git subtree pull --prefix devicetree-rebasing \
       git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
       <release-tag> --squash

The RFC/prototype for this series has been discussed with Linux DT maintainers as well as U-boot maintainers here [4]. Now we would like to reach out to wider U-boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-boot placed copies of devicetree source files from Linux kernel into arch/<arch>/dts/<name>.dts, which can be selected via:

CONFIG_DEFAULT_DEVICE_TREE "<name>"

SoC/board maintainers are encouraged to migrate to using mirrored copies from devicetree-rebasing/ into dts/arch/<arch>/<vendor> via:

CONFIG_OF_UPSTREAM=y
CONFIG_DEFAULT_DEVICE_TREE "<vendor>/<name>"

An example have been shown for Amlogic meson-gxbb SoC and corresponding derived boards via patch #7 and #8.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also regularly synced with Linux kernel as devicetree-rebasing/Bindings/ sub-directory. This allows U-boot to run devicetree bindings schema checks which will bring compliance to U-boot core/drivers regarding usage of devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

It is also possible to run checks with a subset of matching schema files by setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files or patterns (partial match of a fixed string). Each file or pattern should be separated by ':'.

Quoted 6 lines
Quoted 3 lines
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

Do you also plan to extend this to cover dt overlay + dt base generation and check it against DT schema.

I suppose here you are referring to DT schema checks for *.dtso -> *.dtbo generation. I don't see corresponding checks enabled in Linux kernel [1]. Probably Rob can share plans over there.

U-Boot tries to follow Linux kernel kbuild framework. However, if needed we can add checks for *.dtbo generation too as a follow up patch.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/scripts/Makefile.lib#n421

-Sumit

Quoted 4 lines

Thanks,
Michal

#42 lore raw
In reply to Sumit Garg
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

Maxim, please switch (back, sorry!) to subtree for the next lwIP patchset and just not in the prerequisite steps what the subtree command is, and make sure the docs have an example of what future re-sync "subtree pull" commands should look like. For CI testing, you'll have to do that to start with and just not include that patch in the ML part.

Signature · 1 line
Tom
#43 lore raw

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Quoted 6 lines

Maxim, please switch (back, sorry!) to subtree for the next lwIP patchset and just not in the prerequisite steps what the subtree command is, and make sure the docs have an example of what future re-sync "subtree pull" commands should look like. For CI testing, you'll have to do that to start with and just not include that patch in the ML part.

Regards,
Simon

author
#44 lore raw
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 4 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

-Sumit

Quoted 9 lines
Quoted 6 lines

Maxim, please switch (back, sorry!) to subtree for the next lwIP patchset and just not in the prerequisite steps what the subtree command is, and make sure the docs have an example of what future re-sync "subtree pull" commands should look like. For CI testing, you'll have to do that to start with and just not include that patch in the ML part.

Regards,
Simon

#45 lore raw

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

+CONFIG_OF_UPSTREAM=y +CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig. We should not have to specify the filename like this. It is laborious and error-prone.

Regards,
Simon

author
#46 lore raw

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

-Sumit

#47 lore raw

Hi Sumit
Hi Simon,

Quoted 76 lines · Sumit Garg

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 9 lines
Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

So how do we handle the case where the DTS exists in u-boot, but not in Linux? For example, the DTS was developed for u-boot first and has not been accepted in the Linux device tree yet. Can we set in the board defconfig like:

# CONFIG_OF_UPSTREAM is not set

Would that allow the DTS to remain in arch/<architecture>/dts?

Thanks,
Tony

author
#48 lore raw

Hi Tony,

Quoted 91 lines · Tony Dinh

Hi Sumit
Hi Simon,

Quoted 76 lines · Sumit Garg

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 9 lines
Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

Quoted 8 lines

So how do we handle the case where the DTS exists in u-boot, but not in Linux? For example, the DTS was developed for u-boot first and has not been accepted in the Linux device tree yet. Can we set in the board defconfig like:

# CONFIG_OF_UPSTREAM is not set

Would that allow the DTS to remain in arch/<architecture>/dts?

Yeah that is expected until DTS becomes available in the DT rebasing tree.

-Sumit

Quoted 3 lines

Thanks,
Tony

#49 lore raw
In reply to Sumit Garg

Hi Sumit,

Quoted 76 lines · Sumit Garg

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 8 lines
Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

My current opinion is that a better approach would be to move the files first (in the U-Boot tree). That would be easier if we could just copy the Linux arch/xxx/boot/dts Makefiles but for now that is not possible. The Kconfig options for each SoC are similar but there are various differences.

Having a different layout is just a pain and it will get worse, as people add new boards, since they need to know to add the correct directory.

I will see if I can devise a small series to point this in what I consider to be the right direction, in line with Linux, and the U-Boot commit 3284c8b8 ("dts: generate multiple device tree blobs").

Regards,
Simon

#50 lore raw
Quoted 94 lines · Simon Glass

Hi Sumit,

Quoted 76 lines · Sumit Garg

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 8 lines
Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

My current opinion is that a better approach would be to move the files first (in the U-Boot tree). That would be easier if we could just copy the Linux arch/xxx/boot/dts Makefiles but for now that is not possible. The Kconfig options for each SoC are similar but there are various differences.

Quoted 7 lines

Having a different layout is just a pain and it will get worse, as people add new boards, since they need to know to add the correct directory.

I will see if I can devise a small series to point this in what I consider to be the right direction, in line with Linux, and the U-Boot commit 3284c8b8 ("dts: generate multiple device tree blobs").

I think we should just go with the approach Sumit has already taken, and encourage SoC maintainers to migrate sooner rather than later. There's also nothing stopping people from adding vendor directories under arch/ at that point, and will likely have to happen anyhow for the case of platforms that aren't yet in the devicetree-rebasing tree. I am hopeful it won't be as much of an issue as my general feedback will change from "what kernel release is this dts in?" to "why didn't you set OF_UPSTREAM and use the existing tree?"

Signature · 1 line
Tom
#51 lore raw

Hi Tom,

Quoted 104 lines · Tom Rini
Quoted 94 lines · Simon Glass

Hi Sumit,

Quoted 76 lines · Sumit Garg

Hi Simon,

Quoted 67 lines · Simon Glass

Hi Sumit,

Quoted 49 lines · Sumit Garg
Quoted 39 lines · Simon Glass

Hi,

Quoted 13 lines · Tom Rini
Quoted 9 lines · Sumit Garg

Prerquisite
-----------

This patch series requires devicetree-rebasing git repo to be added as a subtree to the main U-boot repo via:

$ git subtree add --prefix devicetree-rebasing \
      git://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.6-dts --squash
Quoted 13 lines

So, I've played with subtree a little and I think this is the right way forward in these cases. If anyone wants to take a look at how this works in practice, take a look at:
https://source.denx.de/u-boot/u-boot/-/commits/WIP/u-boot-with-devicetree-rebasing-since-v6.1/?ref_type=heads
In that tree I started with the v6.1-dts tag, sync'd all the configs (to have an example of a normal commit) and then did a merge of each tag until v6.6-dts, so provide some history. And git log looks like what I want to see, the squash commit has clear references to what we are getting and I make a merge commit that says what I did. If you pull the tree and checkout the branch, all the code is right there already, nothing further to do. Same with tarball releases. The only thing I don't like is the size growth there, but we'll reclaim some of it when we delete our obsolete bindings, and then obsolete dts files.

I spent a bit of time with subtree as well, as part of reviewing this series, using the instructions Sumit provided. It seems OK to me. We have to accept that it adds code and there will be changes/churn, but it is not too different to accepting patches on those files within U-Boot. We will bring in files which U-Boot doesn't use, but U-Boot does support a good proportion of the boards supported by Linux, so I don't see that as a big cost.

Quoted 2 lines

From my experimentation, subtrees seem to have no impact on buildman, which is great. Am I missing anything?

No it shouldn't cause any regression on existing tools/CI/build systems. It is just a version controlled way of importing third party source code as a tarball.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

I still worry about the board-level 'switch' between U-Boot DT and upstream ones. I believe that should be at the SoC level instead.

Probably I wasn't clear enough in my earlier replies but this series motivates for a SoC level switch only. Patch #7 is essentially a switch for Amlogic meson-gxbb SoC and its derived boards.

OK good...but that's not quite what I mean. You have a fragment like this in multiple defconfig files:

(quoted diff) +2 -0
+CONFIG_OF_UPSTREAM=y
+CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-gxbb-odroidc2"
Quoted 2 lines

instead, OF_UPSTREAM should be enabled via 'imply' for the SoC, in the Kconfig.

Okay I got your point. It makes sense to me. I will do that for v3.

Quoted 8 lines
Quoted 2 lines

We should not have to specify the filename like this. It is laborious and error-prone.

The only differentiation in naming here is just silicon vendor prefix addition (amlogic/ in this case). The reason for this being that I just want to mirror the whole silicon vendor directory from DT rebasing rather than mirroring individual DT files. Given this do you have any better alternatives?

My current opinion is that a better approach would be to move the files first (in the U-Boot tree). That would be easier if we could just copy the Linux arch/xxx/boot/dts Makefiles but for now that is not possible. The Kconfig options for each SoC are similar but there are various differences.

Quoted 7 lines

Having a different layout is just a pain and it will get worse, as people add new boards, since they need to know to add the correct directory.

I will see if I can devise a small series to point this in what I consider to be the right direction, in line with Linux, and the U-Boot commit 3284c8b8 ("dts: generate multiple device tree blobs").

Quoted 8 lines

I think we should just go with the approach Sumit has already taken, and encourage SoC maintainers to migrate sooner rather than later. There's also nothing stopping people from adding vendor directories under arch/ at that point, and will likely have to happen anyhow for the case of platforms that aren't yet in the devicetree-rebasing tree. I am hopeful it won't be as much of an issue as my general feedback will change from "what kernel release is this dts in?" to "why didn't you set OF_UPSTREAM and use the existing tree?"

OK.

But I do want to see a move to using the same dir structure as Linux.

Regards,
Simon