summaryrefslogtreecommitdiff
path: root/drivers/of/Kconfig
diff options
context:
space:
mode:
authorFrank Rowand <frowand.list@gmail.com>2024-02-17 04:05:51 +0300
committerRob Herring <robh@kernel.org>2024-03-08 21:50:39 +0300
commit7b937cc243e5b1df8780a0aa743ce800df6c68d1 (patch)
tree24e9c7b552d99ba89f96c3af21017913e996ec1c /drivers/of/Kconfig
parentdc1460fe1b2dc883195d21759676d55b183fd495 (diff)
downloadlinux-7b937cc243e5b1df8780a0aa743ce800df6c68d1.tar.xz
of: Create of_root if no dtb provided by firmware
When enabling CONFIG_OF on a platform where 'of_root' is not populated by firmware, we end up without a root node. In order to apply overlays and create subnodes of the root node, we need one. Create this root node by unflattening an empty builtin dtb. If firmware provides a flattened device tree (FDT) then the FDT is unflattened via setup_arch(). Otherwise, the call to unflatten(_and_copy)?_device_tree() will create an empty root node. We make of_have_populated_dt() return true only if the DTB was loaded by firmware so that existing callers don't change behavior after this patch. The call in the of platform code is removed because it prevents overlays from creating platform devices when the empty root node is used. [sboyd@kernel.org: Update of_have_populated_dt() to treat this empty dtb as not populated. Drop setup_of() initcall] Signed-off-by: Frank Rowand <frowand.list@gmail.com> Link: https://lore.kernel.org/r/20230317053415.2254616-2-frowand.list@gmail.com Cc: Rob Herring <robh+dt@kernel.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20240217010557.2381548-3-sboyd@kernel.org Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/Kconfig')
-rw-r--r--drivers/of/Kconfig5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index da9826accb1b..d738fbad9c36 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -14,9 +14,8 @@ if OF
config OF_UNITTEST
bool "Device Tree runtime unit tests"
- depends on !SPARC
+ depends on OF_EARLY_FLATTREE
select IRQ_DOMAIN
- select OF_EARLY_FLATTREE
select OF_RESOLVE
help
This option builds in test cases for the device tree infrastructure
@@ -54,7 +53,7 @@ config OF_FLATTREE
select CRC32
config OF_EARLY_FLATTREE
- bool
+ def_bool OF && !(SPARC || ALPHA || HEXAGON || M68K || PARISC || S390)
select DMA_DECLARE_COHERENT if HAS_DMA && HAS_IOMEM
select OF_FLATTREE