162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ciconfig DTC
362306a36Sopenharmony_ci	bool
462306a36Sopenharmony_ci
562306a36Sopenharmony_cimenuconfig OF
662306a36Sopenharmony_ci	bool "Device Tree and Open Firmware support"
762306a36Sopenharmony_ci	help
862306a36Sopenharmony_ci	  This option enables the device tree infrastructure.
962306a36Sopenharmony_ci	  It is automatically selected by platforms that need it or can
1062306a36Sopenharmony_ci	  be enabled manually for unittests, overlays or
1162306a36Sopenharmony_ci	  compile-coverage.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciif OF
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciconfig OF_UNITTEST
1662306a36Sopenharmony_ci	bool "Device Tree runtime unit tests"
1762306a36Sopenharmony_ci	depends on !SPARC
1862306a36Sopenharmony_ci	select IRQ_DOMAIN
1962306a36Sopenharmony_ci	select OF_EARLY_FLATTREE
2062306a36Sopenharmony_ci	select OF_RESOLVE
2162306a36Sopenharmony_ci	help
2262306a36Sopenharmony_ci	  This option builds in test cases for the device tree infrastructure
2362306a36Sopenharmony_ci	  that are executed once at boot time, and the results dumped to the
2462306a36Sopenharmony_ci	  console.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	  This option should only be enabled for a development kernel. The tests
2762306a36Sopenharmony_ci	  will taint the kernel with TAINT_TEST. The tests will cause ERROR and
2862306a36Sopenharmony_ci	  WARNING messages to print on the console. The tests will cause stack
2962306a36Sopenharmony_ci	  traces to print on the console.  It is possible that the tests will
3062306a36Sopenharmony_ci	  leave the devicetree in a corrupted state.
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci	  The unittest output will be verbose.  Copy the output to a file
3362306a36Sopenharmony_ci	  via capturing the console output or via the dmesg command.  Process
3462306a36Sopenharmony_ci	  this file with scripts/dtc/of_unittest_expect to reduce the
3562306a36Sopenharmony_ci	  verbosity, test whether expected output is present, and to
3662306a36Sopenharmony_ci	  summarize the results.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	  If unsure, say N here. This option is not safe to enable.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciconfig OF_ALL_DTBS
4162306a36Sopenharmony_ci	bool "Build all Device Tree Blobs"
4262306a36Sopenharmony_ci	depends on COMPILE_TEST
4362306a36Sopenharmony_ci	select DTC
4462306a36Sopenharmony_ci	help
4562306a36Sopenharmony_ci	  This option builds all possible Device Tree Blobs (DTBs) for the
4662306a36Sopenharmony_ci	  current architecture.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci	  If unsure, say N here, but this option is safe to enable.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciconfig OF_FLATTREE
5162306a36Sopenharmony_ci	bool
5262306a36Sopenharmony_ci	select DTC
5362306a36Sopenharmony_ci	select LIBFDT
5462306a36Sopenharmony_ci	select CRC32
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciconfig OF_EARLY_FLATTREE
5762306a36Sopenharmony_ci	bool
5862306a36Sopenharmony_ci	select DMA_DECLARE_COHERENT if HAS_DMA && HAS_IOMEM
5962306a36Sopenharmony_ci	select OF_FLATTREE
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciconfig OF_PROMTREE
6262306a36Sopenharmony_ci	bool
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciconfig OF_KOBJ
6562306a36Sopenharmony_ci	def_bool SYSFS
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci# Hardly any platforms need this.  It is safe to select, but only do so if you
6862306a36Sopenharmony_ci# need it.
6962306a36Sopenharmony_ciconfig OF_DYNAMIC
7062306a36Sopenharmony_ci	bool "Support for dynamic device trees" if OF_UNITTEST
7162306a36Sopenharmony_ci	select OF_KOBJ
7262306a36Sopenharmony_ci	help
7362306a36Sopenharmony_ci	  On some platforms, the device tree can be manipulated at runtime.
7462306a36Sopenharmony_ci	  While this option is selected automatically on such platforms, you
7562306a36Sopenharmony_ci	  can enable it manually to improve device tree unit test coverage.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciconfig OF_ADDRESS
7862306a36Sopenharmony_ci	def_bool y
7962306a36Sopenharmony_ci	depends on !SPARC && (HAS_IOMEM || UML)
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciconfig OF_IRQ
8262306a36Sopenharmony_ci	def_bool y
8362306a36Sopenharmony_ci	depends on !SPARC && IRQ_DOMAIN
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciconfig OF_RESERVED_MEM
8662306a36Sopenharmony_ci	def_bool OF_EARLY_FLATTREE
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciconfig OF_RESOLVE
8962306a36Sopenharmony_ci	bool
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ciconfig OF_OVERLAY
9262306a36Sopenharmony_ci	bool "Device Tree overlays"
9362306a36Sopenharmony_ci	select OF_DYNAMIC
9462306a36Sopenharmony_ci	select OF_FLATTREE
9562306a36Sopenharmony_ci	select OF_RESOLVE
9662306a36Sopenharmony_ci	help
9762306a36Sopenharmony_ci	  Overlays are a method to dynamically modify part of the kernel's
9862306a36Sopenharmony_ci	  device tree with dynamically loaded data.
9962306a36Sopenharmony_ci	  While this option is selected automatically when needed, you can
10062306a36Sopenharmony_ci	  enable it manually to improve device tree unit test coverage.
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciconfig OF_NUMA
10362306a36Sopenharmony_ci	bool
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciendif # OF
106