From 915cb05bb6e661cbb5f84ffd518726d5e04e911e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 9 Oct 2023 13:08:40 +0200 Subject: [PATCH] dts: drop HAS_DTS HAS_DTS has become a redundant option. All Zephyr architectures now select this option, meaning devicetree has become a de-facto requirement. In fact, if any board does not provide a devicetree source, the build system uses an empty stub, meaning the devicetree machinery always runs. Signed-off-by: Gerard Marull-Paretas --- arch/Kconfig | 10 ---------- cmake/modules/dts.cmake | 5 ----- dts/Kconfig | 6 ------ include/zephyr/device.h | 2 -- include/zephyr/drivers/emul.h | 2 -- include/zephyr/drivers/sensor.h | 3 --- subsys/shell/backends/Kconfig.backends | 3 +-- 7 files changed, 1 insertion(+), 30 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 110938528e..65b73557f7 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -19,7 +19,6 @@ source "$(ARCH_DIR)/$(ARCH)/Kconfig" config ARC bool select ARCH_IS_SET - select HAS_DTS imply XIP select ARCH_HAS_THREAD_LOCAL_STORAGE select ARCH_SUPPORTS_ROM_START @@ -30,7 +29,6 @@ config ARM bool select ARCH_IS_SET select ARCH_SUPPORTS_COREDUMP if CPU_CORTEX_M - select HAS_DTS # FIXME: current state of the code for all ARM requires this, but # is really only necessary for Cortex-M with ARM MPU! select GEN_PRIV_STACKS @@ -43,7 +41,6 @@ config ARM64 bool select ARCH_IS_SET select 64BIT - select HAS_DTS select ARCH_SUPPORTS_COREDUMP select HAS_ARM_SMCCC select ARCH_HAS_THREAD_LOCAL_STORAGE @@ -58,14 +55,12 @@ config MIPS bool select ARCH_IS_SET select ATOMIC_OPERATIONS_C - select HAS_DTS help MIPS architecture config SPARC bool select ARCH_IS_SET - select HAS_DTS select USE_SWITCH select USE_SWITCH_SUPPORTED select BIG_ENDIAN @@ -80,7 +75,6 @@ config X86 bool select ARCH_IS_SET select ATOMIC_OPERATIONS_BUILTIN - select HAS_DTS select ARCH_SUPPORTS_COREDUMP select ARCH_SUPPORTS_ROM_START if !X86_64 select CPU_HAS_MMU @@ -102,7 +96,6 @@ config NIOS2 bool select ARCH_IS_SET select ATOMIC_OPERATIONS_C - select HAS_DTS imply XIP select ARCH_HAS_TIMING_FUNCTIONS help @@ -111,7 +104,6 @@ config NIOS2 config RISCV bool select ARCH_IS_SET - select HAS_DTS select ARCH_SUPPORTS_COREDUMP select ARCH_SUPPORTS_ROM_START if !SOC_SERIES_ESP32C3 select ARCH_HAS_CODE_DATA_RELOCATION @@ -128,7 +120,6 @@ config RISCV config XTENSA bool select ARCH_IS_SET - select HAS_DTS select USE_SWITCH select USE_SWITCH_SUPPORTED select IRQ_OFFLOAD_NESTED if IRQ_OFFLOAD @@ -141,7 +132,6 @@ config XTENSA config ARCH_POSIX bool select ARCH_IS_SET - select HAS_DTS select ATOMIC_OPERATIONS_BUILTIN select ARCH_HAS_CUSTOM_SWAP_TO_MAIN select ARCH_HAS_CUSTOM_BUSY_WAIT diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 8cdd94cd57..c9ac751a1e 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -9,9 +9,6 @@ include(pre_dt) find_package(HostTools) find_package(Dtc 1.4.6) -# Zephyr code is usually configured using devicetree, but this is -# still technically optional (see e.g. CONFIG_HAS_DTS). -# # This module makes information from the devicetree available to # various build stages, as well as to other arbitrary Python scripts: # @@ -125,8 +122,6 @@ set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake) # modules. set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt) -# TODO: What to do about non-posix platforms where NOT CONFIG_HAS_DTS (xtensa)? -# Drop support for NOT CONFIG_HAS_DTS perhaps? set_ifndef(DTS_SOURCE ${BOARD_DIR}/${BOARD}.dts) if(EXISTS ${DTS_SOURCE}) # We found a devicetree. Check for a board revision overlay. diff --git a/dts/Kconfig b/dts/Kconfig index 46d1b85b6e..0e71bd525c 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -1,11 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -config HAS_DTS - bool - help - This option specifies that the target platform supports device tree - configuration. - menu "Devicetree Info" osource "$(KCONFIG_BINARY_DIR)/Kconfig.dts" diff --git a/include/zephyr/device.h b/include/zephyr/device.h index ca59579500..630a059c15 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -1005,7 +1005,6 @@ static inline bool z_impl_device_is_ready(const struct device *dev) \ Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn, level, prio) -#if defined(CONFIG_HAS_DTS) || defined(__DOXYGEN__) /** * @brief Declare a device for each status "okay" devicetree node. * @@ -1020,7 +1019,6 @@ static inline bool z_impl_device_is_ready(const struct device *dev) extern const struct device DEVICE_DT_NAME_GET(node_id); DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_DEVICE_DECLARE_INTERNAL) -#endif /* CONFIG_HAS_DTS */ /** @endcond */ diff --git a/include/zephyr/drivers/emul.h b/include/zephyr/drivers/emul.h index 9ef6fb9ada..7c306de988 100644 --- a/include/zephyr/drivers/emul.h +++ b/include/zephyr/drivers/emul.h @@ -191,11 +191,9 @@ const struct emul *emul_get_binding(const char *name); * @} */ -#if defined(CONFIG_HAS_DTS) || defined(__DOXYGEN__) #define Z_MAYBE_EMUL_DECLARE_INTERNAL(node_id) extern const struct emul EMUL_DT_NAME_GET(node_id); DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_EMUL_DECLARE_INTERNAL); -#endif /* CONFIG_HAS_DTS || __DOXYGEN__ */ #ifdef __cplusplus } diff --git a/include/zephyr/drivers/sensor.h b/include/zephyr/drivers/sensor.h index 903acb6f03..bbc85fda86 100644 --- a/include/zephyr/drivers/sensor.h +++ b/include/zephyr/drivers/sensor.h @@ -1260,8 +1260,6 @@ static inline int64_t sensor_value_to_micro(const struct sensor_value *val) * @} */ -#if defined(CONFIG_HAS_DTS) || defined(__DOXYGEN__) - /** * @brief Get the decoder name for the current driver * @@ -1309,7 +1307,6 @@ static inline int64_t sensor_value_to_micro(const struct sensor_value *val) ()) DT_FOREACH_STATUS_OKAY_NODE(Z_MAYBE_SENSOR_DECODER_DECLARE_INTERNAL) -#endif /* defined(CONFIG_HAS_DTS) || defined(__DOXYGEN__) */ #ifdef __cplusplus } diff --git a/subsys/shell/backends/Kconfig.backends b/subsys/shell/backends/Kconfig.backends index 9bab0be275..44d27a812b 100644 --- a/subsys/shell/backends/Kconfig.backends +++ b/subsys/shell/backends/Kconfig.backends @@ -18,8 +18,7 @@ config SHELL_BACKEND_SERIAL bool "Serial backend" # Serial (UART) requires interrupts and the RTT backend cannot be used from an ISR context. default n if SHELL_BACKEND_RTT - default "$(dt_chosen_enabled,$(DT_CHOSEN_Z_SHELL_UART))" if HAS_DTS - default y if !HAS_DTS + default "$(dt_chosen_enabled,$(DT_CHOSEN_Z_SHELL_UART))" select SERIAL select RING_BUFFER help