All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Jon Hunter <jonathanh@nvidia.com>,
	linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 07/14] soc/tegra: fuse: Extract tegra_get_platform()
Date: Thu, 17 Sep 2020 12:07:45 +0200	[thread overview]
Message-ID: <20200917100752.3516153-8-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200917100752.3516153-1-thierry.reding@gmail.com>

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.

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
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 8e416ad91ee2..92a2d646c183 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,
-- 
2.28.0


WARNING: multiple messages have this Message-ID (diff)
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 07/14] soc/tegra: fuse: Extract tegra_get_platform()
Date: Thu, 17 Sep 2020 12:07:45 +0200	[thread overview]
Message-ID: <20200917100752.3516153-8-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200917100752.3516153-1-thierry.reding@gmail.com>

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.

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
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 8e416ad91ee2..92a2d646c183 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,
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-09-17 10:08 UTC|newest]

Thread overview: 34+ 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 ` 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   ` 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   ` 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   ` 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   ` 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   ` Thierry Reding
2020-09-17 10:07 ` [PATCH v2 06/14] dt-bindings: tegra: pmc: " Thierry Reding
2020-09-17 10:07   ` Thierry Reding
2020-09-17 10:07 ` Thierry Reding [this message]
2020-09-17 10:07   ` [PATCH v2 07/14] soc/tegra: fuse: Extract tegra_get_platform() Thierry Reding
2020-09-17 10:07 ` [PATCH v2 08/14] soc/tegra: fuse: Implement tegra_is_silicon() Thierry Reding
2020-09-17 10:07   ` Thierry Reding
2020-09-17 10:07 ` [PATCH v2 09/14] soc/tegra: fuse: Add Tegra234 support Thierry Reding
2020-09-17 10:07   ` Thierry Reding
2020-09-17 10:07 ` [PATCH v2 10/14] soc/tegra: misc: " Thierry Reding
2020-09-17 10:07   ` 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   ` Thierry Reding
2020-09-17 10:07 ` [PATCH v2 12/14] soc/tegra: pmc: Add Tegra234 support Thierry Reding
2020-09-17 10:07   ` 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   ` Thierry Reding
2020-09-17 10:07 ` [PATCH v2 14/14] arm64: tegra: Initial Tegra234 VDK support Thierry Reding
2020-09-17 10:07   ` Thierry Reding
2020-09-24 10:32   ` Mikko Perttunen
2020-09-24 10:32     ` Mikko Perttunen
2020-09-18 12:54 ` [PATCH v2 00/14] " Jon Hunter
2020-09-18 12:54   ` 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-8-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.