mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] kvx: remove architecture support
@ 2026-10-23 20:05 clement.leger
  2026-10-23 20:05 ` [PATCH 1/5] drivers: soc: remove KVX support clement.leger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: clement.leger @ 2026-10-23 20:05 UTC (permalink / raw)
  To: Sascha Hauer, barebox; +Cc: Ahmad Fatoum, Clément Léger

From: Clément Léger <clement.leger@linux.dev>

The barebox kvx port was upstreamed in the hope it was the first one
of a long series of other contributions (GCC, Linux, etc).
Unfortunately, the kvx architecture remained closed and there was no
public specification nor upstreamed compiler. Additionally, there are
no users outside of the company itself and there is not possible to
obtain a board with such SoC. Latest modifications of the architecture
also made it non compatible with this architecture.

As discussed during LPC, there is no point in keeping this
architecture since it is unmaintained and slows down the effort to get
Rust support on barebox. Remove the whole architecture support and
drivers as well.

Clément Léger (5):
  drivers: soc: remove KVX support
  drivers: clocksource: remove KVX timer
  drivers: nvmem: remove KVX OTP support
  drivers: watchdog: remove KVX watchdog
  arch: kvx: remove support

 .github/workflows/build-defconfigs.yml |    2 +-
 Documentation/boards/kvx.rst           |   98 -
 Documentation/gen_magicvars.py         |   19 -
 Documentation/user/barebox.rst         |    1 -
 arch/kvx/Kbuild                        |    5 -
 arch/kvx/Kconfig                       |   67 -
 arch/kvx/Kconfig.debug                 |    2 -
 arch/kvx/Makefile                      |   36 -
 arch/kvx/configs/generic_defconfig     |   14 -
 arch/kvx/cpu/Makefile                  |    7 -
 arch/kvx/cpu/barebox.lds.S             |   88 -
 arch/kvx/cpu/cpu.c                     |   32 -
 arch/kvx/cpu/exception.S               |   35 -
 arch/kvx/cpu/reset.c                   |   68 -
 arch/kvx/cpu/start.S                   |  198 -
 arch/kvx/dts/Makefile                  |    7 -
 arch/kvx/dts/k200.dts                  |  111 -
 arch/kvx/include/asm/barebox.lds.h     |    6 -
 arch/kvx/include/asm/barrier.h         |   20 -
 arch/kvx/include/asm/bitops.h          |   27 -
 arch/kvx/include/asm/bitsperlong.h     |   12 -
 arch/kvx/include/asm/byteorder.h       |   12 -
 arch/kvx/include/asm/cache.h           |   34 -
 arch/kvx/include/asm/common.h          |   28 -
 arch/kvx/include/asm/dma.h             |   30 -
 arch/kvx/include/asm/elf.h             |   21 -
 arch/kvx/include/asm/ftu.h             |   24 -
 arch/kvx/include/asm/io.h              |   14 -
 arch/kvx/include/asm/linkage.h         |   10 -
 arch/kvx/include/asm/mmu.h             |    8 -
 arch/kvx/include/asm/posix_types.h     |   12 -
 arch/kvx/include/asm/privilege.h       |  244 --
 arch/kvx/include/asm/sections.h        |   12 -
 arch/kvx/include/asm/setjmp.h          |   17 -
 arch/kvx/include/asm/sfr.h             |   51 -
 arch/kvx/include/asm/sfr_defs.h        |   17 -
 arch/kvx/include/asm/string.h          |   14 -
 arch/kvx/include/asm/swab.h            |   14 -
 arch/kvx/include/asm/sys_arch.h        |   49 -
 arch/kvx/include/asm/types.h           |   14 -
 arch/kvx/include/asm/unaligned.h       |   17 -
 arch/kvx/include/asm/v1/sfr_defs.h     | 5027 ----------------------
 arch/kvx/include/asm/v2/sfr_defs.h     | 5389 ------------------------
 arch/kvx/include/asm/word-at-a-time.h  |    2 -
 arch/kvx/lib/Makefile                  |    6 -
 arch/kvx/lib/asm-offsets.c             |   11 -
 arch/kvx/lib/board.c                   |  159 -
 arch/kvx/lib/bootm.c                   |  172 -
 arch/kvx/lib/cache.c                   |   25 -
 arch/kvx/lib/cpuinfo.c                 |   20 -
 arch/kvx/lib/dma-default.c             |   61 -
 arch/kvx/lib/dtb.c                     |   14 -
 arch/kvx/lib/poweroff.c                |   56 -
 arch/kvx/lib/setjmp.S                  |   85 -
 arch/kvx/um/Makefile                   |    4 -
 drivers/clocksource/Kconfig            |    4 -
 drivers/clocksource/Makefile           |    1 -
 drivers/clocksource/kvx_timer.c        |   60 -
 drivers/nvmem/Kconfig                  |    7 -
 drivers/nvmem/Makefile                 |    3 -
 drivers/nvmem/kvx-otp-nv.c             |   95 -
 drivers/of/Kconfig                     |    2 +-
 drivers/soc/Kconfig                    |    1 -
 drivers/soc/Makefile                   |    1 -
 drivers/soc/kvx/Kconfig                |   10 -
 drivers/soc/kvx/Makefile               |    1 -
 drivers/soc/kvx/kvx_socinfo.c          |  178 -
 drivers/watchdog/Kconfig               |   17 -
 drivers/watchdog/Makefile              |    1 -
 drivers/watchdog/kvx_wdt.c             |  109 -
 test/Containerfile                     |    7 -
 test/kvx/generic_defconfig.yaml        |   17 -
 72 files changed, 2 insertions(+), 13040 deletions(-)
 delete mode 100644 Documentation/boards/kvx.rst
 delete mode 100644 arch/kvx/Kbuild
 delete mode 100644 arch/kvx/Kconfig
 delete mode 100644 arch/kvx/Kconfig.debug
 delete mode 100644 arch/kvx/Makefile
 delete mode 100644 arch/kvx/configs/generic_defconfig
 delete mode 100644 arch/kvx/cpu/Makefile
 delete mode 100644 arch/kvx/cpu/barebox.lds.S
 delete mode 100644 arch/kvx/cpu/cpu.c
 delete mode 100644 arch/kvx/cpu/exception.S
 delete mode 100644 arch/kvx/cpu/reset.c
 delete mode 100644 arch/kvx/cpu/start.S
 delete mode 100644 arch/kvx/dts/Makefile
 delete mode 100644 arch/kvx/dts/k200.dts
 delete mode 100644 arch/kvx/include/asm/barebox.lds.h
 delete mode 100644 arch/kvx/include/asm/barrier.h
 delete mode 100644 arch/kvx/include/asm/bitops.h
 delete mode 100644 arch/kvx/include/asm/bitsperlong.h
 delete mode 100644 arch/kvx/include/asm/byteorder.h
 delete mode 100644 arch/kvx/include/asm/cache.h
 delete mode 100644 arch/kvx/include/asm/common.h
 delete mode 100644 arch/kvx/include/asm/dma.h
 delete mode 100644 arch/kvx/include/asm/elf.h
 delete mode 100644 arch/kvx/include/asm/ftu.h
 delete mode 100644 arch/kvx/include/asm/io.h
 delete mode 100644 arch/kvx/include/asm/linkage.h
 delete mode 100644 arch/kvx/include/asm/mmu.h
 delete mode 100644 arch/kvx/include/asm/posix_types.h
 delete mode 100644 arch/kvx/include/asm/privilege.h
 delete mode 100644 arch/kvx/include/asm/sections.h
 delete mode 100644 arch/kvx/include/asm/setjmp.h
 delete mode 100644 arch/kvx/include/asm/sfr.h
 delete mode 100644 arch/kvx/include/asm/sfr_defs.h
 delete mode 100644 arch/kvx/include/asm/string.h
 delete mode 100644 arch/kvx/include/asm/swab.h
 delete mode 100644 arch/kvx/include/asm/sys_arch.h
 delete mode 100644 arch/kvx/include/asm/types.h
 delete mode 100644 arch/kvx/include/asm/unaligned.h
 delete mode 100644 arch/kvx/include/asm/v1/sfr_defs.h
 delete mode 100644 arch/kvx/include/asm/v2/sfr_defs.h
 delete mode 100644 arch/kvx/include/asm/word-at-a-time.h
 delete mode 100644 arch/kvx/lib/Makefile
 delete mode 100644 arch/kvx/lib/asm-offsets.c
 delete mode 100644 arch/kvx/lib/board.c
 delete mode 100644 arch/kvx/lib/bootm.c
 delete mode 100644 arch/kvx/lib/cache.c
 delete mode 100644 arch/kvx/lib/cpuinfo.c
 delete mode 100644 arch/kvx/lib/dma-default.c
 delete mode 100644 arch/kvx/lib/dtb.c
 delete mode 100644 arch/kvx/lib/poweroff.c
 delete mode 100644 arch/kvx/lib/setjmp.S
 delete mode 100644 arch/kvx/um/Makefile
 delete mode 100644 drivers/clocksource/kvx_timer.c
 delete mode 100644 drivers/nvmem/kvx-otp-nv.c
 delete mode 100644 drivers/soc/kvx/Kconfig
 delete mode 100644 drivers/soc/kvx/Makefile
 delete mode 100644 drivers/soc/kvx/kvx_socinfo.c
 delete mode 100644 drivers/watchdog/kvx_wdt.c
 delete mode 100644 test/kvx/generic_defconfig.yaml

-- 
2.55.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/5] drivers: soc: remove KVX support
  2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
@ 2026-10-23 20:05 ` clement.leger
  2026-10-23 20:05 ` [PATCH 2/5] drivers: clocksource: remove KVX timer clement.leger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: clement.leger @ 2026-10-23 20:05 UTC (permalink / raw)
  To: Sascha Hauer, barebox; +Cc: Ahmad Fatoum, Clément Léger

From: Clément Léger <clement.leger@linux.dev>

Remove the kvx SoC info driver.

Signed-off-by: Clément Léger <clement.leger@linux.dev>
---
 Documentation/gen_magicvars.py |  19 ----
 drivers/soc/Kconfig            |   1 -
 drivers/soc/Makefile           |   1 -
 drivers/soc/kvx/Kconfig        |  10 --
 drivers/soc/kvx/Makefile       |   1 -
 drivers/soc/kvx/kvx_socinfo.c  | 178 ---------------------------------
 6 files changed, 210 deletions(-)
 delete mode 100644 drivers/soc/kvx/Kconfig
 delete mode 100644 drivers/soc/kvx/Makefile
 delete mode 100644 drivers/soc/kvx/kvx_socinfo.c

diff --git a/Documentation/gen_magicvars.py b/Documentation/gen_magicvars.py
index e2bb020360..142e770c10 100755
--- a/Documentation/gen_magicvars.py
+++ b/Documentation/gen_magicvars.py
@@ -13,12 +13,6 @@ MAGICVAR_CONT = re.compile(r'(.*?)"\s*\)')
 
 UNESCAPE = re.compile(r'''\\(["\\])''')
 
-# Global override dictionary to map directories to specific arch or board
-DIRECTORY_OVERRIDES = {
-    'drivers/soc/kvx': {'arch': 'kvx'},
-}
-
-
 def string_unescape(s):
     return re.sub(UNESCAPE, r'\1', s.replace(r'\t', '').replace(r'\n', ''))
 
@@ -81,19 +75,6 @@ def categorize_file(filepath):
     arch = None
     board = None
     
-    # Check for directory overrides first
-    for override_path, override_spec in DIRECTORY_OVERRIDES.items():
-        override_parts = override_path.split('/')
-        # Check if the filepath starts with the override path
-        if len(parts) >= len(override_parts):
-            if all(parts[i] == override_parts[i] for i in range(len(override_parts))):
-                # This file matches the override path
-                if 'arch' in override_spec:
-                    arch = override_spec['arch']
-                if 'board' in override_spec:
-                    board = override_spec['board']
-                return arch, board
-
     # Check for arch
     if 'arch' in parts:
         arch_idx = parts.index('arch')
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index cbde3c35a4..1fc0efbb3b 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,7 +1,6 @@
 menu "SoC drivers"
 
 source "drivers/soc/imx/Kconfig"
-source "drivers/soc/kvx/Kconfig"
 source "drivers/soc/rockchip/Kconfig"
 source "drivers/soc/ti/Kconfig"
 
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 975304cd50..abe9c38d03 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_ARCH_IMX)		+= imx/
-obj-$(CONFIG_KVX)		+= kvx/
 obj-$(CONFIG_ARCH_ROCKCHIP)	+= rockchip/
 obj-$(CONFIG_CPU_SIFIVE)	+= sifive/
 obj-$(CONFIG_SOC_STARFIVE)	+= starfive/
diff --git a/drivers/soc/kvx/Kconfig b/drivers/soc/kvx/Kconfig
deleted file mode 100644
index 18dcb8ba14..0000000000
--- a/drivers/soc/kvx/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-menu "KVX SoC drivers"
-
-config KVX_SOCINFO
-        bool "KVX SoC Info driver"
-	depends on KVX
-	select NVMEM
-	select KVX_OTP_NV
-	default y
-
-endmenu
diff --git a/drivers/soc/kvx/Makefile b/drivers/soc/kvx/Makefile
deleted file mode 100644
index cacfef21a1..0000000000
--- a/drivers/soc/kvx/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-$(CONFIG_KVX_SOCINFO) += kvx_socinfo.o
diff --git a/drivers/soc/kvx/kvx_socinfo.c b/drivers/soc/kvx/kvx_socinfo.c
deleted file mode 100644
index 9b85af6464..0000000000
--- a/drivers/soc/kvx/kvx_socinfo.c
+++ /dev/null
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Kalray Inc., Clément Léger
- */
-
-#define pr_fmt(fmt) "kvx_socinfo: " fmt
-
-#include <init.h>
-#include <driver.h>
-#include <globalvar.h>
-#include <magicvar.h>
-#include <command.h>
-#include <libfile.h>
-#include <getopt.h>
-#include <common.h>
-#include <fs.h>
-
-#include <asm/sfr.h>
-
-#include <linux/kernel.h>
-#include <linux/nvmem-consumer.h>
-
-#define LOT_ID_STR_LEN	8
-
-#define EWS_LOT_ID_MASK		0x3ffffffffffULL
-#define EWS_WAFER_ID_SHIFT	42
-#define EWS_WAFER_ID_MASK	0x1fULL
-
-#define FT_COM_AP_SHIFT		16
-#define FT_COM_AP_MASK		0x3f
-#define FT_DEVICE_ID_SHIFT	22
-#define FT_DEVICE_ID_MASK	0x1ff
-
-static char *kvx_mppa_id;
-static char *kvx_arch_rev;
-static char *kvx_board_sn;
-
-BAREBOX_MAGICVAR(global.kvx.arch_rev, "KVX architecture revision");
-BAREBOX_MAGICVAR(global.kvx.mppa_id, "KVX MPPA chip id");
-BAREBOX_MAGICVAR(global.kvx.board_sn, "KVX board sn");
-
-static void kvx_soc_info_read_revision(void)
-{
-	u64 pcr = kvx_sfr_get(PCR);
-	u8 sv = kvx_sfr_field_val(pcr, PCR, SV);
-	u8 car = kvx_sfr_field_val(pcr, PCR, CAR);
-	const char *car_str = "", *ver_str = "";
-
-	switch (sv) {
-	case 0:
-	case 1:
-		car_str = "kv3";
-		break;
-	}
-
-	switch (car) {
-	case 0:
-		ver_str = "1";
-		break;
-	case 1:
-		ver_str = "2";
-		break;
-	}
-
-	kvx_arch_rev = basprintf("%s-%s", car_str, ver_str);
-
-	globalvar_add_simple_string("kvx.arch_rev", &kvx_arch_rev);
-}
-
-static int base38_decode(char *s, u64 val, int nb_char)
-{
-	int i;
-	const char alphabet[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
-	const int base = sizeof(alphabet);
-
-	if (s == NULL)
-		return -1;
-
-	for (i = 0; i < nb_char; i++) {
-		s[i] = alphabet[val % base];
-		val /= base;
-	}
-
-	return 0;
-}
-
-static int kvx_read_mppa_id(struct device_node *socinfo)
-{
-	char lot_id[LOT_ID_STR_LEN + 1] = "";
-	char com_ap;
-	u64 *cell_val64;
-	u64 ews_val;
-	u32 *cell_val32;
-	u32 ft_val;
-	u8 wafer_id;
-	u16 device_id;
-
-	cell_val64 = (u64 *) nvmem_cell_get_and_read(socinfo, "ews_fuse", 8);
-	if (IS_ERR(cell_val64)) {
-		pr_debug("Fail to read ews_fuse\n");
-		return PTR_ERR(cell_val64);
-	}
-
-	ews_val = *cell_val64;
-#ifdef CONFIG_ARCH_COOLIDGE_V1
-	/* On kv3-1, 32b regs on traceability are written in reverse order */
-	ews_val = (ews_val >> 32) | (ews_val << 32);
-#endif
-	wafer_id = (ews_val >> EWS_WAFER_ID_SHIFT) & EWS_WAFER_ID_MASK;
-	base38_decode(lot_id, ews_val & EWS_LOT_ID_MASK, LOT_ID_STR_LEN);
-	free(cell_val64);
-
-	cell_val32 = (u32 *) nvmem_cell_get_and_read(socinfo, "ft_fuse", 4);
-	if (IS_ERR(cell_val32)) {
-		pr_debug("Fail to read ft_fuse\n");
-		return PTR_ERR(cell_val32);
-	}
-
-	ft_val = *cell_val32;
-	device_id = (ft_val >> FT_DEVICE_ID_SHIFT) & FT_DEVICE_ID_MASK;
-	base38_decode(&com_ap, (ft_val >> FT_COM_AP_SHIFT) & FT_COM_AP_MASK, 1);
-	free(cell_val32);
-
-	kvx_mppa_id = basprintf("%sA-%dE-%03d", lot_id, wafer_id, device_id);
-
-	globalvar_add_simple_string("kvx.mppa_id", &kvx_mppa_id);
-
-	return 0;
-}
-
-static int kvx_read_board_sn(struct device_node *socinfo)
-{
-	struct nvmem_cell *cell;
-	size_t len;
-	char *sn;
-
-	cell = of_nvmem_cell_get(socinfo, "board_sn");
-	if (IS_ERR(cell)) {
-		pr_debug("Fail to get board_sn cell\n");
-		return PTR_ERR(cell);
-	}
-
-	sn = nvmem_cell_read(cell, &len);
-	nvmem_cell_put(cell);
-	if (IS_ERR(sn)) {
-		pr_debug("Fail to read board_sn\n");
-		return PTR_ERR(sn);
-	}
-
-	kvx_board_sn = xzalloc(len + 1);
-	memcpy(kvx_board_sn, sn, len);
-	globalvar_add_simple_string("kvx.board_sn", &kvx_board_sn);
-	free(sn);
-
-	return 0;
-}
-
-static int kvx_socinfo_probe(struct device *dev)
-{
-	kvx_soc_info_read_revision();
-
-	kvx_read_board_sn(dev->device_node);
-
-	return kvx_read_mppa_id(dev->device_node);
-}
-
-static const struct of_device_id kvx_socinfo_dt_ids[] = {
-	{ .compatible = "kalray,kvx-socinfo" },
-	{ }
-};
-MODULE_DEVICE_TABLE(of, kvx_socinfo_dt_ids);
-
-static struct driver kvx_socinfo_driver = {
-	.name = "kvx-socinfo",
-	.probe = kvx_socinfo_probe,
-	.of_compatible = DRV_OF_COMPAT(kvx_socinfo_dt_ids),
-};
-coredevice_platform_driver(kvx_socinfo_driver);
-- 
2.55.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/5] drivers: clocksource: remove KVX timer
  2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
  2026-10-23 20:05 ` [PATCH 1/5] drivers: soc: remove KVX support clement.leger
