From c2bb75e4855be86bb1d9a4e921c02152cd455d22 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Fri, 28 Apr 2023 15:17:19 -0500 Subject: [PATCH] riscv: support Overlay Buildling Signed-off-by: Robert Nelson --- arch/riscv/boot/dts/Makefile | 5 +++++ arch/riscv/boot/dts/thead/Makefile | 5 +++++ arch/riscv/configs/beaglev_defconfig | 5 ++++- scripts/Makefile.dtbinst | 3 ++- scripts/Makefile.lib | 18 ++++++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/arch/riscv/boot/dts/Makefile b/arch/riscv/boot/dts/Makefile index ec44e69ab..b66fd777a 100644 --- a/arch/riscv/boot/dts/Makefile +++ b/arch/riscv/boot/dts/Makefile @@ -1,4 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 + +ifeq ($(CONFIG_OF_OVERLAY),y) +DTC_FLAGS += -@ +endif + subdir-y += sifive subdir-y += kendryte subdir-y += thead diff --git a/arch/riscv/boot/dts/thead/Makefile b/arch/riscv/boot/dts/thead/Makefile index ed488b671..32ceb723c 100644 --- a/arch/riscv/boot/dts/thead/Makefile +++ b/arch/riscv/boot/dts/thead/Makefile @@ -1,4 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 + +ifeq ($(CONFIG_OF_OVERLAY),y) +DTC_FLAGS += -@ +endif + dtb-$(CONFIG_SOC_THEAD) += ice.dtb dtb-$(CONFIG_SOC_THEAD) += light-fm-emu.dtb light_mpw.dtb dtb-$(CONFIG_SOC_THEAD) += light-fm-emu-npu-fce.dtb diff --git a/arch/riscv/configs/beaglev_defconfig b/arch/riscv/configs/beaglev_defconfig index 3ed58d6d9..6b9a6fd39 100644 --- a/arch/riscv/configs/beaglev_defconfig +++ b/arch/riscv/configs/beaglev_defconfig @@ -1315,11 +1315,13 @@ CONFIG_OF=y CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y CONFIG_OF_KOBJ=y +CONFIG_OF_DYNAMIC=y CONFIG_OF_ADDRESS=y CONFIG_OF_IRQ=y CONFIG_OF_NET=y CONFIG_OF_RESERVED_MEM=y -# CONFIG_OF_OVERLAY is not set +CONFIG_OF_RESOLVE=y +CONFIG_OF_OVERLAY=y # CONFIG_PARPORT is not set CONFIG_BLK_DEV=y # CONFIG_BLK_DEV_NULL_BLK is not set @@ -2061,6 +2063,7 @@ CONFIG_SPI_SPIDEV=y # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPI_SLAVE is not set +CONFIG_SPI_DYNAMIC=y # CONFIG_SPMI is not set # CONFIG_HSI is not set # CONFIG_PPS is not set diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 50d580d77..88f7d3ed2 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -18,9 +18,10 @@ include scripts/Kbuild.include include $(src)/Makefile dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) +dtbos := $(addprefix $(dst)/, $(dtbo-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) -__dtbs_install: $(dtbs) $(subdirs) +__dtbs_install: $(dtbs) $(dtbos) $(subdirs) @: quiet_cmd_dtb_install = INSTALL $@ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index d519ebbf0..b96dc3ac4 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -381,6 +381,24 @@ endef $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE $(call if_changed_rule,dtc,yaml) +quiet_cmd_dtco = DTCO $@ +cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ + $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ + $(DTC) -@ -H epapr -O dtb -o $@ -b 0 \ + -i $(dir $<) $(DTC_FLAGS) \ + -Wno-interrupts_property \ + -Wno-label_is_string \ + -Wno-reg_format \ + -Wno-pci_device_bus_num \ + -Wno-i2c_bus_reg \ + -Wno-spi_bus_reg \ + -Wno-avoid_default_addr_size \ + -d $(depfile).dtc.tmp $(dtc-tmp) ; \ + cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) + +$(obj)/%.dtbo: $(src)/%.dts FORCE + $(call if_changed_dep,dtco) + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) # Bzip2