Skip to content

Commit 52e6d39

Browse files
committed
soc/tegra: fuse: Implement tegra_is_silicon()
This function can be used by drivers to determine whether code is running on silicon or on a simulation platform. Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 775edf7 commit 52e6d39

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ u8 tegra_get_platform(void)
5252
return (tegra_read_chipid() >> 20) & 0xf;
5353
}
5454

55+
bool tegra_is_silicon(void)
56+
{
57+
switch (tegra_get_chip_id()) {
58+
case TEGRA194:
59+
if (tegra_get_platform() == 0)
60+
return true;
61+
62+
return false;
63+
}
64+
65+
/*
66+
* Chips prior to Tegra194 have a different way of determining whether
67+
* they are silicon or not. Since we never supported simulation on the
68+
* older Tegra chips, don't bother extracting the information and just
69+
* report that we're running on silicon.
70+
*/
71+
return true;
72+
}
73+
5574
u32 tegra_read_straps(void)
5675
{
5776
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
@@ -24,6 +24,7 @@
2424
u32 tegra_read_chipid(void);
2525
u8 tegra_get_chip_id(void);
2626
u8 tegra_get_platform(void);
27+
bool tegra_is_silicon(void);
2728

2829
enum tegra_revision {
2930
TEGRA_REVISION_UNKNOWN = 0,

0 commit comments

Comments
 (0)