[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231208061134.26354-2-yanxin.huang@unisoc.com>
Date: Fri, 8 Dec 2023 14:11:33 +0800
From: Yanxin Huang <yanxin.huang@...soc.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>
CC: <linux-kernel@...r.kernel.org>,
huang yanxin <yanxin.huang07@...il.com>,
Wenming Wu <wenming.wu@...soc.com>
Subject: [PATCH 2/3] nvmem: sprd: Fix programming errors in efuse caused by incorrect parameters
The second argument to sprd_efuse_raw_prog() is the efuse index block
data, but the data passed in is the efuse block offset, which can cause
efuse to be programmed to the wrong block.
Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
Signed-off-by: Yanxin Huang <yanxin.huang@...soc.com>
---
drivers/nvmem/sprd-efuse.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
index 24b63620d217..f0880f8fc56d 100644
--- a/drivers/nvmem/sprd-efuse.c
+++ b/drivers/nvmem/sprd-efuse.c
@@ -326,6 +326,7 @@ static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
{
struct sprd_efuse *efuse = context;
bool blk_double = efuse->data->blk_double;
+ u32 index = offset / SPRD_EFUSE_BLOCK_WIDTH + efuse->data->blk_offset;
bool lock;
int ret;
@@ -350,7 +351,7 @@ static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
else
lock = true;
- ret = sprd_efuse_raw_prog(efuse, offset, blk_double, lock, val);
+ ret = sprd_efuse_raw_prog(efuse, index, blk_double, lock, val);
clk_disable_unprepare(efuse->clk);
--
2.17.1
Powered by blists - more mailing lists