Skip to content

Commit 2672031

Browse files
cyyselfConchuOD
authored andcommitted
riscv: dts: Move BUILTIN_DTB_SOURCE to common Kconfig
The BUILTIN_DTB_SOURCE was only configured for K210 before. Since SOC_BUILTIN_DTB_DECLARE was removed at commit d5805af ("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 0ddd7ea ("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/[email protected]/ [2] https://lore.kernel.org/linux-riscv/[email protected]/ [3] https://lore.kernel.org/linux-riscv/CAK7LNATt_56mO2Le4v4EnPnAfd3gC8S_Sm5-GCsfa=qXy=8Lrg@mail.gmail.com/ Signed-off-by: Yangyu Chen <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Signed-off-by: Conor Dooley <[email protected]>
1 parent 7921e23 commit 2672031

File tree

8 files changed

+18
-38
lines changed

8 files changed

+18
-38
lines changed

arch/riscv/Kconfig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,19 @@ config RISCV_ISA_FALLBACK
983983
config BUILTIN_DTB
984984
bool "Built-in device tree"
985985
depends on OF && NONPORTABLE
986-
default y if XIP_KERNEL
986+
help
987+
Build a device tree into the Linux image.
988+
This option should be selected if no bootloader is being used.
989+
If unsure, say N.
990+
991+
992+
config BUILTIN_DTB_SOURCE
993+
string "Built-in device tree source"
994+
depends on BUILTIN_DTB
995+
help
996+
DTS file path (without suffix, relative to arch/riscv/boot/dts)
997+
for the DTS file that will be used to produce the DTB linked into the
998+
kernel.
987999

9881000
endmenu # "Boot options"
9891001

arch/riscv/Kconfig.socs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -84,36 +84,4 @@ config SOC_CANAAN
8484
help
8585
This enables support for Canaan Kendryte K210 SoC platform hardware.
8686

87-
if ARCH_CANAAN
88-
89-
config ARCH_CANAAN_K210_DTB_BUILTIN
90-
def_bool SOC_CANAAN_K210_DTB_BUILTIN
91-
92-
config SOC_CANAAN_K210_DTB_BUILTIN
93-
bool "Builtin device tree for the Canaan Kendryte K210"
94-
depends on ARCH_CANAAN
95-
default y
96-
select OF
97-
select BUILTIN_DTB
98-
help
99-
Build a device tree for the Kendryte K210 into the Linux image.
100-
This option should be selected if no bootloader is being used.
101-
If unsure, say Y.
102-
103-
config ARCH_CANAAN_K210_DTB_SOURCE
104-
string
105-
default SOC_CANAAN_K210_DTB_SOURCE
106-
107-
config SOC_CANAAN_K210_DTB_SOURCE
108-
string "Source file for the Canaan Kendryte K210 builtin DTB"
109-
depends on ARCH_CANAAN
110-
depends on ARCH_CANAAN_K210_DTB_BUILTIN
111-
default "k210_generic"
112-
help
113-
Base name (without suffix, relative to arch/riscv/boot/dts/canaan)
114-
for the DTS file that will be used to produce the DTB linked into the
115-
kernel.
116-
117-
endif # ARCH_CANAAN
118-
11987
endmenu # "SoC selection"

arch/riscv/boot/dts/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ subdir-y += sophgo
88
subdir-y += starfive
99
subdir-y += thead
1010

11-
obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
11+
obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))

arch/riscv/boot/dts/canaan/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_bit.dtb
55
dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_dock.dtb
66
dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maix_go.dtb
77
dtb-$(CONFIG_ARCH_CANAAN) += sipeed_maixduino.dtb
8-
9-
obj-$(CONFIG_ARCH_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb.o, $(CONFIG_ARCH_CANAAN_K210_DTB_SOURCE))

arch/riscv/boot/dts/microchip/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-m100pfsevp.dtb
44
dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-polarberry.dtb
55
dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-sev-kit.dtb
66
dtb-$(CONFIG_ARCH_MICROCHIP_POLARFIRE) += mpfs-tysom-m.dtb
7-
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))

arch/riscv/boot/dts/sifive/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
22
dtb-$(CONFIG_ARCH_SIFIVE) += hifive-unleashed-a00.dtb \
33
hifive-unmatched-a00.dtb
4-
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))

arch/riscv/configs/nommu_k210_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ CONFIG_SMP=y
3333
CONFIG_NR_CPUS=2
3434
CONFIG_CMDLINE="earlycon console=ttySIF0"
3535
CONFIG_CMDLINE_FORCE=y
36+
CONFIG_BUILTIN_DTB=y
37+
CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic"
3638
# CONFIG_SECCOMP is not set
3739
# CONFIG_STACKPROTECTOR is not set
3840
# CONFIG_GCC_PLUGINS is not set

arch/riscv/configs/nommu_k210_sdcard_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CONFIG_SMP=y
2525
CONFIG_NR_CPUS=2
2626
CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro"
2727
CONFIG_CMDLINE_FORCE=y
28+
CONFIG_BUILTIN_DTB=y
29+
CONFIG_BUILTIN_DTB_SOURCE="canaan/k210_generic"
2830
# CONFIG_SECCOMP is not set
2931
# CONFIG_STACKPROTECTOR is not set
3032
# CONFIG_GCC_PLUGINS is not set

0 commit comments

Comments
 (0)