Skip to content

Commit e4ba614

Browse files
Kartik RajputjamieNguyenNVIDIA
authored andcommitted
NVIDIA: VR: SAUCE: soc/tegra: misc: Use SMCCC to get chipid
Tegra410 and Tegra241 have deprecated HIDREV register. It is recommended to use ARM SMCCC calls to get chip_id, major and minor revisions. Use ARM SMCCC to get chip_id, major and minor revision. Signed-off-by: Kartik Rajput <kkartik@nvidia.com> Signed-off-by: Matthew R. Ochs <mochs@nvidia.com> Acked-by: Jamie Nguyen <jamien@nvidia.com> Acked-by: Carol L Soto <csoto@nvidia.com> Signed-off-by: Jamie Nguyen <jamien@nvidia.com>
1 parent 721351f commit e4ba614

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/soc/tegra/fuse/tegra-apbmisc.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <linux/acpi.h>
7+
#include <linux/arm-smccc.h>
78
#include <linux/export.h>
89
#include <linux/io.h>
910
#include <linux/kernel.h>
@@ -27,6 +28,11 @@
2728
#define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT \
2829
(0x3 << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT)
2930

31+
#define TEGRA_SMCCC_PLATFORM(x) ((x >> 8) & 0xff)
32+
#define TEGRA_SMCCC_CHIP_ID(x) ((x >> 4) & 0xff)
33+
#define TEGRA_SMCCC_MAJOR_REV(x) (x & 0xf)
34+
#define TEGRA_SMCCC_MINOR_REV(x) (x & 0xf)
35+
3036
static void __iomem *apbmisc_base;
3137
static bool long_ram_code;
3238
static u32 strapping;
@@ -41,21 +47,46 @@ u32 tegra_read_chipid(void)
4147

4248
u8 tegra_get_chip_id(void)
4349
{
50+
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
51+
s32 soc_id = arm_smccc_get_soc_id_version();
52+
53+
if (soc_id >= 0)
54+
return TEGRA_SMCCC_CHIP_ID(soc_id);
55+
#endif
4456
return (tegra_read_chipid() >> 8) & 0xff;
4557
}
4658

4759
u8 tegra_get_major_rev(void)
4860
{
61+
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
62+
s32 soc_id = arm_smccc_get_soc_id_version();
63+
64+
if (soc_id >= 0)
65+
return TEGRA_SMCCC_MAJOR_REV(soc_id);
66+
#endif
4967
return (tegra_read_chipid() >> 4) & 0xf;
5068
}
5169

5270
u8 tegra_get_minor_rev(void)
5371
{
72+
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
73+
s32 revision = arm_smccc_get_soc_id_revision();
74+
75+
if (revision >= 0)
76+
return TEGRA_SMCCC_MINOR_REV(revision);
77+
#endif
5478
return (tegra_read_chipid() >> 16) & 0xf;
79+
5580
}
5681

5782
u8 tegra_get_platform(void)
5883
{
84+
#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
85+
s32 revision = arm_smccc_get_soc_id_revision();
86+
87+
if (revision >= 0)
88+
return TEGRA_SMCCC_PLATFORM(revision);
89+
#endif
5990
return (tegra_read_chipid() >> 20) & 0xf;
6091
}
6192

0 commit comments

Comments
 (0)