From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Peter Griffin" <peter.griffin@linaro.org>,
"André Draszik" <andre.draszik@linaro.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
semen.protsenko@linaro.org, willmcvicker@google.com,
kernel-team@android.com, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
Tudor Ambarus <tudor.ambarus@linaro.org>
Subject: [PATCH 07/11] soc: samsung: exynos-chipid: add support for google,gs101-chipid
Date: Fri, 31 Oct 2025 12:56:06 +0000 [thread overview]
Message-ID: <20251031-gs101-chipid-v1-7-d78d1076b210@linaro.org> (raw)
In-Reply-To: <20251031-gs101-chipid-v1-0-d78d1076b210@linaro.org>
GS101 reads the Product ID and the Chip ID from the OTP controller
registers. Add suppot for google,gs101-chipid.
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
drivers/soc/samsung/exynos-chipid.c | 76 +++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 5678bc85c4d93547e446caade64a0b650d06a332..9c43c615167e4bbf15d00d42c2e52cc64d7dae1a 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -13,10 +13,12 @@
*/
#include <linux/array_size.h>
+#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
+#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -26,6 +28,11 @@
#include "exynos-asv.h"
+#define EXYNOS_GS101_MAIN_REV GENMASK(3, 0)
+#define EXYNOS_GS101_SUB_REV GENMASK(19, 16)
+#define EXYNOS_GS101_CHIP_ID_SIZE 16
+#define EXYNOS_GS101_PRODUCT_ID_SIZE 4
+
struct exynos_chipid_info {
struct regmap *regmap;
struct device *dev;
@@ -73,6 +80,8 @@ static const struct exynos_soc_id {
{ "EXYNOS990", 0xE9830000 },
{ "EXYNOSAUTOV9", 0xAAA80000 },
{ "EXYNOSAUTOV920", 0x0A920000 },
+ /* Compatible with: google,gs101-chipid */
+ { "GS101", 0x09845000 },
};
static const char *product_id_to_soc_id(unsigned int product_id)
@@ -85,6 +94,66 @@ static const char *product_id_to_soc_id(unsigned int product_id)
return NULL;
}
+static int exynos_chipid_get_efuse_data(struct device *dev,
+ const char *nvmem_cell_name,
+ u32 **efuse, size_t *size,
+ size_t expected_size)
+{
+ struct nvmem_cell *cell;
+
+ cell = nvmem_cell_get(dev, nvmem_cell_name);
+ if (IS_ERR(cell)) {
+ dev_err(dev, "no \"%s\"? %ld\n", nvmem_cell_name,
+ PTR_ERR(cell));
+ return PTR_ERR(cell);
+ }
+
+ *efuse = nvmem_cell_read(cell, size);
+ nvmem_cell_put(cell);
+ if (IS_ERR(*efuse))
+ return PTR_ERR(*efuse);
+
+ if (*size != expected_size) {
+ dev_err(dev, "Invalid efuse data size %zu\n", *size);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int exynos_chipid_get_efuse_chipid_info(const struct exynos_chipid_variant *data,
+ struct exynos_chipid_info *exynos_chipid)
+{
+ struct device *dev = exynos_chipid->dev;
+ size_t product_id_size, chip_id_size;
+ u32 *product_id, *chip_id;
+ u32 main_rev, sub_rev;
+ int ret;
+
+ ret = exynos_chipid_get_efuse_data(dev, "product-id", &product_id,
+ &product_id_size,
+ EXYNOS_GS101_PRODUCT_ID_SIZE);
+ if (ret)
+ return ret;
+
+ ret = exynos_chipid_get_efuse_data(dev, "chip-id", &chip_id,
+ &chip_id_size,
+ EXYNOS_GS101_CHIP_ID_SIZE);
+ if (ret)
+ return ret;
+
+ exynos_chipid->product_id = product_id[0] & EXYNOS_MASK;
+
+ main_rev = FIELD_GET(EXYNOS_GS101_MAIN_REV, product_id[0]);
+ sub_rev = FIELD_GET(EXYNOS_GS101_SUB_REV, chip_id[3]);
+ exynos_chipid->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;
+
+ kfree(product_id);
+ kfree(chip_id);
+
+ return 0;
+}
+
static int exynos_chipid_get_regmap_chipid_info(const struct exynos_chipid_variant *data,
struct exynos_chipid_info *exynos_chipid)
{
@@ -191,6 +260,10 @@ static void exynos_chipid_remove(struct platform_device *pdev)
soc_device_unregister(soc_dev);
}
+static const struct exynos_chipid_variant gs101_chipid_data = {
+ .get_chipid_info = exynos_chipid_get_efuse_chipid_info,
+};
+
static const struct exynos_chipid_variant exynos4210_chipid_data = {
.get_chipid_info = exynos_chipid_get_regmap_chipid_info,
.rev_reg = 0x0,
@@ -209,6 +282,9 @@ static const struct exynos_chipid_variant exynos850_chipid_data = {
static const struct of_device_id exynos_chipid_of_device_ids[] = {
{
+ .compatible = "google,gs101-chipid",
+ .data = &gs101_chipid_data,
+ }, {
.compatible = "samsung,exynos4210-chipid",
.data = &exynos4210_chipid_data,
}, {
--
2.51.1.930.gacf6e81ea2-goog
next prev parent reply other threads:[~2025-10-31 12:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 12:55 [PATCH 00/11] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
2025-10-31 12:56 ` [PATCH 01/11] dt-bindings: hwinfo: samsung,exynos-chipid: add google,gs101 compatible Tudor Ambarus
2025-11-03 9:58 ` Krzysztof Kozlowski
2025-10-31 12:56 ` [PATCH 02/11] soc: samsung: exynos-chipid: use a local dev variable Tudor Ambarus
2025-11-03 10:02 ` (subset) " Krzysztof Kozlowski
2025-10-31 12:56 ` [PATCH 03/11] soc: samsung: exynos-chipid: use heap allocated driver data Tudor Ambarus
2025-11-03 10:03 ` Krzysztof Kozlowski
2025-10-31 12:56 ` [PATCH 04/11] soc: samsung: exynos-chipid: refer to match->data as data Tudor Ambarus
2025-11-03 10:05 ` Krzysztof Kozlowski
2025-10-31 12:56 ` [PATCH 05/11] soc: samsung: exynos-chipid: introduce match_data->get_chipid_info() Tudor Ambarus
2025-11-03 10:15 ` Krzysztof Kozlowski
2025-10-31 12:56 ` [PATCH 06/11] soc: samsung: exynos-chipid: make asv_init opt-in Tudor Ambarus
2025-10-31 12:56 ` Tudor Ambarus [this message]
2025-10-31 12:56 ` [PATCH 08/11] soc: samsung: exynos-chipid: prepend exynos_ to a method's name Tudor Ambarus
2025-10-31 12:56 ` [PATCH 09/11] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
2025-10-31 12:56 ` [PATCH 10/11] arm64: dts: exynos: gs101: add the chipid node Tudor Ambarus
2025-11-03 10:18 ` Krzysztof Kozlowski
2025-11-03 10:50 ` Tudor Ambarus
2025-11-03 11:01 ` Krzysztof Kozlowski
2025-11-03 11:26 ` Tudor Ambarus
2025-11-04 7:14 ` Krzysztof Kozlowski
2025-11-10 9:28 ` Tudor Ambarus
2025-10-31 12:56 ` [PATCH 11/11] arm64: defconfig: enable Samsung Exynos chipid driver Tudor Ambarus
2025-11-03 10:14 ` Krzysztof Kozlowski
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=20251031-gs101-chipid-v1-7-d78d1076b210@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel-team@android.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=willmcvicker@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).