Skip to contentSkip to conversation

soc/tegra: fuse: use platform info with soc revision

PATCH Superseded Kartik 2 participants 3 messages Nov 9, 2022 Tegra architecture support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kartik

author
#0 lore raw

PATCH v2 1/1 soc/tegra: fuse: use platform info with soc revision

Tegra pre-silicon platforms do not have chip revisions. This makes the revision soc attribute meaningless on these platforms.

Instead, populate the revision soc attribute with
"platform name + chip revision" for Silicon. For pre-silicon platforms populate it with "platform name" instead.

---
v1->v2:
* Updated commit message.

 drivers/soc/tegra/fuse/fuse-tegra.c    | 23 +++++++++++++++++++++--
 drivers/soc/tegra/fuse/tegra-apbmisc.c |  1 +
 include/soc/tegra/fuse.h               | 15 +++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +21 -2
index ea25a1dcafc2..a20c9e0105dc 100644
@@ -35,6 +35,19 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
 	[TEGRA_REVISION_A04]     = "A04",
 };
 
+static const char *tegra_platform_name[TEGRA_PLATFORM_MAX] = {
+	[TEGRA_PLATFORM_SILICON]			= "Silicon",
+	[TEGRA_PLATFORM_QT]				= "QT",
+	[TEGRA_PLATFORM_SYSTEM_FPGA]			= "System FPGA",
+	[TEGRA_PLATFORM_UNIT_FPGA]			= "Unit FPGA",
+	[TEGRA_PLATFORM_ASIM_QT]			= "Asim QT",
+	[TEGRA_PLATFORM_ASIM_LINSIM]			= "Asim Linsim",
+	[TEGRA_PLATFORM_DSIM_ASIM_LINSIM]		= "Dsim Asim Linsim",
+	[TEGRA_PLATFORM_VERIFICATION_SIMULATION]	= "Verification Simulation",
+	[TEGRA_PLATFORM_VDK]				= "VDK",
+	[TEGRA_PLATFORM_VSP]				= "VSP",
+};
+
 static const struct of_device_id car_match[] __initconst = {
 	{ .compatible = "nvidia,tegra20-car", },
 	{ .compatible = "nvidia,tegra30-car", },
@@ -370,8 +383,14 @@ struct device * __init tegra_soc_device_register(void)
 		return NULL;
 
 	attr->family = kasprintf(GFP_KERNEL, "Tegra");
-	attr->revision = kasprintf(GFP_KERNEL, "%s",
-		tegra_revision_name[tegra_sku_info.revision]);
+	if (tegra_is_silicon()) {
+		attr->revision = kasprintf(GFP_KERNEL, "%s %s",
+					   tegra_platform_name[tegra_sku_info.platform],
+					   tegra_revision_name[tegra_sku_info.revision]);
+	} else {
+		attr->revision = kasprintf(GFP_KERNEL, "%s",
+					   tegra_platform_name[tegra_sku_info.platform]);
+	}
 	attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
 	attr->custom_attr_group = fuse->soc->soc_attr_group;
 
drivers/soc/tegra/fuse/tegra-apbmisc.c +1 -0
index 3351bd872ab2..4591c5bcb690 100644
@@ -156,6 +156,7 @@ void __init tegra_init_revision(void)
 	}
 
 	tegra_sku_info.sku_id = tegra_fuse_read_early(FUSE_SKU_INFO);
+	tegra_sku_info.platform = tegra_get_platform();
 }
 
 void __init tegra_init_apbmisc(void)
include/soc/tegra/fuse.h +15 -0
index 977c334136e9..a63de5da8124 100644
@@ -34,6 +34,20 @@ enum tegra_revision {
 	TEGRA_REVISION_MAX,
 };
 
+enum tegra_platform {
+	TEGRA_PLATFORM_SILICON = 0,
+	TEGRA_PLATFORM_QT,
+	TEGRA_PLATFORM_SYSTEM_FPGA,
+	TEGRA_PLATFORM_UNIT_FPGA,
+	TEGRA_PLATFORM_ASIM_QT,
+	TEGRA_PLATFORM_ASIM_LINSIM,
+	TEGRA_PLATFORM_DSIM_ASIM_LINSIM,
+	TEGRA_PLATFORM_VERIFICATION_SIMULATION,
+	TEGRA_PLATFORM_VDK,
+	TEGRA_PLATFORM_VSP,
+	TEGRA_PLATFORM_MAX,
+};
+
 struct tegra_sku_info {
 	int sku_id;
 	int cpu_process_id;
@@ -47,6 +61,7 @@ struct tegra_sku_info {
 	int gpu_speedo_id;
 	int gpu_speedo_value;
 	enum tegra_revision revision;
+	enum tegra_platform platform;
 };
 
 #ifdef CONFIG_ARCH_TEGRA
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 42 lines · Kartik

Tegra pre-silicon platforms do not have chip revisions. This makes the revision soc attribute meaningless on these platforms.

Instead, populate the revision soc attribute with
"platform name + chip revision" for Silicon. For pre-silicon platforms populate it with "platform name" instead.

---
v1->v2:
* Updated commit message.

  drivers/soc/tegra/fuse/fuse-tegra.c    | 23 +++++++++++++++++++++--
  drivers/soc/tegra/fuse/tegra-apbmisc.c |  1 +
  include/soc/tegra/fuse.h               | 15 +++++++++++++++
  3 files changed, 37 insertions(+), 2 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +13 -0
index ea25a1dcafc2..a20c9e0105dc 100644
@@ -35,6 +35,19 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
  	[TEGRA_REVISION_A04]     = "A04",
  };
 
+static const char *tegra_platform_name[TEGRA_PLATFORM_MAX] = {
+	[TEGRA_PLATFORM_SILICON]			= "Silicon",
+	[TEGRA_PLATFORM_QT]				= "QT",
+	[TEGRA_PLATFORM_SYSTEM_FPGA]			= "System FPGA",
+	[TEGRA_PLATFORM_UNIT_FPGA]			= "Unit FPGA",
+	[TEGRA_PLATFORM_ASIM_QT]			= "Asim QT",
+	[TEGRA_PLATFORM_ASIM_LINSIM]			= "Asim Linsim",
+	[TEGRA_PLATFORM_DSIM_ASIM_LINSIM]		= "Dsim Asim Linsim",
+	[TEGRA_PLATFORM_VERIFICATION_SIMULATION]	= "Verification Simulation",
+	[TEGRA_PLATFORM_VDK]				= "VDK",
+	[TEGRA_PLATFORM_VSP]				= "VSP",
+};
+
  static const struct of_device_id car_match[] __initconst = {
  	{ .compatible = "nvidia,tegra20-car", },
  	{ .compatible = "nvidia,tegra30-car", },

drivers/soc/tegra/fuse/fuse-tegra.c struct device * __init tegra_soc_device_register(void) · line 386

Quoted 6 lines
drivers/soc/tegra/fuse/fuse-tegra.c +1 -2
@@ -370,8 +383,14 @@ struct device * __init tegra_soc_device_register(void)
  		return NULL;
 
  	attr->family = kasprintf(GFP_KERNEL, "Tegra");
-	attr->revision = kasprintf(GFP_KERNEL, "%s",
-		tegra_revision_name[tegra_sku_info.revision]);
+	if (tegra_is_silicon()) {

curly braces are not needed.

drivers/soc/tegra/fuse/fuse-tegra.c struct device * __init tegra_soc_device_register(void) · line 388

Quoted 2 lines
drivers/soc/tegra/fuse/fuse-tegra.c +2 -0
+		attr->revision = kasprintf(GFP_KERNEL, "%s %s",
+					   tegra_platform_name[tegra_sku_info.platform],

Do we need to include platform here? Can't we just print the revision?

Quoted 53 lines
drivers/soc/tegra/fuse/fuse-tegra.c +5 -0
+					   tegra_revision_name[tegra_sku_info.revision]);
+	} else {
+		attr->revision = kasprintf(GFP_KERNEL, "%s",
+					   tegra_platform_name[tegra_sku_info.platform]);
+	}
  	attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
  	attr->custom_attr_group = fuse->soc->soc_attr_group;
 
drivers/soc/tegra/fuse/tegra-apbmisc.c +1 -0
index 3351bd872ab2..4591c5bcb690 100644
@@ -156,6 +156,7 @@ void __init tegra_init_revision(void)
  	}
 
  	tegra_sku_info.sku_id = tegra_fuse_read_early(FUSE_SKU_INFO);
+	tegra_sku_info.platform = tegra_get_platform();
  }
 
  void __init tegra_init_apbmisc(void)
include/soc/tegra/fuse.h +15 -0
index 977c334136e9..a63de5da8124 100644
@@ -34,6 +34,20 @@ enum tegra_revision {
  	TEGRA_REVISION_MAX,
  };
 
+enum tegra_platform {
+	TEGRA_PLATFORM_SILICON = 0,
+	TEGRA_PLATFORM_QT,
+	TEGRA_PLATFORM_SYSTEM_FPGA,
+	TEGRA_PLATFORM_UNIT_FPGA,
+	TEGRA_PLATFORM_ASIM_QT,
+	TEGRA_PLATFORM_ASIM_LINSIM,
+	TEGRA_PLATFORM_DSIM_ASIM_LINSIM,
+	TEGRA_PLATFORM_VERIFICATION_SIMULATION,
+	TEGRA_PLATFORM_VDK,
+	TEGRA_PLATFORM_VSP,
+	TEGRA_PLATFORM_MAX,
+};
+
  struct tegra_sku_info {
  	int sku_id;
  	int cpu_process_id;
@@ -47,6 +61,7 @@ struct tegra_sku_info {
  	int gpu_speedo_id;
  	int gpu_speedo_value;
  	enum tegra_revision revision;
+	enum tegra_platform platform;
  };
 
  #ifdef CONFIG_ARCH_TEGRA
Signature · 1 line
nvpublic
maintainer
#2 lore raw
Quoted 55 lines · Jon Hunter
Quoted 43 lines · Kartik

Tegra pre-silicon platforms do not have chip revisions. This makes the revision soc attribute meaningless on these platforms.

Instead, populate the revision soc attribute with
"platform name + chip revision" for Silicon. For pre-silicon platforms populate it with "platform name" instead.

---
v1->v2:
  * Updated commit message.

  drivers/soc/tegra/fuse/fuse-tegra.c    | 23 +++++++++++++++++++++-- drivers/soc/tegra/fuse/tegra-apbmisc.c |  1 + include/soc/tegra/fuse.h               | 15 +++++++++++++++

  3 files changed, 37 insertions(+), 2 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +13 -0
index ea25a1dcafc2..a20c9e0105dc 100644
@@ -35,6 +35,19 @@ static const char 
 *tegra_revision_name[TEGRA_REVISION_MAX] = {
       [TEGRA_REVISION_A04]     = "A04",
   };
+static const char *tegra_platform_name[TEGRA_PLATFORM_MAX] = {
+    [TEGRA_PLATFORM_SILICON]            = "Silicon",
+    [TEGRA_PLATFORM_QT]                = "QT",
+    [TEGRA_PLATFORM_SYSTEM_FPGA]            = "System FPGA",
+    [TEGRA_PLATFORM_UNIT_FPGA]            = "Unit FPGA",
+    [TEGRA_PLATFORM_ASIM_QT]            = "Asim QT",
+    [TEGRA_PLATFORM_ASIM_LINSIM]            = "Asim Linsim",
+    [TEGRA_PLATFORM_DSIM_ASIM_LINSIM]        = "Dsim Asim Linsim",
+    [TEGRA_PLATFORM_VERIFICATION_SIMULATION]    = "Verification 
 Simulation",
+    [TEGRA_PLATFORM_VDK]                = "VDK",
+    [TEGRA_PLATFORM_VSP]                = "VSP",
+};
+
   static const struct of_device_id car_match[] __initconst = {
       { .compatible = "nvidia,tegra20-car", },

      { .compatible = "nvidia,tegra30-car", },

drivers/soc/tegra/fuse/fuse-tegra.c struct device * __init · line 386

Quoted 6 lines
drivers/soc/tegra/fuse/fuse-tegra.c +1 -2
@@ -370,8 +383,14 @@ struct device * __init 
 tegra_soc_device_register(void)
           return NULL;
       attr->family = kasprintf(GFP_KERNEL, "Tegra");
-    attr->revision = kasprintf(GFP_KERNEL, "%s",
-        tegra_revision_name[tegra_sku_info.revision]);
+    if (tegra_is_silicon()) {

curly braces are not needed.

Quoted 4 lines

drivers/soc/tegra/fuse/fuse-tegra.c struct device * __init tegra_soc_device_register(void) · line 388

Quoted 2 lines
drivers/soc/tegra/fuse/fuse-tegra.c +2 -0
+        attr->revision = kasprintf(GFP_KERNEL, "%s %s",
+                       tegra_platform_name[tegra_sku_info.platform],

Do we need to include platform here? Can't we just print the revision?

Actually, printing something like "Silicon A02" here is fine. No need to change.

Jon

Signature · 1 line
nvpublic