diff mbox series

[1/4] misc: ele_api: Update ELE read common fuse API

Message ID 20241006003006.20162-1-peng.fan@oss.nxp.com
State Accepted
Commit 929dc83b73b71fd638b48b26a2652fd45e963448
Delegated to: Fabio Estevam
Headers show
Series [1/4] misc: ele_api: Update ELE read common fuse API | expand

Commit Message

Peng Fan (OSS) Oct. 6, 2024, 12:30 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

On iMX8ULP, the word index 1 is used to read OTP_UNIQ_ID with 4 words
data responsed. However this special index does not apply others.
So restrict the check to i.MX8ULP to avoid problem when reading from
fuse word 1 for others, such as i.MX93.

Also update header order

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/misc/imx_ele/ele_api.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Fabio Estevam Oct. 13, 2024, 8:22 p.m. UTC | #1
On Sat, Oct 5, 2024 at 8:26 PM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> On iMX8ULP, the word index 1 is used to read OTP_UNIQ_ID with 4 words
> data responsed. However this special index does not apply others.
> So restrict the check to i.MX8ULP to avoid problem when reading from
> fuse word 1 for others, such as i.MX93.
>
> Also update header order
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Applied all, thanks.
diff mbox series

Patch

diff --git a/drivers/misc/imx_ele/ele_api.c b/drivers/misc/imx_ele/ele_api.c
index e478d7dd50f..fd57928c5f8 100644
--- a/drivers/misc/imx_ele/ele_api.c
+++ b/drivers/misc/imx_ele/ele_api.c
@@ -5,12 +5,12 @@ 
  *
  */
 
-#include <hang.h>
-#include <malloc.h>
-#include <memalign.h>
 #include <asm/io.h>
-#include <dm.h>
+#include <asm/mach-imx/sys_proto.h>
 #include <asm/mach-imx/ele_api.h>
+#include <dm.h>
+#include <malloc.h>
+#include <memalign.h>
 #include <misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -205,8 +205,7 @@  int ele_read_common_fuse(u16 fuse_id, u32 *fuse_words, u32 fuse_num, u32 *respon
 		return -EINVAL;
 	}
 
-	if ((fuse_id != 1 && fuse_num != 1) ||
-	    (fuse_id == 1 && fuse_num != 4)) {
+	if (is_imx8ulp() && ((fuse_id != 1 && fuse_num != 1) || (fuse_id == 1 && fuse_num != 4))) {
 		printf("Invalid fuse number parameter\n");
 		return -EINVAL;
 	}
@@ -226,7 +225,7 @@  int ele_read_common_fuse(u16 fuse_id, u32 *fuse_words, u32 fuse_num, u32 *respon
 		*response = msg.data[0];
 
 	fuse_words[0] = msg.data[1];
-	if (fuse_id == 1) {
+	if (fuse_id == 1 && is_imx8ulp()) {
 		/* OTP_UNIQ_ID */
 		fuse_words[1] = msg.data[2];
 		fuse_words[2] = msg.data[3];