Message ID | 20200716141856.544718-6-thierry.reding@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: tegra: Initial Tegra234 VDK support | expand |
On 16/07/2020 15:18, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > 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. > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > drivers/soc/tegra/fuse/fuse-tegra.c | 2 +- > drivers/soc/tegra/fuse/tegra-apbmisc.c | 5 +++++ > include/soc/tegra/fuse.h | 1 + > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c > index d1f8dd0289e6..7e6b6ee59120 100644 > --- a/drivers/soc/tegra/fuse/fuse-tegra.c > +++ b/drivers/soc/tegra/fuse/fuse-tegra.c > @@ -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); > diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c > index 3cdd69d1bd4d..89f1479b4d0e 100644 > --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c > +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c > @@ -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"); > diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h > index 1097feca41ed..214908fc5581 100644 > --- a/include/soc/tegra/fuse.h > +++ b/include/soc/tegra/fuse.h > @@ -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, > Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Cheers Jon
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index d1f8dd0289e6..7e6b6ee59120 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -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); diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 3cdd69d1bd4d..89f1479b4d0e 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -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"); diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index 1097feca41ed..214908fc5581 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -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,