Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Thierry Reding | a268676 | 2014-07-16 14:01:44 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved. |
Thierry Reding | a268676 | 2014-07-16 14:01:44 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <linux/of.h> |
| 7 | |
| 8 | #include <soc/tegra/common.h> |
| 9 | |
| 10 | static const struct of_device_id tegra_machine_match[] = { |
| 11 | { .compatible = "nvidia,tegra20", }, |
| 12 | { .compatible = "nvidia,tegra30", }, |
| 13 | { .compatible = "nvidia,tegra114", }, |
| 14 | { .compatible = "nvidia,tegra124", }, |
Thierry Reding | ad09c8c | 2015-03-23 11:28:53 +0100 | [diff] [blame] | 15 | { .compatible = "nvidia,tegra132", }, |
Thierry Reding | 3a36998 | 2015-03-23 11:29:25 +0100 | [diff] [blame] | 16 | { .compatible = "nvidia,tegra210", }, |
Thierry Reding | a268676 | 2014-07-16 14:01:44 +0200 | [diff] [blame] | 17 | { } |
| 18 | }; |
| 19 | |
| 20 | bool soc_is_tegra(void) |
| 21 | { |
Yangtao Li | 9eb40fa | 2018-11-21 07:49:12 -0500 | [diff] [blame] | 22 | const struct of_device_id *match; |
Thierry Reding | a268676 | 2014-07-16 14:01:44 +0200 | [diff] [blame] | 23 | struct device_node *root; |
| 24 | |
| 25 | root = of_find_node_by_path("/"); |
| 26 | if (!root) |
| 27 | return false; |
| 28 | |
Yangtao Li | 9eb40fa | 2018-11-21 07:49:12 -0500 | [diff] [blame] | 29 | match = of_match_node(tegra_machine_match, root); |
| 30 | of_node_put(root); |
| 31 | |
| 32 | return match != NULL; |
Thierry Reding | a268676 | 2014-07-16 14:01:44 +0200 | [diff] [blame] | 33 | } |