diff options
author | Thierry Reding <treding@nvidia.com> | 2014-07-16 14:01:44 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-07-17 14:58:41 +0200 |
commit | a2686766c81e18fb1ab9375cf5d3cbd54a3bed2c (patch) | |
tree | 230cbea98cf8173dbf40ce7b994dce83fe56ed3b /drivers/soc/tegra/common.c | |
parent | dd849e581d7d23e1729c23bb2d6b85360ce4dd9d (diff) |
soc/tegra: Implement runtime check for Tegra SoCs
Subsequent patches will move some of the initialization code from SoC
setup code to regular initcalls. To prevent breakage on other SoCs in
multi-platform builds, these initcalls need to check that they indeed
run on Tegra.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/soc/tegra/common.c')
-rw-r--r-- | drivers/soc/tegra/common.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c new file mode 100644 index 000000000000..a71cb74f3674 --- /dev/null +++ b/drivers/soc/tegra/common.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/of.h> + +#include <soc/tegra/common.h> + +static const struct of_device_id tegra_machine_match[] = { + { .compatible = "nvidia,tegra20", }, + { .compatible = "nvidia,tegra30", }, + { .compatible = "nvidia,tegra114", }, + { .compatible = "nvidia,tegra124", }, + { } +}; + +bool soc_is_tegra(void) +{ + struct device_node *root; + + root = of_find_node_by_path("/"); + if (!root) + return false; + + return of_match_node(tegra_machine_match, root) != NULL; +} |