firmware: arm_scmi: imx: Support retrieving MISC protocol configuration info

The MISC protocol can provide System Manager (SM) configuration
information, including platform identifiers and board-specific
attributes. Add support to retrieve this information during protocol
initialization.

If the firmware does not implement the CFG_INFO command, handle
-EOPNOTSUPP gracefully and continue without failing init.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Message-Id: <20250904-sm-misc-api-v1-v4-3-0bf10eaabdf1@nxp.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Peng Fan
2025-09-04 18:40:44 +08:00
committed by Sudeep Holla
parent cc798b1050
commit d3e25c244d

View File

@@ -27,6 +27,7 @@ enum scmi_imx_misc_protocol_cmd {
SCMI_IMX_MISC_CTRL_GET = 0x4,
SCMI_IMX_MISC_DISCOVER_BUILD_INFO = 0x6,
SCMI_IMX_MISC_CTRL_NOTIFY = 0x8,
SCMI_IMX_MISC_CFG_INFO_GET = 0xC,
};
struct scmi_imx_misc_info {
@@ -75,6 +76,12 @@ struct scmi_imx_misc_buildinfo_out {
u8 buildtime[MISC_MAX_BUILDTIME];
};
struct scmi_imx_misc_cfg_info_out {
__le32 msel;
#define MISC_MAX_CFGNAME 16
u8 cfgname[MISC_MAX_CFGNAME];
};
static int scmi_imx_misc_attributes_get(const struct scmi_protocol_handle *ph,
struct scmi_imx_misc_info *mi)
{
@@ -309,6 +316,30 @@ static int scmi_imx_misc_build_info_discover(const struct scmi_protocol_handle *
return ret;
}
static int scmi_imx_misc_cfg_info_get(const struct scmi_protocol_handle *ph)
{
struct scmi_imx_misc_cfg_info_out *out;
char name[MISC_MAX_CFGNAME];
struct scmi_xfer *t;
int ret;
ret = ph->xops->xfer_get_init(ph, SCMI_IMX_MISC_CFG_INFO_GET, 0, sizeof(*out), &t);
if (ret)
return ret;
ret = ph->xops->do_xfer(ph, t);
if (!ret) {
out = t->rx.buf;
strscpy(name, out->cfgname, MISC_MAX_CFGNAME);
dev_info(ph->dev, "SM Config\t= %s, mSel = %u\n",
name, le32_to_cpu(out->msel));
}
ph->xops->xfer_put(ph, t);
return ret;
}
static const struct scmi_imx_misc_proto_ops scmi_imx_misc_proto_ops = {
.misc_ctrl_set = scmi_imx_misc_ctrl_set,
.misc_ctrl_get = scmi_imx_misc_ctrl_get,
@@ -340,6 +371,10 @@ static int scmi_imx_misc_protocol_init(const struct scmi_protocol_handle *ph)
if (ret && ret != -EOPNOTSUPP)
return ret;
ret = scmi_imx_misc_cfg_info_get(ph);
if (ret && ret != -EOPNOTSUPP)
return ret;
return ph->set_priv(ph, minfo, version);
}