1 From 98e2c4efae214fb7086cac9117616eb6ea11475d Mon Sep 17 00:00:00 2001
2 From: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 Date: Thu, 9 Dec 2021 17:42:34 +0000
4 Subject: [PATCH] nvmem: mtk-efuse: support minimum one byte access stride and
7 In order to support nvmem bits property, should support minimum 1 byte
8 read stride and minimum 1 byte read granularity at the same time.
10 Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
11 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
12 Link: https://lore.kernel.org/r/20211209174235.14049-4-srinivas.kandagatla@linaro.org
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 drivers/nvmem/mtk-efuse.c | 13 +++++++------
16 1 file changed, 7 insertions(+), 6 deletions(-)
18 --- a/drivers/nvmem/mtk-efuse.c
19 +++ b/drivers/nvmem/mtk-efuse.c
20 @@ -19,11 +19,12 @@ static int mtk_reg_read(void *context,
21 unsigned int reg, void *_val, size_t bytes)
23 struct mtk_efuse_priv *priv = context;
25 - int i = 0, words = bytes / 4;
26 + void __iomem *addr = priv->base + reg;
31 - *val++ = readl(priv->base + reg + (i++ * 4));
32 + for (i = 0; i < bytes; i++, val++)
33 + *val = readb(addr + i);
37 @@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platfo
38 if (IS_ERR(priv->base))
39 return PTR_ERR(priv->base);
42 - econfig.word_size = 4;
44 + econfig.word_size = 1;
45 econfig.reg_read = mtk_reg_read;
46 econfig.size = resource_size(res);