Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Srinivas Kandagatla and committed by
Greg Kroah-Hartman
2c0235c6 382c62f7

+10 -34
+10 -34
drivers/nvmem/vf610-ocotp.c
··· 25 25 #include <linux/nvmem-provider.h> 26 26 #include <linux/of.h> 27 27 #include <linux/platform_device.h> 28 - #include <linux/regmap.h> 29 28 #include <linux/slab.h> 30 29 31 30 /* OCOTP Register Offsets */ ··· 151 152 return -EINVAL; 152 153 } 153 154 154 - static int vf610_ocotp_write(void *context, const void *data, size_t count) 155 - { 156 - return 0; 157 - } 158 - 159 - static int vf610_ocotp_read(void *context, 160 - const void *off, size_t reg_size, 161 - void *val, size_t val_size) 155 + static int vf610_ocotp_read(void *context, unsigned int offset, 156 + void *val, size_t bytes) 162 157 { 163 158 struct vf610_ocotp *ocotp = context; 164 159 void __iomem *base = ocotp->base; 165 - unsigned int offset = *(u32 *)off; 166 160 u32 reg, *buf = val; 167 161 int fuse_addr; 168 162 int ret; 169 163 170 - while (val_size > 0) { 164 + while (bytes > 0) { 171 165 fuse_addr = vf610_get_fuse_address(offset); 172 166 if (fuse_addr > 0) { 173 167 writel(ocotp->timing, base + OCOTP_TIMING); ··· 197 205 } 198 206 199 207 buf++; 200 - val_size--; 201 - offset += reg_size; 208 + bytes -= 4; 209 + offset += 4; 202 210 } 203 211 204 212 return 0; 205 213 } 206 214 207 - static struct regmap_bus vf610_ocotp_bus = { 208 - .read = vf610_ocotp_read, 209 - .write = vf610_ocotp_write, 210 - .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, 211 - .val_format_endian_default = REGMAP_ENDIAN_NATIVE, 212 - }; 213 - 214 - static struct regmap_config ocotp_regmap_config = { 215 - .reg_bits = 32, 216 - .val_bits = 32, 217 - .reg_stride = 4, 218 - }; 219 - 220 215 static struct nvmem_config ocotp_config = { 221 216 .name = "ocotp", 222 217 .owner = THIS_MODULE, 218 + .stride = 4, 219 + .word_size = 4, 220 + .reg_read = vf610_ocotp_read, 223 221 }; 224 222 225 223 static const struct of_device_id ocotp_of_match[] = { ··· 229 247 { 230 248 struct device *dev = &pdev->dev; 231 249 struct resource *res; 232 - struct regmap *regmap; 233 250 struct vf610_ocotp *ocotp_dev; 234 251 235 252 ocotp_dev = devm_kzalloc(&pdev->dev, ··· 248 267 return PTR_ERR(ocotp_dev->clk); 249 268 } 250 269 251 - ocotp_regmap_config.max_register = resource_size(res); 252 - regmap = devm_regmap_init(dev, 253 - &vf610_ocotp_bus, ocotp_dev, &ocotp_regmap_config); 254 - if (IS_ERR(regmap)) { 255 - dev_err(dev, "regmap init failed\n"); 256 - return PTR_ERR(regmap); 257 - } 270 + ocotp_config.size = resource_size(res); 271 + ocotp_config.priv = ocotp_dev; 258 272 ocotp_config.dev = dev; 259 273 260 274 ocotp_dev->nvmem = nvmem_register(&ocotp_config);