Skip to contentSkip to conversation

soc: imx-scu: Add SoC UID(unique identifier) support

PATCH Superseded [email protected] 3 participants 7 messages Jun 26, 2019 – Jul 2, 2019 Arm i.MX and Layerscape

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: imx-scu: Add SoC UID(unique identifier) support

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/soc/imx/soc-imx-scu.c +35 -0
index 676f612..8d322a1 100644
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
 	} data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+	struct imx_sc_rpc_msg hdr;
+	u32 uid_low;
+	u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
+{
+	struct imx_sc_msg_misc_get_soc_uid msg;
+	struct imx_sc_rpc_msg *hdr = &msg.hdr;
+	u64 soc_uid;
+
+	hdr->ver = IMX_SC_RPC_VERSION;
+	hdr->svc = IMX_SC_RPC_SVC_MISC;
+	hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+	hdr->size = 1;
+
+	/* the return value of SCU FW is in correct, skip return value check */
+	imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+	soc_uid = msg.uid_high;
+	soc_uid <<= 32;
+	soc_uid |= msg.uid_low;
+
+	return sprintf(buf, "%016llX\n", soc_uid);
+}
+
+static DEVICE_ATTR_RO(soc_uid);
+
 static int imx_scu_soc_id(void)
 {
 	struct imx_sc_msg_misc_get_soc_id msg;
@@ -102,6 +132,11 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
 		goto free_revision;
 	}
 
+	ret = device_create_file(soc_device_to_device(soc_dev),
+				 &dev_attr_soc_uid);
+	if (ret)
+		goto free_revision;
+
 	return 0;
 
 free_revision:
Signature · 1 line
2.7.4
#1 lore raw
Quoted 31 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/soc/imx/soc-imx-scu.c +9 -0
index 676f612..8d322a1 100644
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr, char *buf)
+{

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 48

Quoted 10 lines
drivers/soc/imx/soc-imx-scu.c +10 -0
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip return value check */

Why do you mean by "in correct"?

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 7 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

Quoted 22 lines
drivers/soc/imx/soc-imx-scu.c +9 -1
+}
+
+static DEVICE_ATTR_RO(soc_uid);
+
 static int imx_scu_soc_id(void)
 {
        struct imx_sc_msg_misc_get_soc_id msg;
@@ -102,6 +132,11 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
                goto free_revision;
        }
 
+       ret = device_create_file(soc_device_to_device(soc_dev),
+                                &dev_attr_soc_uid);
+       if (ret)
+               goto free_revision;
+
        return 0;
 
 free_revision:
--

2.7.4

#2 lore raw

Hi, Daniel

Quoted 51 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Wednesday, June 26, 2019 8:42 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Aisheng Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 37 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35
+++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644

