riscv: Kconfig.socs: Split ARCH_CANAAN and SOC_CANAAN_K210
authorYangyu Chen <cyy@cyyself.name>
Thu, 28 Mar 2024 17:06:09 +0000 (01:06 +0800)
committerConor Dooley <conor.dooley@microchip.com>
Fri, 5 Apr 2024 15:42:50 +0000 (16:42 +0100)
Since SOC_FOO should be deprecated from patch [1], and cleanup for other
SoCs is already in the mailing list [2,3,4], we remove the use of
SOC_CANAAN and use ARCH_CANAAN for SoCs vendored by Canaan instead from now
on. And allows ARCH_CANAAN to be selected for other Canaan SoCs. However,
we should keep the config SOC_CANAAN and use def_bool to redirect the
symbol temporarily to avoid potential conflict.

Since we now have Canaan Kendryte K230 with MMU, ARCH_CANAAN is no longer
referred to as K210. There are some special features for K210, like M-Mode
No MMU and loader.bin in arch/riscv/Makefile. If we keep ARCH_CANAAN for
other Canaan SoCs and remove the K210, the depends on !MMU in Kconfig may
confuse some users who try to boot Kernel with MMU on K210, as Damien
mentioned in the list [5]. Thus, we introduce a new symbol SOC_CANAAN_K210
for any conditional code or driver selection specific to the K210, so users
will not try to build some K210-specific things when MMU is enabled and see
it fails to boot on K210.

[1] https://lore.kernel.org/linux-riscv/20221121221414.109965-1-conor@kernel.org/
[2] https://lore.kernel.org/linux-riscv/20240305-praying-clad-c4fbcaa7ed0a@spud/
[3] https://lore.kernel.org/linux-riscv/20240305-fled-undrilled-41dc0c46bb29@spud/
[4] https://lore.kernel.org/linux-riscv/20240305-stress-earflap-d7ddb8655a4d@spud/
[5] https://lore.kernel.org/linux-riscv/2b0511af-1b5b-4c90-a673-c9113bb58142@kernel.org/

Signed-off-by: Yangyu Chen <cyy@cyyself.name>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
arch/riscv/Kconfig.socs
arch/riscv/Makefile
arch/riscv/configs/nommu_k210_defconfig
arch/riscv/configs/nommu_k210_sdcard_defconfig

index 623de5f8a2089848372c9ccd314b66db4f8236d4..17340aa4dcfc2421d9aae9105ef29ceb10e850db 100644 (file)
@@ -72,11 +72,17 @@ config SOC_VIRT
          This enables support for QEMU Virt Machine.
 
 config ARCH_CANAAN
-       def_bool SOC_CANAAN
+       bool "Canaan Kendryte SoC"
+       help
+         This enables support for Canaan Kendryte series SoC platform hardware.
 
 config SOC_CANAAN
+       def_bool SOC_CANAAN_K210
+       depends on ARCH_CANAAN
+
+config SOC_CANAAN_K210
        bool "Canaan Kendryte K210 SoC"
-       depends on !MMU
+       depends on !MMU && ARCH_CANAAN
        select CLINT_TIMER if RISCV_M_MODE
        select ARCH_HAS_RESET_CONTROLLER
        select PINCTRL
index 252d63942f34ebe08a3087d12bee3a1c4833f15a..fa6c389c3986379379877ecf74ed47b6381f8828 100644 (file)
@@ -154,7 +154,7 @@ vdso-install-y                      += arch/riscv/kernel/vdso/vdso.so.dbg
 vdso-install-$(CONFIG_COMPAT)  += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so
 
 ifneq ($(CONFIG_XIP_KERNEL),y)
-ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
+ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
 KBUILD_IMAGE := $(boot)/loader.bin
 else
 ifeq ($(CONFIG_EFI_ZBOOT),)
index 7e75200543f453eadeec1bce6214d6a9d9e9a325..2552e78074a369d5f8a3a5e975b8cc9535922377 100644 (file)
@@ -27,7 +27,8 @@ CONFIG_EXPERT=y
 CONFIG_SLUB=y
 CONFIG_SLUB_TINY=y
 # CONFIG_MMU is not set
-CONFIG_SOC_CANAAN=y
+CONFIG_ARCH_CANAAN=y
+CONFIG_SOC_CANAAN_K210=y
 CONFIG_NONPORTABLE=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2
index 0ba353e9ca71eebc91fbcb19dcda95d66613459a..8f67fb8305853d2182cf56625ebccee3440d5b45 100644 (file)
@@ -19,7 +19,8 @@ CONFIG_EXPERT=y
 CONFIG_SLUB=y
 CONFIG_SLUB_TINY=y
 # CONFIG_MMU is not set
-CONFIG_SOC_CANAAN=y
+CONFIG_ARCH_CANAAN=y
+CONFIG_SOC_CANAAN_K210=y
 CONFIG_NONPORTABLE=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2