[PATCH 2/5] nvmem: ocotp: switch to nvmem_regmap_register
Lucas Stach
l.stach at pengutronix.de
Thu Feb 2 09:33:09 PST 2023
Signed-off-by: Lucas Stach <l.stach at 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
More information about the barebox
mailing list