drivers/soc/imx/soc-imx-scu.c +14 -0
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr, char *buf)
+{
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
Quoted 8 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id {

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +6 -0
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip return value
+ check */

Why do you mean by "in correct"?

I made a mistake, it should be "incorrect", the existing SCFW of this API returns an error value even this API is successfully called, to make it work with current SCFW, I have to skip the return value check for this API for now. Will send V2 patch to fix this typo.

Quoted 9 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 7 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

The snprintf is to avoid buffer overflow, which in this case, I don't know the size of "buf", and the value(u64) to be printed is with fixed length of 64, so I think sprint is just OK.

Anson.

Quoted 23 lines
Quoted 23 lines
drivers/soc/imx/soc-imx-scu.c +4 -0
+}
+
+static DEVICE_ATTR_RO(soc_uid);
+
 static int imx_scu_soc_id(void)
 {
        struct imx_sc_msg_misc_get_soc_id msg; @@ -102,6 +132,11 @@

static int imx_scu_soc_probe(struct platform_device *pdev)

                goto free_revision;
        }
drivers/soc/imx/soc-imx-scu.c +5 -1
+       ret = device_create_file(soc_device_to_device(soc_dev),
+                                &dev_attr_soc_uid);
+       if (ret)
+               goto free_revision;
+
        return 0;
 
 free_revision:
--

2.7.4

#3 lore raw
Quoted 63 lines · Anson Huang

Hi, Daniel

Quoted 51 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Wednesday, June 26, 2019 8:42 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Aisheng Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 37 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35
+++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644

drivers/soc/imx/soc-imx-scu.c +14 -0
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr, char *buf)
+{
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
Quoted 8 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id {

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +6 -0
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip return value
+ check */

Why do you mean by "in correct"?

Quoted 4 lines

I made a mistake, it should be "incorrect", the existing SCFW of this API returns an error value even this API is successfully called, to make it work with current SCFW, I have to skip the return value check for this API for now. Will send V2 patch to fix this typo.

Thanks Anson! It makes sense now. It is a little bit sad though because we won't know when there is a "real" error :).

Lets update the comment to be more specific:

/* SCFW FW API always returns an error even the function is successfully executed, so skip returned value */

Quoted 10 lines
Quoted 9 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 7 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

Quoted 3 lines

The snprintf is to avoid buffer overflow, which in this case, I don't know the size of "buf", and the value(u64) to be printed is with fixed length of 64, so I think sprint is just OK.

Ok.

#4 lore raw

Hi, Daniel

Quoted 85 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Thursday, June 27, 2019 2:44 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Aisheng Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 10 lines · Anson Huang

Hi, Daniel

Quoted 7 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Wednesday, June 26, 2019 8:42 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>;

Aisheng

Quoted 54 lines
Quoted 45 lines

Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 37 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35
+++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644

drivers/soc/imx/soc-imx-scu.c +14 -0
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr, char
+*buf) {
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
Quoted 8 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id {

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +6 -0
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip return
+ value check */

Why do you mean by "in correct"?

Quoted 4 lines

I made a mistake, it should be "incorrect", the existing SCFW of this API returns an error value even this API is successfully called, to make it work with current SCFW, I have to skip the return value check for this API for now. Will send V2 patch to fix this typo.

Quoted 7 lines

Thanks Anson! It makes sense now. It is a little bit sad though because we won't know when there is a "real" error :).

Lets update the comment to be more specific:

/* SCFW FW API always returns an error even the function is successfully executed, so skip returned value */

OK, as for external users, the SCFW formally released has this issue, so for now I have to skip the return value check for this API, once next SCFW release has this issue fixed, I will add a patch to check the return value.

Thanks,
Anson.

Quoted 17 lines
Quoted 12 lines
Quoted 11 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 9 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

Quoted 3 lines

The snprintf is to avoid buffer overflow, which in this case, I don't know the size of "buf", and the value(u64) to be printed is with fixed length of 64, so I think sprint is just OK.

Ok.

#5 lore raw

Hi Anson,

Quoted 90 lines · Anson Huang

Hi, Daniel

Quoted 88 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Thursday, June 27, 2019 2:44 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; Aisheng Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 10 lines · Anson Huang

Hi, Daniel

Quoted 7 lines

-----Original Message-----
From: Daniel Baluta <[email protected]>
Sent: Wednesday, June 26, 2019 8:42 PM
To: Anson Huang <[email protected]>
Cc: Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>;

Aisheng

Quoted 54 lines
Quoted 45 lines

Dong <[email protected]>; Abel Vesa <[email protected]>; linux- arm-kernel <[email protected]>; Linux Kernel Mailing List <[email protected]>; dl-linux-imx <[email protected]>; Daniel Baluta <[email protected]>
Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support

Quoted 37 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35
+++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644

drivers/soc/imx/soc-imx-scu.c +14 -0
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr, char
+*buf) {
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
Quoted 8 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id {

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +6 -0
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip return
+ value check */

Why do you mean by "in correct"?

Quoted 4 lines

I made a mistake, it should be "incorrect", the existing SCFW of this API returns an error value even this API is successfully called, to make it work with current SCFW, I have to skip the return value check for this API for now. Will send V2 patch to fix this typo.

Thanks Anson! It makes sense now. It is a little bit sad though because we won't know when there is a "real" error :).

Quoted 8 lines
Quoted 4 lines

Lets update the comment to be more specific:

/* SCFW FW API always returns an error even the function is successfully executed, so skip returned value */

OK, as for external users, the SCFW formally released has this issue, so for now I have to skip the return value check for this API, once next SCFW release has this issue fixed, I will add a patch to check the return value.

Do you really keep track of that? Please can you add a FIXME: or TODO:
tag and add the firmware version containing that bug?

Regards,
Marco

Quoted 19 lines

Thanks,
Anson.

Quoted 17 lines
Quoted 12 lines
Quoted 11 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 9 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

Quoted 3 lines

The snprintf is to avoid buffer overflow, which in this case, I don't know the size of "buf", and the value(u64) to be printed is with fixed length of 64, so I think sprint is just OK.

Ok.

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#6 lore raw

Hi, Marco

Quoted 72 lines

Hi Anson,

Quoted 59 lines · Anson Huang

Hi, Daniel

Quoted 57 lines
Quoted 55 lines · Anson Huang

Hi, Daniel

Quoted 39 lines · On Wed, Jun 26, 2019 at 10:06 AM <[email protected]> wrote:
Quoted 38 lines

From: Anson Huang <[email protected]>

Add i.MX SCU SoC's UID(unique identifier) support, user can read it from sysfs:

root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid
7B64280B57AC1898
---
 drivers/soc/imx/soc-imx-scu.c | 35
+++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 676f612..8d322a1 100644

drivers/soc/imx/soc-imx-scu.c +15 -0
@@ -27,6 +27,36 @@ struct imx_sc_msg_misc_get_soc_id {
        } data;
 } __packed;
 
+struct imx_sc_msg_misc_get_soc_uid {
+       struct imx_sc_rpc_msg hdr;
+       u32 uid_low;
+       u32 uid_high;
+} __packed;
+
+static ssize_t soc_uid_show(struct device *dev,
+                           struct device_attribute *attr,
+char
+*buf) {
+       struct imx_sc_msg_misc_get_soc_uid msg;
+       struct imx_sc_rpc_msg *hdr = &msg.hdr;
+       u64 soc_uid;
+
+       hdr->ver = IMX_SC_RPC_VERSION;
Quoted 8 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id {

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +6 -0
+       hdr->svc = IMX_SC_RPC_SVC_MISC;
+       hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
+       hdr->size = 1;
+
+       /* the return value of SCU FW is in correct, skip
+ return value check */

Why do you mean by "in correct"?

I made a mistake, it should be "incorrect", the existing SCFW of this API returns an error value even this API is successfully called, to make it work with current SCFW, I have to skip the return value check for this API for now. Will send V2 patch to fix this

typo.

Quoted 9 lines
Quoted 8 lines

Thanks Anson! It makes sense now. It is a little bit sad though because we won't know when there is a "real" error :).

Lets update the comment to be more specific:

/* SCFW FW API always returns an error even the function is successfully executed, so skip returned value */

Quoted 7 lines
Quoted 3 lines

OK, as for external users, the SCFW formally released has this issue, so for now I have to skip the return value check for this API, once next SCFW release has this issue fixed, I will add a patch to check the return

value.

Do you really keep track of that? Please can you add a FIXME: or TODO:
tag and add the firmware version containing that bug?

Thanks for reminder, I just double checked the SCU FW code, it is actually a mistake, the SCU FW API of sc_misc_unique_id() is actually a void function, which means it does NOT return anything. While in our internal kernel tree, we make SCU IPC call to sc_misc_unique_id() with return value check, and the return value is failure (-5) always. When I clean up the code for upstream, I did NOT notice it. So the correct comment should be, this API does NOT return anything, no need to check the returned value. I will fix the comment in next version.

void sc_misc_unique_id(sc_ipc_t ipc, uint32_t *id_l, uint32_t *id_h)

Thanks,
Anson

Quoted 25 lines

Regards,
Marco

Quoted 19 lines

Thanks,
Anson.

Quoted 17 lines
Quoted 12 lines
Quoted 11 lines

drivers/soc/imx/soc-imx-scu.c struct imx_sc_msg_misc_get_soc_id { · line 55

Quoted 9 lines
drivers/soc/imx/soc-imx-scu.c +7 -0
+       imx_scu_call_rpc(soc_ipc_handle, &msg, true);
+
+       soc_uid = msg.uid_high;
+       soc_uid <<= 32;
+       soc_uid |= msg.uid_low;
+
+       return sprintf(buf, "%016llX\n", soc_uid);

snprintf?

Quoted 3 lines

The snprintf is to avoid buffer overflow, which in this case, I don't know the size of "buf", and the value(u64) to be printed is with fixed length of 64, so I think sprint is just OK.

Ok.

--