mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] nvmem: ocotp: switch to nvmem_regmap_register
Date: Thu,  2 Feb 2023 18:33:09 +0100	[thread overview]
Message-ID: <20230202173312.504493-2-l.stach@pengutronix.de> (raw)
In-Reply-To: <20230202173312.504493-1-l.stach@pengutronix.de>

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/nvmem/ocotp.c | 30 +-----------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index e75fac75eab8..78c9f9726db0 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -131,7 +131,6 @@ struct ocotp_priv {
 	struct regmap_config map_config;
 	const struct imx_ocotp_data *data;
 	int  mac_offset_idx;
-	struct nvmem_config config;
 };
 
 static struct ocotp_priv *imx_ocotp;
@@ -682,20 +681,6 @@ static int imx_ocotp_init_dt(struct ocotp_priv *priv)
 	return imx8m_feat_ctrl_init(priv->dev.parent, tester4, priv->data->feat);
 }
 
-static int imx_ocotp_write(void *ctx, unsigned offset, const void *val, size_t bytes)
-{
-	struct ocotp_priv *priv = ctx;
-
-	return regmap_bulk_write(priv->map, offset, val, bytes);
-}
-
-static int imx_ocotp_read(void *ctx, unsigned offset, void *val, size_t bytes)
-{
-	struct ocotp_priv *priv = ctx;
-
-	return regmap_bulk_read(priv->map, offset, val, bytes);
-}
-
 static void imx_ocotp_set_unique_machine_id(void)
 {
 	uint32_t unique_id_parts[UNIQUE_ID_NUM];
@@ -709,11 +694,6 @@ static void imx_ocotp_set_unique_machine_id(void)
 	machine_id_set_hashable(unique_id_parts, sizeof(unique_id_parts));
 }
 
-static const struct nvmem_bus imx_ocotp_nvmem_bus = {
-	.write = imx_ocotp_write,
-	.read  = imx_ocotp_read,
-};
-
 static int imx_ocotp_probe(struct device *dev)
 {
 	struct resource *iores;
@@ -751,15 +731,7 @@ static int imx_ocotp_probe(struct device *dev)
 	if (IS_ERR(priv->map))
 		return PTR_ERR(priv->map);
 
-	priv->config.name = "imx-ocotp";
-	priv->config.dev = dev;
-	priv->config.priv = priv;
-	priv->config.stride = 4;
-	priv->config.word_size = 4;
-	priv->config.size = data->num_regs;
-	priv->config.bus = &imx_ocotp_nvmem_bus;
-
-	nvmem = nvmem_register(&priv->config);
+	nvmem = nvmem_regmap_register(priv->map, "imx-ocotp");
 	if (IS_ERR(nvmem))
 		return PTR_ERR(nvmem);
 
-- 
2.39.1




  reply	other threads:[~2023-02-02 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 17:33 [PATCH 1/5] nvmem: add support for post processing Lucas Stach
2023-02-02 17:33 ` Lucas Stach [this message]
2023-02-02 17:33 ` [PATCH 3/5] nvmem: regmap: allow to register with " Lucas Stach
2023-02-02 17:33 ` [PATCH 4/5] nvmem: ocotp: add post processing for MAC cells Lucas Stach
2023-02-02 17:33 ` [PATCH 5/5] ARM: dts: i.MX8MP: drop OCOTP MAC address provider Lucas Stach
2023-02-06  7:43 ` [PATCH 1/5] nvmem: add support for post processing 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=20230202173312.504493-2-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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