Skip to content

Commit

Permalink
soc/tegra: fuse: Extract tegra_get_platform()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
  • Loading branch information
thierryreding committed Sep 18, 2020
1 parent 9123e3a commit 775edf7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/soc/tegra/fuse/fuse-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr,
* platform type is silicon and all other non-zero values indicate
* the type of simulation platform is being used.
*/
return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf);
return sprintf(buf, "%d\n", tegra_get_platform());
}

static DEVICE_ATTR_RO(platform);
Expand Down
5 changes: 5 additions & 0 deletions drivers/soc/tegra/fuse/tegra-apbmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ u8 tegra_get_minor_rev(void)
return (tegra_read_chipid() >> 16) & 0xf;
}

u8 tegra_get_platform(void)
{
return (tegra_read_chipid() >> 20) & 0xf;
}

u32 tegra_read_straps(void)
{
WARN(!chipid, "Tegra ABP MISC not yet available\n");
Expand Down
1 change: 1 addition & 0 deletions include/soc/tegra/fuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

u32 tegra_read_chipid(void);
u8 tegra_get_chip_id(void);
u8 tegra_get_platform(void);

enum tegra_revision {
TEGRA_REVISION_UNKNOWN = 0,
Expand Down

0 comments on commit 775edf7

Please sign in to comment.