@ 2026-10-23 20:05 ` clement.leger
  2026-10-23 20:05 ` [PATCH 3/5] drivers: nvmem: remove KVX OTP support clement.leger
  2026-10-23 20:05 ` [PATCH 4/5] drivers: watchdog: remove KVX watchdog clement.leger
  3 siblings, 0 replies; 5+ messages in thread
From: clement.leger @ 2026-10-23 20:05 UTC (permalink / raw)
  To: Sascha Hauer, barebox; +Cc: Ahmad Fatoum, Clément Léger

From: Clément Léger <clement.leger@linux.dev>

Remove the kvx timer driver.

Signed-off-by: Clément Léger <clement.leger@linux.dev>
---
 drivers/clocksource/Kconfig     |  4 ---
 drivers/clocksource/Makefile    |  1 -
 drivers/clocksource/kvx_timer.c | 60 ---------------------------------
 3 files changed, 65 deletions(-)
 delete mode 100644 drivers/clocksource/kvx_timer.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index b3ad477ce3..ef4ed6f820 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -48,10 +48,6 @@ config CLOCKSOURCE_EFI_X86
 	bool "EFI X86 HW driver"
 	depends on EFI_PAYLOAD && X86
 
-config CLOCKSOURCE_KVX
-	bool "KVX core timer clocksource"
-	depends on KVX
-
 config CLOCKSOURCE_MVEBU
 	bool "MVEBU clock source" if COMPILE_TEST
 	depends on ARCH_MVEBU || COMPILE_TEST
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index ec12e7babb..3850abd6f2 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -6,7 +6,6 @@ obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
 obj-$(CONFIG_CLOCKSOURCE_DIGIC)   += digic.o
 obj-$(CONFIG_CLOCKSOURCE_EFI) += efi.o
 obj-$(CONFIG_CLOCKSOURCE_EFI_X86) += efi_x86.o
-obj-$(CONFIG_CLOCKSOURCE_KVX)     += kvx_timer.o
 obj-$(CONFIG_CLOCKSOURCE_MVEBU)   += mvebu.o
 obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
 obj-$(CONFIG_CLOCKSOURCE_ORION)   += orion.o
diff --git a/drivers/clocksource/kvx_timer.c b/drivers/clocksource/kvx_timer.c
deleted file mode 100644
index eaa8f63b1e..0000000000
--- a/drivers/clocksource/kvx_timer.c
+++ /dev/null
@@ -1,60 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2018 Kalray Inc.
- */
-
-#include <common.h>
-#include <clock.h>
-#include <init.h>
-
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <asm/sfr.h>
-
-static uint64_t kvx_pm_read(void)
-{
-	return kvx_sfr_get(PM0);
-}
-
-static struct clocksource kvx_clksrc = {
-	.read	= kvx_pm_read,
-	.mask	= CLOCKSOURCE_MASK(64),
-	.shift	= 0,
-	.priority = 70,
-};
-
-static int kvx_timer_probe(struct device *dev)
-{
-	struct clk *clk;
-	uint32_t clk_freq;
-
-	/* Get clock frequency */
-	clk = clk_get(dev, NULL);
-	if (IS_ERR(clk)) {
-		dev_err(dev, "Failed to get CPU clock: %ld\n", PTR_ERR(clk));
-		return PTR_ERR(clk);
-	}
-
-	clk_freq = clk_get_rate(clk);
-	clk_put(clk);
-
-	/* Init clocksource */
-	kvx_clksrc.mult = clocksource_hz2mult(clk_freq, kvx_clksrc.shift);
-
-	return init_clock(&kvx_clksrc);
-}
-
-static struct of_device_id kvx_timer_dt_ids[] = {
-	{ .compatible = "kalray,kvx-core-timer", },
-	{ }
-};
-MODULE_DEVICE_TABLE(of, kvx_timer_dt_ids);
-
-static struct driver kvx_timer_driver = {
-	.name = "kvx-timer",
-	.probe = kvx_timer_probe,
-	.of_compatible = DRV_OF_COMPAT(kvx_timer_dt_ids),
-};
-
-postcore_platform_driver(kvx_timer_driver);
-- 
2.55.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/5] drivers: nvmem: remove KVX OTP support
  2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
  2026-10-23 20:05 ` [PATCH 1/5] drivers: soc: remove KVX support clement.leger
  2026-10-23 20:05 ` [PATCH 2/5] drivers: clocksource: remove KVX timer clement.leger
@ 2026-10-23 20:05 ` clement.leger
  2026-10-23 20:05 ` [PATCH 4/5] drivers: watchdog: remove KVX watchdog clement.leger
  3 siblings, 0 replies; 5+ messages in thread
From: clement.leger @ 2026-10-23 20:05 UTC (permalink / raw)
  To: Sascha Hauer, barebox; +Cc: Ahmad Fatoum, Clément Léger

From: Clément Léger <clement.leger@linux.dev>

Remove the kvx OTP driver.

Signed-off-by: Clément Léger <clement.leger@linux.dev>
---
 drivers/nvmem/Kconfig      |  7 ---
 drivers/nvmem/Makefile     |  3 --
 drivers/nvmem/kvx-otp-nv.c | 95 --------------------------------------
 3 files changed, 105 deletions(-)
 delete mode 100644 drivers/nvmem/kvx-otp-nv.c

diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index d66c4a88fe..b7501798cb 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -106,13 +106,6 @@ config STM32_BSEC_OPTEE_TA
 	  trusted application STM32MP BSEC in addition to the older SMC SiP
 	  service.
 
-config KVX_OTP_NV
-	tristate "kalray KVX OTP Non volatile regs Support"
-	depends on KVX
-	help
-	  This is a simple driver to dump specified values of KVX OTP non
-	  volatile regs.
-
 config STARFIVE_OTP
 	tristate "Starfive OTP Support"
 	depends on SOC_STARFIVE
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index cb5e6d6330..8f1bb0bf44 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -28,9 +28,6 @@ obj-$(CONFIG_STM32_BSEC)	+= nvmem_bsec.o
 nvmem_bsec-y			:= bsec.o
 nvmem_bsec-$(CONFIG_STM32_BSEC_OPTEE_TA) += stm32-bsec-optee-ta.o
 
-obj-$(CONFIG_KVX_OTP_NV)	+= nvmem-kvx-otp-nv.o
-nvmem-kvx-otp-nv-y		:= kvx-otp-nv.o
-
 obj-$(CONFIG_NVMEM_ROCKCHIP_OTP)+= rockchip-otp.o
 obj-$(CONFIG_STARFIVE_OTP)	+= starfive-otp.o
 obj-$(CONFIG_IMX_OCOTP_ELE)	+= imx-ocotp-ele.o
diff --git a/drivers/nvmem/kvx-otp-nv.c b/drivers/nvmem/kvx-otp-nv.c
deleted file mode 100644
index c4591f5822..0000000000
--- a/drivers/nvmem/kvx-otp-nv.c
+++ /dev/null
@@ -1,95 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2020 Kalray Inc., Clément Léger
- */
-
-#include <common.h>
-#include <driver.h>
-#include <malloc.h>
-#include <xfuncs.h>
-#include <errno.h>
-#include <init.h>
-#include <net.h>
-#include <io.h>
-
-#include <linux/nvmem-provider.h>
-
-#define OTP_NV_ALIGN		4
-#define OTP_NV_ALIGN_MASK	(OTP_NV_ALIGN - 1)
-
-struct kvx_otp_nv_priv {
-	void __iomem *base;
-};
-
-static int kvx_otp_nv_read(void *context, unsigned int offset,
-			  void *_val, size_t bytes)
-{
-	struct kvx_otp_nv_priv *priv = context;
-	u8 *val = _val;
-	u32 tmp, copy_size;
-	u8 skip = offset & OTP_NV_ALIGN_MASK;
-
-	offset &= ~OTP_NV_ALIGN_MASK;
-
-	while (bytes) {
-		tmp = readl(priv->base + offset);
-		if (skip != 0)
-			copy_size = min(OTP_NV_ALIGN - skip, (int) bytes);
-		else
-			copy_size = min(bytes, sizeof(tmp));
-
-		memcpy(val, ((u8 *) &tmp) + skip, copy_size);
-		skip = 0;
-
-		bytes -= copy_size;
-		val += copy_size;
-		offset += OTP_NV_ALIGN;
-	}
-
-	return 0;
-}
-
-static const struct of_device_id kvx_otp_nv_match[] = {
-	{ .compatible = "kalray,kvx-otp-nv" },
-	{ /* sentinel */},
-};
-MODULE_DEVICE_TABLE(of, kvx_otp_nv_match);
-
-static int kvx_otp_nv_probe(struct device *dev)
-{
-	struct resource *res;
-	struct nvmem_device *nvmem;
-	struct nvmem_config econfig = { 0 };
-	struct kvx_otp_nv_priv *priv;
-
-	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-	if (!priv)
-		return -ENOMEM;
-
-	res = dev_request_mem_resource(dev, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
-
-	priv->base = IOMEM(res->start);
-
-	econfig.name = "kvx-nv-regbank";
-	econfig.stride = 1;
-	econfig.word_size = 1;
-	econfig.size = resource_size(res);
-	econfig.dev = dev;
-	econfig.priv = priv;
-	econfig.reg_read = kvx_otp_nv_read;
-
-	dev->priv = priv;
-
-	nvmem = nvmem_register(&econfig);
-
-	return PTR_ERR_OR_ZERO(nvmem);
-}
-
-static struct driver kvx_otp_nv_driver = {
-	.name	= "kvx-otp-nv",
-	.probe	= kvx_otp_nv_probe,
-	.of_compatible = DRV_OF_COMPAT(kvx_otp_nv_match),
-};
-postcore_platform_driver(kvx_otp_nv_driver);
-- 
2.55.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/5] drivers: watchdog: remove KVX watchdog
  2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
                   ` (2 preceding siblings ...)
  2026-10-23 20:05 ` [PATCH 3/5] drivers: nvmem: remove KVX OTP support clement.leger
@ 2026-10-23 20:05 ` clement.leger
  3 siblings, 0 replies; 5+ messages in thread
