All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH 5/9] soc/tegra: fuse: Extract tegra_get_platform()
Date: Thu, 16 Jul 2020 16:18:52 +0200	[thread overview]
Message-ID: <20200716141856.544718-6-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200716141856.544718-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 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,
-- 
2.27.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 5/9] soc/tegra: fuse: Extract tegra_get_platform()
Date: Thu, 16 Jul 2020 16:18:52 +0200	[thread overview]
Message-ID: <20200716141856.544718-6-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200716141856.544718-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.

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,
-- 
2.27.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-07-16 14:18 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 14:18 [PATCH 0/9] arm64: tegra: Initial Tegra234 VDK support Thierry Reding
2020-07-16 14:18 ` Thierry Reding
     [not found] ` <20200716141856.544718-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-07-16 14:18   ` [PATCH 1/9] dt-bindings: tegra: Add Tegra234 VDK compatible Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:29     ` Jon Hunter
2020-09-07 19:29       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 2/9] dt-bindings: fuse: tegra: Add missing compatible strings Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:29     ` Jon Hunter
2020-09-07 19:29       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 3/9] dt-bindings: fuse: tegra: Document Tegra234 compatible string Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:30     ` Jon Hunter
2020-09-07 19:30       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 4/9] soc/tegra: fuse: Add Tegra186 and Tegra194 SoC IDs Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-07-16 14:18   ` Thierry Reding [this message]
2020-07-16 14:18     ` [PATCH 5/9] soc/tegra: fuse: Extract tegra_get_platform() Thierry Reding
2020-09-07 19:30     ` Jon Hunter
2020-09-07 19:30       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 6/9] soc/tegra: fuse: Implement tegra_is_silicon() Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:32     ` Jon Hunter
2020-09-07 19:32       ` Jon Hunter
2020-09-15 12:38       ` Thierry Reding
2020-09-15 12:38         ` Thierry Reding
2020-07-16 14:18   ` [PATCH 7/9] soc/tegra: fuse: Add Tegra234 support Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:39     ` Jon Hunter
2020-09-07 19:39       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 8/9] firmware: tegra: Enable BPMP support on Tegra234 Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:43     ` Jon Hunter
2020-09-07 19:43       ` Jon Hunter
2020-07-16 14:18   ` [PATCH 9/9] arm64: tegra: Initial Tegra234 VDK support Thierry Reding
2020-07-16 14:18     ` Thierry Reding
2020-09-07 19:46     ` Jon Hunter
2020-09-07 19:46       ` Jon Hunter
2020-09-15 12:44       ` Thierry Reding
2020-09-15 12:44         ` Thierry Reding
2020-09-15 13:17         ` Jon Hunter
2020-09-15 13:17           ` Jon Hunter
2020-09-15 13:49           ` Thierry Reding
2020-09-15 13:49             ` Thierry Reding

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=20200716141856.544718-6-thierry.reding@gmail.com \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.