Skip to content

Commit 775edf7

Browse files
committed
soc/tegra: fuse: Extract tegra_get_platform()
This function extracts the PRE_SI_PLATFORM field from the HIDREV register and can be used to determine which platform the kernel runs on (silicon, simulation, ...). Note that while only Tegra194 and later define this field, it should be safe to call this on prior generations as well since this field should read as 0, indicating silicon. Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 9123e3a commit 775edf7

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
336336
* platform type is silicon and all other non-zero values indicate
337337
* the type of simulation platform is being used.
338338
*/
339-
return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf);
339+
return sprintf(buf, "%d\n", tegra_get_platform());
340340
}
341341

342342
static DEVICE_ATTR_RO(platform);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ u8 tegra_get_minor_rev(void)
4747
return (tegra_read_chipid() >> 16) & 0xf;
4848
}
4949

50+
u8 tegra_get_platform(void)
51+
{
52+
return (tegra_read_chipid() >> 20) & 0xf;
53+
}
54+
5055
u32 tegra_read_straps(void)
5156
{
5257
WARN(!chipid, "Tegra ABP MISC not yet available\n");

include/soc/tegra/fuse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
u32 tegra_read_chipid(void);
2525
u8 tegra_get_chip_id(void);
26+
u8 tegra_get_platform(void);
2627

2728
enum tegra_revision {
2829
TEGRA_REVISION_UNKNOWN = 0,

0 commit comments

Comments
 (0)