xref: /linux/drivers/soc/tegra/common.c (revision d2912cb15bdda8ba4a5dd73396ad62641af2f520)
1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2a2686766SThierry Reding /*
3a2686766SThierry Reding  * Copyright (C) 2014 NVIDIA CORPORATION.  All rights reserved.
4a2686766SThierry Reding  */
5a2686766SThierry Reding 
6a2686766SThierry Reding #include <linux/of.h>
7a2686766SThierry Reding 
8a2686766SThierry Reding #include <soc/tegra/common.h>
9a2686766SThierry Reding 
10a2686766SThierry Reding static const struct of_device_id tegra_machine_match[] = {
11a2686766SThierry Reding 	{ .compatible = "nvidia,tegra20", },
12a2686766SThierry Reding 	{ .compatible = "nvidia,tegra30", },
13a2686766SThierry Reding 	{ .compatible = "nvidia,tegra114", },
14a2686766SThierry Reding 	{ .compatible = "nvidia,tegra124", },
15ad09c8c2SThierry Reding 	{ .compatible = "nvidia,tegra132", },
163a369982SThierry Reding 	{ .compatible = "nvidia,tegra210", },
17a2686766SThierry Reding 	{ }
18a2686766SThierry Reding };
19a2686766SThierry Reding 
20a2686766SThierry Reding bool soc_is_tegra(void)
21a2686766SThierry Reding {
229eb40fa2SYangtao Li 	const struct of_device_id *match;
23a2686766SThierry Reding 	struct device_node *root;
24a2686766SThierry Reding 
25a2686766SThierry Reding 	root = of_find_node_by_path("/");
26a2686766SThierry Reding 	if (!root)
27a2686766SThierry Reding 		return false;
28a2686766SThierry Reding 
299eb40fa2SYangtao Li 	match = of_match_node(tegra_machine_match, root);
309eb40fa2SYangtao Li 	of_node_put(root);
319eb40fa2SYangtao Li 
329eb40fa2SYangtao Li 	return match != NULL;
33a2686766SThierry Reding }
34