Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: imx: add i.MX51/i.MX53 unique id support

i.MX51 and i.MX53 SoCs have a 64-bit SoC unique ID stored in IIM,
which can be used as SoC serial number. The same feature is already
implemented for i.MX6/i.MX7, so this complements support to earlier
SoCs.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>

authored by

Sebastian Reichel and committed by
Shawn Guo
1168935b a38fd874

+12
+12
drivers/soc/imx/soc-imx.c
··· 13 13 #include <soc/imx/cpu.h> 14 14 #include <soc/imx/revision.h> 15 15 16 + #define IIM_UID 0x820 17 + 16 18 #define OCOTP_UID_H 0x420 17 19 #define OCOTP_UID_L 0x410 18 20 ··· 34 32 u64 soc_uid = 0; 35 33 u32 val; 36 34 int ret; 35 + int i; 37 36 38 37 if (of_machine_is_compatible("fsl,ls1021a")) 39 38 return 0; ··· 71 68 soc_id = "i.MX35"; 72 69 break; 73 70 case MXC_CPU_MX51: 71 + ocotp_compat = "fsl,imx51-iim"; 74 72 soc_id = "i.MX51"; 75 73 break; 76 74 case MXC_CPU_MX53: 75 + ocotp_compat = "fsl,imx53-iim"; 77 76 soc_id = "i.MX53"; 78 77 break; 79 78 case MXC_CPU_IMX6SL: ··· 158 153 regmap_read(ocotp, OCOTP_ULP_UID_1, &val); 159 154 soc_uid <<= 16; 160 155 soc_uid |= val & 0xffff; 156 + } else if (__mxc_cpu_type == MXC_CPU_MX51 || 157 + __mxc_cpu_type == MXC_CPU_MX53) { 158 + for (i=0; i < 8; i++) { 159 + regmap_read(ocotp, IIM_UID + i*4, &val); 160 + soc_uid <<= 8; 161 + soc_uid |= (val & 0xff); 162 + } 161 163 } else { 162 164 regmap_read(ocotp, OCOTP_UID_H, &val); 163 165 soc_uid = val;