From: clement.leger@linux.dev
To: Sascha Hauer <s.hauer@pengutronix.de>, barebox@lists.infradead.org
Cc: "Ahmad Fatoum" <a.fatoum@barebox.org>,
"Clément Léger" <clement.leger@linux.dev>
Subject: [PATCH 1/5] drivers: soc: remove KVX support
Date: Fri, 23 Oct 2026 22:05:03 +0200 [thread overview]
Message-ID: <20261023200507.63716-2-clement.leger@linux.dev> (raw)
In-Reply-To: <20261023200507.63716-1-clement.leger@linux.dev>
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
next prev parent reply other threads:[~2026-10-23 20:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 20:05 [PATCH 0/5] kvx: remove architecture support clement.leger
2026-10-23 20:05 ` clement.leger [this message]
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
2026-10-26 10:01 ` [PATCH 0/5] kvx: remove architecture support Sascha Hauer
2026-10-26 15:28 ` Clement Leger
2026-10-26 10:01 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023200507.63716-2-clement.leger@linux.dev \
--to=clement.leger@linux.dev \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.