Commit 2c0235c6 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Greg Kroah-Hartman

nvmem: vif610-ocotp: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: default avatarSanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 382c62f7
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/nvmem-provider.h> #include <linux/nvmem-provider.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h> #include <linux/slab.h>
/* OCOTP Register Offsets */ /* OCOTP Register Offsets */
...@@ -152,23 +151,16 @@ static int vf610_get_fuse_address(int base_addr_offset) ...@@ -152,23 +151,16 @@ static int vf610_get_fuse_address(int base_addr_offset)
return -EINVAL; return -EINVAL;
} }
static int vf610_ocotp_write(void *context, const void *data, size_t count) static int vf610_ocotp_read(void *context, unsigned int offset,
{ void *val, size_t bytes)
return 0;
}
static int vf610_ocotp_read(void *context,
const void *off, size_t reg_size,
void *val, size_t val_size)
{ {
struct vf610_ocotp *ocotp = context; struct vf610_ocotp *ocotp = context;
void __iomem *base = ocotp->base; void __iomem *base = ocotp->base;
unsigned int offset = *(u32 *)off;
u32 reg, *buf = val; u32 reg, *buf = val;
int fuse_addr; int fuse_addr;
int ret; int ret;
while (val_size > 0) { while (bytes > 0) {
fuse_addr = vf610_get_fuse_address(offset); fuse_addr = vf610_get_fuse_address(offset);
if (fuse_addr > 0) { if (fuse_addr > 0) {
writel(ocotp->timing, base + OCOTP_TIMING); writel(ocotp->timing, base + OCOTP_TIMING);
...@@ -205,29 +197,19 @@ static int vf610_ocotp_read(void *context, ...@@ -205,29 +197,19 @@ static int vf610_ocotp_read(void *context,
} }
buf++; buf++;
val_size--; bytes -= 4;
offset += reg_size; offset += 4;
} }
return 0; return 0;
} }
static struct regmap_bus vf610_ocotp_bus = {
.read = vf610_ocotp_read,
.write = vf610_ocotp_write,
.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
};
static struct regmap_config ocotp_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};
static struct nvmem_config ocotp_config = { static struct nvmem_config ocotp_config = {
.name = "ocotp", .name = "ocotp",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.stride = 4,
.word_size = 4,
.reg_read = vf610_ocotp_read,
}; };
static const struct of_device_id ocotp_of_match[] = { static const struct of_device_id ocotp_of_match[] = {
...@@ -247,7 +229,6 @@ static int vf610_ocotp_probe(struct platform_device *pdev) ...@@ -247,7 +229,6 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res; struct resource *res;
struct regmap *regmap;
struct vf610_ocotp *ocotp_dev; struct vf610_ocotp *ocotp_dev;
ocotp_dev = devm_kzalloc(&pdev->dev, ocotp_dev = devm_kzalloc(&pdev->dev,
...@@ -267,13 +248,8 @@ static int vf610_ocotp_probe(struct platform_device *pdev) ...@@ -267,13 +248,8 @@ static int vf610_ocotp_probe(struct platform_device *pdev)
return PTR_ERR(ocotp_dev->clk); return PTR_ERR(ocotp_dev->clk);
} }
ocotp_regmap_config.max_register = resource_size(res); ocotp_config.size = resource_size(res);
regmap = devm_regmap_init(dev, ocotp_config.priv = ocotp_dev;
&vf610_ocotp_bus, ocotp_dev, &ocotp_regmap_config);
if (IS_ERR(regmap)) {
dev_err(dev, "regmap init failed\n");
return PTR_ERR(regmap);
}
ocotp_config.dev = dev; ocotp_config.dev = dev;
ocotp_dev->nvmem = nvmem_register(&ocotp_config); ocotp_dev->nvmem = nvmem_register(&ocotp_config);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment