Skip to content

Commit

Permalink
nvmem: mtk-efuse: support minimum one byte access stride and granularity
Browse files Browse the repository at this point in the history
In order to support nvmem bits property, should support minimum 1 byte
read stride and minimum 1 byte read granularity at the same time.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211209174235.14049-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chunfeng Yun authored and Greg Kroah-Hartman committed Dec 21, 2021
1 parent 9d87b0a commit 98e2c4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/nvmem/mtk-efuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ static int mtk_reg_read(void *context,
unsigned int reg, void *_val, size_t bytes)
{
struct mtk_efuse_priv *priv = context;
u32 *val = _val;
int i = 0, words = bytes / 4;
void __iomem *addr = priv->base + reg;
u8 *val = _val;
int i;

while (words--)
*val++ = readl(priv->base + reg + (i++ * 4));
for (i = 0; i < bytes; i++, val++)
*val = readb(addr + i);

return 0;
}
Expand All @@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);

econfig.stride = 4;
econfig.word_size = 4;
econfig.stride = 1;
econfig.word_size = 1;
econfig.reg_read = mtk_reg_read;
econfig.size = resource_size(res);
econfig.priv = priv;
Expand Down

0 comments on commit 98e2c4e

Please sign in to comment.