Extend to OF_UPSTREAM the support for building the control DT by
applying DT overlays to a base DT, so far available for the DTs in
arch/$(ARCH)/dts only. The upstream DT overlays to apply are listed in
CONFIG_OF_UPSTREAM_CONTROL_DT_OVERLAYS.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes in v3:
- Add Reviewed-by tag
Changes in v2:
- New patch
dts/Kconfig | 10 ++++++++++
dts/Makefile | 2 ++
scripts/Makefile.dts | 7 +++++++
3 files changed, 19 insertions(+)
--
2.43.0
@@ -137,6 +137,16 @@ config OF_UPSTREAM_VENDOR
help
Select the vendor to build all devicetree files for.
+config OF_UPSTREAM_CONTROL_DT_OVERLAYS
+ string "List of upstream device tree overlays to apply for DT control"
+ depends on OF_UPSTREAM
+ help
+ This option specifies a list of device tree overlays to apply at
+ build time to the device tree used for DT control, so that the
+ board can select at run-time the hardware they describe. This is
+ a list of device tree overlays (without the .dtbo suffix)
+ separated by <space>.
+
config OF_UPSTREAM_INCLUDE_LOCAL_FALLBACK_DTBOS
bool "Build local DTBOs as fallback for DTBOs missing upstream"
default n
@@ -32,6 +32,8 @@ endif
ifneq ($(EXT_DTB),)
DTB := $(EXT_DTB)
+else ifneq ($(subst ",,$(CONFIG_OF_UPSTREAM_CONTROL_DT_OVERLAYS)),)
+DTB := $(dt_dir)/$(DEVICE_TREE)-overlays.dtb
else
DTB := $(dt_dir)/$(DEVICE_TREE).dtb
endif
@@ -16,6 +16,13 @@ dtb-y += $(subst $(dt_dir)/,,$(dtb-vendor_dts))
endif
+ifneq ($(subst ",,$(CONFIG_OF_UPSTREAM_CONTROL_DT_OVERLAYS)),)
+control-dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE)))
+$(control-dt)-overlays-dtbs := $(control-dt).dtb \
+ $(patsubst %,%.dtbo,$(subst ",,$(CONFIG_OF_UPSTREAM_CONTROL_DT_OVERLAYS)))
+dtb-y += $(control-dt)-overlays.dtb
+endif
+
ifneq ($(CONFIG_SYS_DTC_PAD_BYTES),0)
DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
endif