Skip to content

Commit

Permalink
firmware: imx: scu: use soc name for soc_id
Browse files Browse the repository at this point in the history
Same as soc-imx8m and soc-imx driver, use soc name for soc_id which is
user friendly.

Signed-off-by: Peng Fan <[email protected]>
Signed-off-by: Shawn Guo <[email protected]>
  • Loading branch information
MrVan authored and Shawn Guo committed Aug 11, 2023
1 parent 4b9ccf0 commit 150019d
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions drivers/firmware/imx/imx-scu-soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ static int imx_scu_soc_id(void)
return msg.data.resp.id;
}

static const char *imx_scu_soc_name(u32 id)
{
switch (id) {
case 0x1:
return "i.MX8QM";
case 0x2:
return "i.MX8QXP";
case 0xe:
return "i.MX8DXL";
default:
break;
}

return "NULL";
}

int imx_scu_soc_init(struct device *dev)
{
struct soc_device_attribute *soc_dev_attr;
Expand Down Expand Up @@ -113,9 +129,7 @@ int imx_scu_soc_init(struct device *dev)

/* format soc_id value passed from SCU firmware */
val = id & 0x1f;
soc_dev_attr->soc_id = devm_kasprintf(dev, GFP_KERNEL, "0x%x", val);
if (!soc_dev_attr->soc_id)
return -ENOMEM;
soc_dev_attr->soc_id = imx_scu_soc_name(val);

/* format revision value passed from SCU firmware */
val = (id >> 5) & 0xf;
Expand Down

0 comments on commit 150019d

Please sign in to comment.