From: clement.leger @ 2026-10-23 20:05 UTC (permalink / raw)
  To: Sascha Hauer, barebox; +Cc: Ahmad Fatoum, Clément Léger

From: Clément Léger <clement.leger@linux.dev>

Remove the kvx watchdog driver.

Signed-off-by: Clément Léger <clement.leger@linux.dev>
---
 drivers/watchdog/Kconfig   |  17 ------
 drivers/watchdog/Makefile  |   1 -
 drivers/watchdog/kvx_wdt.c | 109 -------------------------------------
 3 files changed, 127 deletions(-)
 delete mode 100644 drivers/watchdog/kvx_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 14fdb7cf68..068d3c93dd 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -83,23 +83,6 @@ config WATCHDOG_ORION
 	help
 	  Add support for watchdog on the Marvall Armada XP
 
-config WATCHDOG_KVX
-	bool "KVX Core watchdog"
-	depends on KVX
-	help
-	  Add support for the KVX core watchdog.
-
-config WATCHDOG_KVX_EARLY_INIT
-	bool "KVX Core watchdog early init"
-	depends on WATCHDOG_KVX
-	help
-	  Activate the watchdog with early initcall
-
-config WATCHDOG_KVX_EARLY_TIMEOUT
-	int "KVX Core watchdog early timeout in cycles"
-	depends on WATCHDOG_KVX_EARLY_INIT
-	default 100000000
-
 config WATCHDOG_BCM2835
 	bool "Watchdog for BCM283x SoCs"
 	depends on ARCH_BCM283X || COMPILE_TEST
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index c49d090f8d..4b7fd74dfa 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -11,7 +11,6 @@ obj-$(CONFIG_WATCHDOG_JZ4740) += jz4740.o
 obj-$(CONFIG_WATCHDOG_IMX_RESET_SOURCE) += imxwd.o
 obj-$(CONFIG_WATCHDOG_IMX) += imxwd.o
 obj-$(CONFIG_WATCHDOG_IMXULP) += imxulp-wdt.o
