]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
riscv: dts: Move BUILTIN_DTB_SOURCE to common Kconfig
authorYangyu Chen <cyy@cyyself.name>
Wed, 28 Feb 2024 08:52:54 +0000 (16:52 +0800)
committerConor Dooley <conor.dooley@microchip.com>
Wed, 6 Mar 2024 00:08:32 +0000 (00:08 +0000)
The BUILTIN_DTB_SOURCE was only configured for K210 before. Since
SOC_BUILTIN_DTB_DECLARE was removed at commit d5805af9fe9f ("riscv: Fix
builtin DTB handling") from patch [1], the kernel cannot choose one of the
dtbs from then on and always take the first one dtb to use. Then, another
commit 0ddd7eaffa64 ("riscv: Fix BUILTIN_DTB for sifive and microchip soc")
from patch [2] supports BUILTIN_DTB_SOURCE for other SoCs. However, this
feature will only work if the Kconfig we use links the dtb we expected in
the first place as mentioned in the thread [3]. Thus, a config
BUILTIN_DTB_SOURCE is needed for all SoCs to choose one dtb to use.

For some considerations, this patch also removes default y if XIP_KERNEL
for BUILTIN_DTB, as this requires setting a proper dtb to use on the
BUILTIN_DTB_SOURCE, else the kernel with XIP but does not set
BUILTIN_DTB_SOURCE or unselect BUILTIN_DTB will not boot.

Also, this patch removes the default dtb string for k210 from Kconfig to
nommu_k210_defconfig and nommu_k210_sdcard_defconfig to avoid complex
Kconfig settings for other SoCs in the future.

[1] https://lore.kernel.org/linux-riscv/20201208073355.40828-5-damien.lemoal@wdc.com/
[2] https://lore.kernel.org/linux-riscv/20210604120639.1447869-1-alex@ghiti.fr/
[3] https://lore.kernel.org/linux-riscv/CAK7LNATt_56mO2Le4v4EnPnAfd3gC8S_Sm5-GCsfa=qXy=8Lrg@mail.gmail.com/

Signed-off-by: Yangyu Chen <cyy@cyyself.name>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
arch/riscv/Kconfig
arch/riscv/Kconfig.socs
arch/riscv/boot/dts/Makefile
arch/riscv/boot/dts/canaan/Makefile
arch/riscv/boot/dts/microchip/Makefile
arch/riscv/boot/dts/sifive/Makefile
arch/riscv/configs/nommu_k210_defconfig
arch/riscv/configs/nommu_k210_sdcard_defconfig

index bffbd869a0682842883591788da784648acf1626..302f70cc338c54ec530c4b490356100a858c2d11 100644 (file)
@@ -983,7 +983,19 @@ config RISCV_ISA_FALLBACK
 config BUILTIN_DTB
        bool "Built-in device tree"
        depends on OF && NONPORTABLE
-       default y if XIP_KERNEL
+       help
+         Build a device tree into the Linux image.
+         This option should be selected if no bootloader is being used.
+         If unsure, say N.
+
+
+config BUILTIN_DTB_SOURCE
+       string "Built-in device tree source"
+       depends on BUILTIN_DTB
+       help
+         DTS file path (without suffix, relative to arch/riscv/boot/dts)
+         for the DTS file that will be used to produce the DTB linked into the
+         kernel.
 
 endmenu # "Boot options"
 
index e08e91c49abecf3838a90a8ce8d72b7ca1c90585..623de5f8a2089848372c9ccd314b66db4f8236d4 100644 (file)
@@ -84,36 +84,4 @@ config SOC_CANAAN
        help
          This enables support for Canaan Kendryte K210 SoC platform hardware.
 
-if ARCH_CANAAN
-
-config ARCH_CANAAN_K210_DTB_BUILTIN
-       def_bool SOC_CANAAN_K210_DTB_BUILTIN
-
-config SOC_CANAAN_K210_DTB_BUILTIN
-       bool "Builtin device tree for the Canaan Kendryte K210"
-       depends on ARCH_CANAAN
-       default y
-       select OF
-       select BUILTIN_DTB
-       help
-         Build a device tree for the Kendryte K210 into the Linux image.
-         This option should be selected if no bootloader is being used.
-         If unsure, say Y.
-
-config ARCH_CANAAN_K210_DTB_SOURCE
-       string
-       default SOC_CANAAN_K210_DTB_SOURCE
-
-config SOC_CANAAN_K210_DTB_SOURCE
-       string "Source file for the Canaan Kendryte K210 builtin DTB"
-       depends on ARCH_CANAAN
-       depends on ARCH_CANAAN_K210_DTB_BUILTIN
-       default "k210_generic"
-       help
-         Base name (without suffix, relative to arch/riscv/boot/dts/canaan)
-         for the DTS file that will be used to produce the DTB linked into the
-         kernel.
-
-endif # ARCH_CANAAN
-
 endmenu # "SoC selection"
index 72030fd727af64be783c19d0c4654c9c10e89caf..fdae05bbf5563e1caf3a2b870b35841479fb77bb 100644 (file)
@@ -8,4 +8,4 @@ subdir-y += sophgo
 subdir-y += starfive
 subdir-y += thead
 
-obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
+obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
index 520623264c87a5c0d2bb64425b2a0afc5b9e0e99..987d1f0c41f0e8473bafede018a6d8ba1a58fd08 100644 (file)
@@ -5,5 +5,3 @@ dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_bit.dtb
 dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_dock.dtb
 dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_go.dtb
 dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maixduino.dtb
-
-obj-$(CONFIG_ARCH_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb.o, $(CONFIG_ARCH_CANAAN_K210_DTB_SOURCE))
index 45adc4926e799d0d2a602a4b4bdf330b12a50693..e177815bf1a2f56937141d696d90383558e89bf6 100644 (file)
@@ -4,4 +4,3 @@ dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-m100pfsevp.dtb
 dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-polarberry.dtb
 dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-sev-kit.dtb
 dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-tysom-m.dtb
-obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
index 6a5fbd4ed96a09e4a10e21b74f1ddde32f5dca5d..495bf760a909c8b0a6921f23acb685aa7af2832d 100644 (file)
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_SIFIVE) += hifive-unleashed-a00.dtb \
                             hifive-unmatched-a00.dtb
-obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
index 146c46d0525b4afd7a298dcc612715a23b4daea0..7e75200543f453eadeec1bce6214d6a9d9e9a325 100644 (file)
@@ -33,6 +33,8 @@ CONFIG_SMP=y
 CONFIG_NR_CPUS=2
 CONFIG_CMDLINE="earlycon console=ttySIF0"
 CONFIG_CMDLINE_FORCE=y
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic"
 # CONFIG_SECCOMP is not set
 # CONFIG_STACKPROTECTOR is not set
 # CONFIG_GCC_PLUGINS is not set
index 95d8d1808f194dfd4c38c4993a919f603b3e7343..0ba353e9ca71eebc91fbcb19dcda95d66613459a 100644 (file)
@@ -25,6 +25,8 @@ CONFIG_SMP=y
 CONFIG_NR_CPUS=2
 CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro"
 CONFIG_CMDLINE_FORCE=y
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic"
 # CONFIG_SECCOMP is not set
 # CONFIG_STACKPROTECTOR is not set
 # CONFIG_GCC_PLUGINS is not set