From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-tegra@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH v2 08/14] soc/tegra: fuse: Implement tegra_is_silicon()
Date: Thu, 17 Sep 2020 12:07:46 +0200 [thread overview]
Message-ID: <20200917100752.3516153-9-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200917100752.3516153-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
This function can be used by drivers to determine whether code is
running on silicon or on a simulation platform.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- fix return value for pre-Tegra194 chips and add comment explaining
why we always return true for those chips
drivers/soc/tegra/fuse/tegra-apbmisc.c | 19 +++++++++++++++++++
include/soc/tegra/fuse.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index 92a2d646c183..946a2d9ad117 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -52,6 +52,25 @@ u8 tegra_get_platform(void)
return (tegra_read_chipid() >> 20) & 0xf;
}
+bool tegra_is_silicon(void)
+{
+ switch (tegra_get_chip_id()) {
+ case TEGRA194:
+ if (tegra_get_platform() == 0)
+ return true;
+
+ return false;
+ }
+
+ /*
+ * Chips prior to Tegra194 have a different way of determining whether
+ * they are silicon or not. Since we never supported simulation on the
+ * older Tegra chips, don't bother extracting the information and just
+ * report that we're running on silicon.
+ */
+ return true;
+}
+
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 214908fc5581..a9db917a1d06 100644
--- a/include/soc/tegra/fuse.h
+++ b/include/soc/tegra/fuse.h
@@ -24,6 +24,7 @@
u32 tegra_read_chipid(void);
u8 tegra_get_chip_id(void);
u8 tegra_get_platform(void);
+bool tegra_is_silicon(void);
enum tegra_revision {
TEGRA_REVISION_UNKNOWN = 0,
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-17 10:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 10:07 [PATCH v2 00/14] arm64: tegra: Initial Tegra234 VDK support Thierry Reding
2020-09-17 10:07 ` [PATCH v2 01/14] dt-bindings: misc: tegra-apbmisc: Add missing compatible strings Thierry Reding
2020-09-17 10:07 ` [PATCH v2 02/14] dt-bindings: misc: tegra186-misc: Add missing compatible string Thierry Reding
2020-09-17 10:07 ` [PATCH v2 03/14] dt-bindings: misc: tegra186-misc: Add Tegra234 support Thierry Reding
2020-09-17 10:07 ` [PATCH v2 04/14] dt-bindings: tegra: Add Tegra234 VDK compatible Thierry Reding
2020-09-17 10:07 ` [PATCH v2 05/14] dt-bindings: fuse: tegra: Add Tegra234 support Thierry Reding
2020-09-17 10:07 ` [PATCH v2 06/14] dt-bindings: tegra: pmc: " Thierry Reding
2020-09-17 10:07 ` [PATCH v2 07/14] soc/tegra: fuse: Extract tegra_get_platform() Thierry Reding
2020-09-17 10:07 ` Thierry Reding [this message]
2020-09-17 10:07 ` [PATCH v2 09/14] soc/tegra: fuse: Add Tegra234 support Thierry Reding
2020-09-17 10:07 ` [PATCH v2 10/14] soc/tegra: misc: " Thierry Reding
2020-09-17 10:07 ` [PATCH v2 11/14] soc/tegra: pmc: Reorder reset sources/levels definitions Thierry Reding
2020-09-17 10:07 ` [PATCH v2 12/14] soc/tegra: pmc: Add Tegra234 support Thierry Reding
2020-09-17 10:07 ` [PATCH v2 13/14] firmware: tegra: Enable BPMP support on Tegra234 Thierry Reding
2020-09-17 10:07 ` [PATCH v2 14/14] arm64: tegra: Initial Tegra234 VDK support Thierry Reding
2020-09-24 10:32 ` Mikko Perttunen
2020-09-18 12:54 ` [PATCH v2 00/14] " Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200917100752.3516153-9-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-tegra@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).