From f34cf05347325515527ea9fdb658cf8063354aea Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Thu, 9 Apr 2026 10:23:10 +0530 Subject: [PATCH] platform: Remove kendryte/k210 platform The kendryte/k210 platform does not have MMU support in S-mode hence only NOMMU kernel which runs in M-mode can be used on this platform. As of now, there is no clear use-case of supporting OpenSBI for kendryte/k210 platform. Signed-off-by: Anup Patel Link: https://lore.kernel.org/r/20260409045310.2045739-1-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel --- README.md | 1 - docs/platform/platform.md | 3 - platform/kendryte/k210/Kconfig | 10 -- platform/kendryte/k210/configs/defconfig | 0 platform/kendryte/k210/k210.dts | 70 --------- platform/kendryte/k210/objects.mk | 25 ---- platform/kendryte/k210/platform.c | 176 ----------------------- platform/kendryte/k210/platform.h | 50 ------- scripts/create-binary-archive.sh | 1 - 9 files changed, 336 deletions(-) delete mode 100644 platform/kendryte/k210/Kconfig delete mode 100644 platform/kendryte/k210/configs/defconfig delete mode 100644 platform/kendryte/k210/k210.dts delete mode 100644 platform/kendryte/k210/objects.mk delete mode 100644 platform/kendryte/k210/platform.c delete mode 100644 platform/kendryte/k210/platform.h diff --git a/README.md b/README.md index fd40be0b..c19bfdde 100644 --- a/README.md +++ b/README.md @@ -402,6 +402,5 @@ make I= install_docs [Firmware Documentation]: docs/firmware/fw.md [Domain Support]: docs/domain_support.md [Doxygen manual]: http://www.doxygen.nl/manual/index.html -[Kendryte standalone SDK]: https://github.com/kendryte/kendryte-standalone-sdk [third party notices]: ThirdPartyNotices.md [reproducible builds]: https://reproducible-builds.org diff --git a/docs/platform/platform.md b/docs/platform/platform.md index b77112ff..9e78dac2 100644 --- a/docs/platform/platform.md +++ b/docs/platform/platform.md @@ -18,9 +18,6 @@ OpenSBI currently supports the following virtual and hardware platforms: machine. More details on this platform can be found in the file *[sifive_fu540.md]*. -* **Kendryte K210 SoC**: Platform support for the Kendryte K210 SoC used on - boards such as the Kendryte KD233 or the Sipeed MAIX Dock. - * **Andes AE350 SoC**: Platform support for the Andes's SoC (AE350). More details on this platform can be found in the file *[andes-ae350.md]*. diff --git a/platform/kendryte/k210/Kconfig b/platform/kendryte/k210/Kconfig deleted file mode 100644 index 5bf59731..00000000 --- a/platform/kendryte/k210/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause - -config PLATFORM_KENDRYTE_K210 - bool - select FDT - select IPI_MSWI - select IRQCHIP_PLIC - select SERIAL_SIFIVE - select TIMER_MTIMER - default y diff --git a/platform/kendryte/k210/configs/defconfig b/platform/kendryte/k210/configs/defconfig deleted file mode 100644 index e69de29b..00000000 diff --git a/platform/kendryte/k210/k210.dts b/platform/kendryte/k210/k210.dts deleted file mode 100644 index bcd075bf..00000000 --- a/platform/kendryte/k210/k210.dts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 Western Digital Corporation or its affiliates. - * - * Authors: - * Damien Le Moal - */ - -/dts-v1/; -/ { - #address-cells = <2>; - #size-cells = <2>; - compatible = "kendryte,k210"; - - chosen { - bootargs = "console=hvc0 earlycon=sbi"; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - cpu0: cpu@0 { - device_type = "cpu"; - clock-frequency = <390000000>; - i-cache-size = <32768>; - d-cache-size = <32768>; - mmu-type = "none"; - reg = <0>; - riscv,isa = "rv64imafdc"; - status = "okay"; - cpu0_intc: interrupt-controller { - #interrupt-cells = <1>; - compatible = "riscv,cpu-intc"; - interrupt-controller; - }; - }; - cpu1: cpu@1 { - device_type = "cpu"; - clock-frequency = <390000000>; - d-cache-size = <32768>; - i-cache-size = <32768>; - mmu-type = "none"; - reg = <1>; - riscv,isa = "rv64imafdc"; - status = "okay"; - cpu1_intc: interrupt-controller { - #interrupt-cells = <1>; - compatible = "riscv,cpu-intc"; - interrupt-controller; - }; - }; - }; - - memory@80000000 { - /* Bank 0: 4 MB, Bank 1: 2 MB, AI chip SRAM: 2MB */ - device_type = "memory"; - reg = <0x00000000 0x80000000 0x00000000 0x00800000>; - }; - - plic0: interrupt-controller@C000000 { - #interrupt-cells = <1>; - compatible = "riscv,plic0"; - interrupt-controller; - interrupts-extended = - <&cpu0_intc 11 &cpu0_intc 9 - &cpu1_intc 11 &cpu1_intc 9>; - reg = <0x0 0xc000000 0x0 0x4000000>; - }; -}; diff --git a/platform/kendryte/k210/objects.mk b/platform/kendryte/k210/objects.mk deleted file mode 100644 index efac3d2f..00000000 --- a/platform/kendryte/k210/objects.mk +++ /dev/null @@ -1,25 +0,0 @@ -# -# SPDX-License-Identifier: BSD-2-Clause -# -# Copyright (c) 2019 Western Digital Corporation or its affiliates. -# -# Authors: -# Damien Le Moal -# - -# Compiler flags -platform-cppflags-y = -platform-cflags-y = -platform-asflags-y = -platform-ldflags-y = - -# Objects to build -platform-objs-y += platform.o - -platform-objs-y += k210.o -platform-varprefix-k210.o = dt_k210 -platform-padding-k210.o = 2048 - -# Blobs to build -FW_PAYLOAD=y -FW_PAYLOAD_ALIGN=0x1000 diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c deleted file mode 100644 index 0b76104c..00000000 --- a/platform/kendryte/k210/platform.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 Western Digital Corporation or its affiliates. - * - * Authors: - * Damien Le Moal - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "platform.h" - -extern const char dt_k210_start[]; - -unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1, - unsigned long arg2, unsigned long arg3, - unsigned long arg4) -{ - return (unsigned long)&dt_k210_start[0]; -} - -static struct plic_data plic = { - .unique_id = 0, - .addr = K210_PLIC_BASE_ADDR, - .size = K210_PLIC_BASE_SIZE, - .num_src = K210_PLIC_NUM_SOURCES, - .context_map = { - [0] = { 0, 1 }, - [1] = { 2, 3 }, - }, -}; - -static struct aclint_mswi_data mswi = { - .addr = K210_ACLINT_MSWI_ADDR, - .size = ACLINT_MSWI_SIZE, - .first_hartid = 0, - .hart_count = K210_HART_COUNT, -}; - -static struct aclint_mtimer_data mtimer = { - .mtime_freq = K210_ACLINT_MTIMER_FREQ, - .mtime_addr = K210_ACLINT_MTIMER_ADDR + - ACLINT_DEFAULT_MTIME_OFFSET, - .mtime_size = ACLINT_DEFAULT_MTIME_SIZE, - .mtimecmp_addr = K210_ACLINT_MTIMER_ADDR + - ACLINT_DEFAULT_MTIMECMP_OFFSET, - .mtimecmp_size = ACLINT_DEFAULT_MTIMECMP_SIZE, - .first_hartid = 0, - .hart_count = K210_HART_COUNT, - .has_64bit_mmio = true, -}; - -static u32 k210_get_clk_freq(void) -{ - u32 clksel0, pll0; - u64 pll0_freq, clkr0, clkf0, clkod0, div; - - /* - * If the clock selector is not set, use the base frequency. - * Otherwise, use PLL0 frequency with a frequency divisor. - */ - clksel0 = k210_read_sysreg(K210_CLKSEL0); - if (!(clksel0 & 0x1)) - return K210_CLK0_FREQ; - - /* - * Get PLL0 frequency: - * freq = base frequency * clkf0 / (clkr0 * clkod0) - */ - pll0 = k210_read_sysreg(K210_PLL0); - clkr0 = 1 + (pll0 & 0x0000000f); - clkf0 = 1 + ((pll0 & 0x000003f0) >> 4); - clkod0 = 1 + ((pll0 & 0x00003c00) >> 10); - pll0_freq = clkf0 * K210_CLK0_FREQ / (clkr0 * clkod0); - - /* Get the frequency divisor from the clock selector */ - div = 2ULL << ((clksel0 & 0x00000006) >> 1); - - return pll0_freq / div; -} - -static int k210_system_reset_check(u32 type, u32 reason) -{ - return 1; -} - -static void k210_system_reset(u32 type, u32 reason) -{ - u32 val; - - val = k210_read_sysreg(K210_RESET); - val |= K210_RESET_MASK; - k210_write_sysreg(val, K210_RESET); - - while (1); -} - -static struct sbi_system_reset_device k210_reset = { - .name = "kendryte_k210_reset", - .system_reset_check = k210_system_reset_check, - .system_reset = k210_system_reset -}; - -static int k210_early_init(bool cold_boot) -{ - int rc; - - if (!cold_boot) - return 0; - - sbi_system_reset_add_device(&k210_reset); - - rc = sifive_uart_init(K210_UART_BASE_ADDR, k210_get_clk_freq(), - K210_UART_BAUDRATE); - if (rc) - return rc; - - return aclint_mswi_cold_init(&mswi); -} - -static int k210_final_init(bool cold_boot) -{ - void *fdt; - - if (!cold_boot) - return 0; - - fdt = fdt_get_address_rw(); - - fdt_cpu_fixup(fdt); - fdt_fixups(fdt); - - return 0; -} - -static int k210_irqchip_init(void) -{ - return plic_cold_irqchip_init(&plic); -} - -static int k210_timer_init(void) -{ - return aclint_mtimer_cold_init(&mtimer, NULL); -} - -const struct sbi_platform_operations platform_ops = { - .early_init = k210_early_init, - - .final_init = k210_final_init, - - .irqchip_init = k210_irqchip_init, - - .timer_init = k210_timer_init, -}; - -const struct sbi_platform platform = { - .opensbi_version = OPENSBI_VERSION, - .platform_version = SBI_PLATFORM_VERSION(0x0, 0x01), - .name = "Kendryte K210", - .features = 0, - .hart_count = K210_HART_COUNT, - .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, - .heap_size = - SBI_PLATFORM_DEFAULT_HEAP_SIZE(K210_HART_COUNT), - .platform_ops_addr = (unsigned long)&platform_ops -}; diff --git a/platform/kendryte/k210/platform.h b/platform/kendryte/k210/platform.h deleted file mode 100644 index 9417403d..00000000 --- a/platform/kendryte/k210/platform.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 Western Digital Corporation or its affiliates. - * - * Authors: - * Damien Le Moal - */ -#ifndef _K210_PLATFORM_H_ -#define _K210_PLATFORM_H_ - -#include - -#define K210_HART_COUNT 2 - -#define K210_UART_BAUDRATE 115200 -#define K210_ACLINT_MTIMER_FREQ 7800000 -#define K210_CLK0_FREQ 26000000UL -#define K210_PLIC_NUM_SOURCES 65 - -/* Registers base address */ -#define K210_SYSCTL_BASE_ADDR 0x50440000ULL -#define K210_UART_BASE_ADDR 0x38000000ULL -#define K210_CLINT_BASE_ADDR 0x02000000ULL -#define K210_ACLINT_MSWI_ADDR \ - (K210_CLINT_BASE_ADDR + CLINT_MSWI_OFFSET) -#define K210_ACLINT_MTIMER_ADDR \ - (K210_CLINT_BASE_ADDR + CLINT_MTIMER_OFFSET) -#define K210_PLIC_BASE_ADDR 0x0C000000ULL -#define K210_PLIC_BASE_SIZE (0x200000ULL + (K210_HART_COUNT * 0x1000)) - -/* Registers */ -#define K210_PLL0 0x08 -#define K210_CLKSEL0 0x20 -#define K210_RESET 0x30 - -/* Register bit masks */ -#define K210_RESET_MASK 0x01 - -static inline u32 k210_read_sysreg(u32 reg) -{ - return readl((volatile void *)(K210_SYSCTL_BASE_ADDR + reg)); -} - -static inline void k210_write_sysreg(u32 val, u32 reg) -{ - writel(val, (volatile void *)(K210_SYSCTL_BASE_ADDR + reg)); -} - -#endif /* _K210_PLATFORM_H_ */ diff --git a/scripts/create-binary-archive.sh b/scripts/create-binary-archive.sh index 6ea4c9c5..7f211788 100755 --- a/scripts/create-binary-archive.sh +++ b/scripts/create-binary-archive.sh @@ -100,7 +100,6 @@ build_opensbi() { 64) # Setup 64-bit platform list BUILD_PLATFORM_SUBDIR+=("nuclei/ux600") - BUILD_PLATFORM_SUBDIR+=("kendryte/k210") BUILD_PLATFORM_SUBDIR+=("generic") ;; *)