This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 2dab53d96a1 arch/arm: IMX9 SCMI add misc protocol MISC_SI_INFO support
2dab53d96a1 is described below
commit 2dab53d96a102e27ad082288af07b3df8652c158
Author: Peter van der Perk <[email protected]>
AuthorDate: Mon Oct 12 11:56:26 2026 +0200
arch/arm: IMX9 SCMI add misc protocol MISC_SI_INFO support
Adds imx9_scmi_siinfoget(), which reads the silicon info from the System
Manager over the SCMI misc protocol: device ID, silicon revision, part
number and the silicon name string.
On i.MX95 the silicon revision is not available to the M7 by itself. It
is not held in the OCOTP fuse shadow words, and the ELE mailbox is not
reachable when the System Manager configuration does not assign it, so
the misc protocol is the only way to obtain it from that core. The
returned name is already the fully decoded "i.MX95 B0" form, so callers
can report it as is.
Signed-off-by: Peter van der Perk <[email protected]>
---
arch/arm/src/imx9/imx9_scmi.c | 131 +++++++++++++++++++++++++++++++++---------
arch/arm/src/imx9/imx9_scmi.h | 32 +++++++++++
2 files changed, 137 insertions(+), 26 deletions(-)
diff --git a/arch/arm/src/imx9/imx9_scmi.c b/arch/arm/src/imx9/imx9_scmi.c
index 11ee68b9f17..ca440d99f89 100644
--- a/arch/arm/src/imx9/imx9_scmi.c
+++ b/arch/arm/src/imx9/imx9_scmi.c
@@ -114,6 +114,10 @@
#define SCMI_MSG_PINCTRL_REQUEST 0x8u /* Request a pin */
#define SCMI_MSG_PINCTRL_RELEASE 0x9u /* Release a pin */
+/* SCMI misc protocol message IDs */
+
+#define SCMI_MSG_MISC_SI_INFO 0xbu /* Get silicon info */
+
/* SCMI header creation */
#define SCMI_HEADER_MSG(x) (((x) & 0xffu) << 0u)
@@ -399,16 +403,17 @@ static int32_t imx9_smt_tx(uint32_t smtchannel, uint32_t
len, bool callee,
switch (impStatus)
{
- case SMT_CRC_XOR:
- buf->imp_crc =
- imx9_crcxor((const uint32_t *)&buf->header, len / 4u);
- break;
- case SMT_CRC_CRC32:
- buf->imp_crc = imx9_crc32((const uint8_t *)&buf->header, len);
- break;
- default:
- ; /* Intentional empty while */
- break;
+ case SMT_CRC_XOR:
+ buf->imp_crc =
+ imx9_crcxor((const uint32_t *)&buf->header, len / 4u);
+ break;
+
+ case SMT_CRC_CRC32:
+ buf->imp_crc = imx9_crc32((const uint8_t *)&buf->header, len);
+ break;
+
+ default:
+ break;
}
if (callee)
@@ -480,24 +485,25 @@ static int32_t imx9_smt_rx(uint32_t smtchannel, uint32_t
*len, bool callee)
switch (impStatus)
{
- case SMT_CRC_XOR:
- if (buf->imp_crc
- != imx9_crcxor((const uint32_t *)msgrx, *len / 4u))
- {
- status = -EIO;
- }
+ case SMT_CRC_XOR:
+ if (buf->imp_crc
+ != imx9_crcxor((const uint32_t *)msgrx, *len / 4u))
+ {
+ status = -EIO;
+ }
- break;
- case SMT_CRC_CRC32:
- if (buf->imp_crc != imx9_crc32((const uint8_t *)msgrx, *len))
- {
- status = -EIO;
- }
+ break;
- break;
- default:
- ; /* Intentional empty while */
- break;
+ case SMT_CRC_CRC32:
+ if (buf->imp_crc != imx9_crc32((const uint8_t *)msgrx, *len))
+ {
+ status = -EIO;
+ }
+
+ break;
+
+ default:
+ break;
}
}
@@ -1033,6 +1039,79 @@ int32_t imx9_scmi_pinctrlconfigset(uint32_t channel,
uint32_t identifier,
return status;
}
+int32_t imx9_scmi_siinfoget(uint32_t channel, scmi_si_info_t *info)
+{
+ int32_t status;
+ uint32_t header;
+ void *msg;
+
+ /* Response message structure */
+
+ typedef struct
+ {
+ uint32_t header;
+ int32_t status;
+ uint32_t deviceid;
+ uint32_t sirev;
+ uint32_t partnum;
+ uint8_t siname[SCMI_MISC_MAX_SINAME];
+ } msg_rmiscd11_t;
+
+ /* Acquire lock */
+
+ SCMI_A2P_LOCK(channel);
+
+ /* Init buffer */
+
+ status = imx9_scmi_bufinit(channel, &msg);
+
+ /* Send request */
+
+ if (status == OK)
+ {
+ /* Send message, the request carries the header only */
+
+ status = imx9_scmi_a2ptx(channel, SCMI_PROTOCOL_MISC,
+ SCMI_MSG_MISC_SI_INFO,
+ sizeof(uint32_t), &header);
+ }
+
+ /* Receive response */
+
+ if (status == OK)
+ {
+ status = imx9_scmi_a2prx(channel, sizeof(msg_rmiscd11_t), header);
+ }
+
+ /* Copy out if no error */
+
+ if (status == OK)
+ {
+ const msg_rmiscd11_t *msgrx = (const msg_rmiscd11_t *)msg;
+
+ if (info != NULL)
+ {
+ info->deviceid = msgrx->deviceid;
+ info->sirev = msgrx->sirev;
+ info->partnum = msgrx->partnum;
+
+ memcpy(info->siname, msgrx->siname, SCMI_MISC_MAX_SINAME);
+
+ /* Make sure the name is terminated */
+
+ info->siname[SCMI_MISC_MAX_SINAME - 1u] = '\0';
+ }
+ }
+
+ /* Release lock */
+
+ SCMI_A2P_UNLOCK(channel);
+
+ /* Return status */
+
+ return status;
+}
+
void imx9_scmi_initialize()
{
/* Configure SMT */
diff --git a/arch/arm/src/imx9/imx9_scmi.h b/arch/arm/src/imx9/imx9_scmi.h
index 15db7e03c96..b45282a0581 100644
--- a/arch/arm/src/imx9/imx9_scmi.h
+++ b/arch/arm/src/imx9/imx9_scmi.h
@@ -128,6 +128,20 @@ typedef struct
uint32_t value; /* The configuration value */
} scmi_pin_config_t;
+/* Length of the silicon name string returned by MISC_SI_INFO */
+
+#define SCMI_MISC_MAX_SINAME 16u
+
+/* SCMI silicon info, as reported by the misc protocol MISC_SI_INFO */
+
+typedef struct
+{
+ uint32_t deviceid; /* Silicon specific device ID */
+ uint32_t sirev; /* Silicon specific revision */
+ uint32_t partnum; /* Silicon specific part number */
+ uint8_t siname[SCMI_MISC_MAX_SINAME]; /* Silicon name/revision string */
+} scmi_si_info_t;
+
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -154,4 +168,22 @@ int32_t imx9_scmi_clockconfigset(uint32_t channel,
uint32_t clockid,
int32_t imx9_scmi_pinctrlconfigset(uint32_t channel, uint32_t identifier,
uint32_t attributes, const scmi_pin_config_t *configs);
+/****************************************************************************
+ * Name: imx9_scmi_siinfoget
+ *
+ * Description:
+ * Read the silicon info (device ID, revision, part number and name) from
+ * the System Manager via the SCMI misc protocol.
+ *
+ * Input Parameters:
+ * channel - SCMI channel to use
+ * info - Returned silicon info
+ *
+ * Returned Value:
+ * OK on success, a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int32_t imx9_scmi_siinfoget(uint32_t channel, scmi_si_info_t *info);
+
#endif /* __ARCH_ARM_SRC_IMX9_IMX9_SCMI_H */