^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <soc/tegra/common.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) static const struct of_device_id tegra_machine_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) { .compatible = "nvidia,tegra20", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) { .compatible = "nvidia,tegra30", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) { .compatible = "nvidia,tegra114", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) { .compatible = "nvidia,tegra124", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) { .compatible = "nvidia,tegra132", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) { .compatible = "nvidia,tegra210", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) bool soc_is_tegra(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) const struct of_device_id *match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct device_node *root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) root = of_find_node_by_path("/");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) if (!root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) match = of_match_node(tegra_machine_match, root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) of_node_put(root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) return match != NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) }