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 05/11] soc: samsung: exynos-chipid: introduce match_data->get_chipid_info()
Date: Fri, 31 Oct 2025 12:56:04 +0000 [thread overview]
Message-ID: <20251031-gs101-chipid-v1-5-d78d1076b210@linaro.org> (raw)
In-Reply-To: <20251031-gs101-chipid-v1-0-d78d1076b210@linaro.org>
Newer SoCs, like GS101, don't have a dedicated Chip ID controller.
The GS101 Chip ID info is available as part of the OTP controller
registers, among other things. For GS101 we will read the Chip ID from
the OTP controller using the nvmem API.
Extend the match_data with a get_chipid_info() method, to allow nvmem
integration.
`struct exynos_chipid_info` is moved to the top of the file to avoid a
forward declaration. The structure is extended with pointers to device
and regmap to allow current implementation to obtain the regmap in the
newly introduced exynos_chipid_get_regmap_chipid_info() method. The
nvmem consumer support that will follow won't use the regmap, and
instead will use the nvmem API. It will need the pointer to the device
to report errors.
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
drivers/soc/samsung/exynos-chipid.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index ab6bdf24a754a0faf974190c1fa1f99735cbef8e..7b1951f28e8d4958ab941af91dab4b0183ceda5f 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -26,17 +26,21 @@
#include "exynos-asv.h"
+struct exynos_chipid_info {
+ struct regmap *regmap;
+ struct device *dev;
+ u32 product_id;
+ u32 revision;
+};
+
struct exynos_chipid_variant {
+ int (*get_chipid_info)(const struct exynos_chipid_variant *data,
+ struct exynos_chipid_info *exynos_chipid);
unsigned int rev_reg; /* revision register offset */
unsigned int main_rev_shift; /* main revision offset in rev_reg */
unsigned int sub_rev_shift; /* sub revision offset in rev_reg */
};
-struct exynos_chipid_info {
- u32 product_id;
- u32 revision;
-};
-
static const struct exynos_soc_id {
const char *name;
unsigned int id;
@@ -80,13 +84,19 @@ static const char *product_id_to_soc_id(unsigned int product_id)
return NULL;
}
-static int exynos_chipid_get_chipid_info(struct regmap *regmap,
- const struct exynos_chipid_variant *data,
+static int exynos_chipid_get_regmap_chipid_info(const struct exynos_chipid_variant *data,
struct exynos_chipid_info *exynos_chipid)
{
int ret;
+ struct regmap *regmap;
unsigned int val, main_rev, sub_rev;
+ regmap = device_node_to_regmap(exynos_chipid->dev->of_node);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ exynos_chipid->regmap = regmap;
+
ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &val);
if (ret < 0)
return ret;
@@ -112,7 +122,6 @@ static int exynos_chipid_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct soc_device *soc_dev;
struct device_node *root;
- struct regmap *regmap;
int ret;
data = of_device_get_match_data(dev);
@@ -123,11 +132,9 @@ static int exynos_chipid_probe(struct platform_device *pdev)
if (!exynos_chipid)
return -ENOMEM;
- regmap = device_node_to_regmap(dev->of_node);
- if (IS_ERR(regmap))
- return PTR_ERR(regmap);
+ exynos_chipid->dev = dev;
- ret = exynos_chipid_get_chipid_info(regmap, data, exynos_chipid);
+ ret = data->get_chipid_info(data, exynos_chipid);
if (ret < 0)
return ret;
@@ -156,7 +163,7 @@ static int exynos_chipid_probe(struct platform_device *pdev)
if (IS_ERR(soc_dev))
return PTR_ERR(soc_dev);
- ret = exynos_asv_init(dev, regmap);
+ ret = exynos_asv_init(dev, exynos_chipid->regmap);
if (ret)
goto err;
@@ -182,12 +189,14 @@ static void exynos_chipid_remove(struct platform_device *pdev)
}
static const struct exynos_chipid_variant exynos4210_chipid_data = {
+ .get_chipid_info = exynos_chipid_get_regmap_chipid_info,
.rev_reg = 0x0,
.main_rev_shift = 4,
.sub_rev_shift = 0,
};
static const struct exynos_chipid_variant exynos850_chipid_data = {
+ .get_chipid_info = exynos_chipid_get_regmap_chipid_info,
.rev_reg = 0x10,
.main_rev_shift = 20,
.sub_rev_shift = 16,
--
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 ` Tudor Ambarus [this message]
2025-11-03 10:15 ` [PATCH 05/11] soc: samsung: exynos-chipid: introduce match_data->get_chipid_info() 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 ` [PATCH 07/11] soc: samsung: exynos-chipid: add support for google,gs101-chipid Tudor Ambarus
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-5-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).