qcom_socinfo_init() already exports the serial number. Also export the
socinfo id, version, raw id/version and the chip name so board scripts
can distinguish SoC revisions and select the matching device tree
without decoding SMEM themselves.

Signed-off-by: Qing Li <[email protected]>
---
 drivers/soc/qcom/smem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index e20523e2cec..cf433957bc2 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -1014,6 +1014,16 @@ int qcom_socinfo_init(void)
                return -ENOENT;
        }
 
+       /* Expose the SoC identification for board scripts and diagnostics */
+       env_set_ulong("socinfo_id", le32_to_cpu(info->id));
+       env_set_ulong("socinfo_ver", le32_to_cpu(info->ver));
+       if (offsetof(struct socinfo, raw_id) + sizeof(info->raw_id) <= 
item_size) {
+               env_set_ulong("socinfo_raw_id", le32_to_cpu(info->raw_id));
+               env_set_ulong("socinfo_raw_ver", le32_to_cpu(info->raw_ver));
+       }
+       if (offsetof(struct socinfo, chip_id) + SMEM_SOCINFO_CHIP_ID_LENGTH <= 
item_size)
+               env_set("socinfo_chip", info->chip_id);
+
        return 0;
 }
 
-- 
2.50.1 (Apple Git-155)

Reply via email to