-obj-$(CONFIG_WATCHDOG_KVX) += kvx_wdt.o
 obj-$(CONFIG_WATCHDOG_ORION) += orion_wdt.o
 obj-$(CONFIG_ARCH_BCM283X) += bcm2835_wdt.o
 obj-$(CONFIG_RAVE_SP_WATCHDOG) += rave-sp-wdt.o
diff --git a/drivers/watchdog/kvx_wdt.c b/drivers/watchdog/kvx_wdt.c
deleted file mode 100644
index 3e66aa38ba..0000000000
--- a/drivers/watchdog/kvx_wdt.c
+++ /dev/null
@@ -1,109 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2018 Kalray Inc.
- */
-
-#include <common.h>
-#include <init.h>
-#include <io.h>
-#include <of.h>
-#include <watchdog.h>
-
-#include <linux/clk.h>
-#include <linux/err.h>
-
-#include <asm/sfr.h>
-
-struct kvx_wdt {
-	uint64_t clk_rate;
-	struct watchdog wdd;
-};
-
-static void kvx_watchdog_disable(void)
-{
-	kvx_sfr_set_field(TCR, WUI, 0);
-	kvx_sfr_set_field(TCR, WCE, 0);
-}
-
-static int kvx_wdt_set_timeout(struct watchdog *wdd, unsigned int timeout)
-{
-	struct kvx_wdt *wdt = container_of(wdd, struct kvx_wdt, wdd);
-	uint64_t cycle_timeout = wdt->clk_rate * timeout;
-
-	/* Disable watchdog */
-	if (timeout == 0) {
-		kvx_watchdog_disable();
-		return 0;
-	}
-
-	kvx_sfr_set(WDV, cycle_timeout);
-	kvx_sfr_set(WDR, 0);
-
-	/* Start watchdog counting */
-	kvx_sfr_set_field(TCR, WUI, 1);
-	kvx_sfr_set_field(TCR, WCE, 1);
-
-	return 0;
-}
-
-static int count;
-
-static int kvx_wdt_drv_probe(struct device *dev)
-{
-	struct watchdog *wdd;
-	struct clk *clk;
-	struct kvx_wdt *kvx_wdt;
-
-	if (count != 0) {
-		dev_warn(dev, "Tried to register core watchdog twice\n");
-		return -EINVAL;
-	}
-	count++;
-
-	kvx_wdt = xzalloc(sizeof(*kvx_wdt));
-	clk = clk_get(dev, NULL);
-	if (IS_ERR(clk))
-		return PTR_ERR(clk);
-
-	kvx_wdt->clk_rate = clk_get_rate(clk);
-	clk_put(clk);
-
-	wdd = &kvx_wdt->wdd;
-	wdd->name = "kvx_wdt";
-	wdd->hwdev = dev;
-	wdd->set_timeout = kvx_wdt_set_timeout;
-
-	/* Be sure that interrupt are disabled */
-	kvx_sfr_set_field(TCR, WIE, 0);
-
-	return watchdog_register(wdd);
-}
-
-static struct of_device_id kvx_wdt_of_match[] = {
-	{ .compatible = "kalray,kvx-core-watchdog", },
-	{ /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, kvx_wdt_of_match);
-
-static struct driver kvx_wdt_driver = {
-	.name		= "kvx-wdt",
-	.probe		= kvx_wdt_drv_probe,
-	.of_compatible	= DRV_OF_COMPAT(kvx_wdt_of_match),
-};
-device_platform_driver(kvx_wdt_driver);
-
-#ifdef CONFIG_WATCHDOG_KVX_EARLY_INIT
-static int kvx_wdt_early_init(void)
-{
-	/* Set Start watchdog counting */
-	kvx_sfr_set(WDV, CONFIG_WATCHDOG_KVX_EARLY_TIMEOUT);
-	kvx_sfr_set(WDR, 0);
-
-	/* Start watchdog counting */
-	kvx_sfr_set_field(TCR, WUI, 1);
-	kvx_sfr_set_field(TCR, WCE, 1);
-
-	return 0;
-}
-core_initcall(kvx_wdt_early_init);
-#endif
-- 
2.55.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-23 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
2026-10-23 20:05 ` [PATCH 1/5] drivers: soc: remove KVX support clement.leger
2026-10-23 20:05 ` [PATCH 2/5] drivers: clocksource: remove KVX timer clement.leger
2026-10-23 20:05 ` [PATCH 3/5] drivers: nvmem: remove KVX OTP support clement.leger
2026-10-23 20:05 ` [PATCH 4/5] drivers: watchdog: remove KVX watchdog clement.leger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox