[PATCH v2 1/6] soc/tegra: initial tegra-automotive detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>

Add an initial soc_is_tegra_auto() with detection
via a change in the device-tree.

Also print the path taken through soc_is_tegra_auto() to
allow debugging. Only print when debug is enabled as this
function may be be called from multiple places, resulting
in duplicated messages in production.

Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
Signed-off-by: Thomas Preston <thomas.preston@xxxxxxxxxxxxxxx>
Signed-off-by: Kejia Hu <kejia.hu@xxxxxxxxxxxxxxx>
---
 drivers/soc/tegra/common.c             | 23 +++++++++++++++++++++++
 drivers/soc/tegra/fuse/tegra-apbmisc.c |  2 ++
 include/soc/tegra/common.h             |  1 +
 include/soc/tegra/fuse.h               |  1 +
 4 files changed, 27 insertions(+)

diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
index 7bfb154d6fa5..a10bd26fb5df 100644
--- a/drivers/soc/tegra/common.c
+++ b/drivers/soc/tegra/common.c
@@ -9,6 +9,7 @@
 #include <linux/of.h>
 
 #include <soc/tegra/common.h>
+#include <soc/tegra/fuse.h>
 
 static const struct of_device_id tegra_machine_match[] = {
 	{ .compatible = "nvidia,tegra20", },
@@ -34,3 +35,25 @@ bool soc_is_tegra(void)
 
 	return match != NULL;
 }
+
+static const struct of_device_id tegra_machine_match_auto[] = {
+	{ .compatible = "nvidia,tegra20auto", },
+	{ .compatible = "nvidia,tegra30auto", },
+	{ },
+};
+
+bool soc_is_tegra_auto(void)
+{
+	struct device_node *root;
+	bool id_match  = false;
+
+	root = of_find_node_by_path("/");
+
+	if (root && of_match_node(tegra_machine_match_auto, root))
+		id_match = true;
+
+	pr_debug("%s of_device_id match %d, tegra_sku_info.is_automotive %d\n",
+			__func__, id_match, tegra_sku_info.is_automotive);
+
+	return id_match || tegra_sku_info.is_automotive;
+}
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index e5a4d8f98b10..b2727afad24b 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -110,6 +110,8 @@ void __init tegra_init_revision(void)
 
 	tegra_sku_info.revision = rev;
 
+	tegra_sku_info.is_automotive = false;
+
 	tegra_sku_info.sku_id = tegra_fuse_read_early(FUSE_SKU_INFO);
 }
 
diff --git a/include/soc/tegra/common.h b/include/soc/tegra/common.h
index fc13a9a134e9..8dd178ddc6a6 100644
--- a/include/soc/tegra/common.h
+++ b/include/soc/tegra/common.h
@@ -10,5 +10,6 @@
 #define __SOC_TEGRA_COMMON_H__
 
 bool soc_is_tegra(void);
+bool soc_is_tegra_auto(void);
 
 #endif /* __SOC_TEGRA_COMMON_H__ */
diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
index 8fb2f8a87339..ea4caf6f0cf7 100644
--- a/include/soc/tegra/fuse.h
+++ b/include/soc/tegra/fuse.h
@@ -56,6 +56,7 @@ struct tegra_sku_info {
 	int gpu_speedo_id;
 	int gpu_speedo_value;
 	enum tegra_revision revision;
+	bool is_automotive;
 };
 
 u32 tegra_read_straps(void);
-- 
2.11.0




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux