Skip to content

Commit a268676

Browse files
committed
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>
1 parent dd849e5 commit a268676

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎drivers/soc/tegra/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
obj-$(CONFIG_ARCH_TEGRA) += fuse/
2+
3+
obj-$(CONFIG_ARCH_TEGRA) += common.o

‎drivers/soc/tegra/common.c‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (C) 2014 NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
7+
*/
8+
9+
#include <linux/of.h>
10+
11+
#include <soc/tegra/common.h>
12+
13+
static const struct of_device_id tegra_machine_match[] = {
14+
{ .compatible = "nvidia,tegra20", },
15+
{ .compatible = "nvidia,tegra30", },
16+
{ .compatible = "nvidia,tegra114", },
17+
{ .compatible = "nvidia,tegra124", },
18+
{ }
19+
};
20+
21+
bool soc_is_tegra(void)
22+
{
23+
struct device_node *root;
24+
25+
root = of_find_node_by_path("/");
26+
if (!root)
27+
return false;
28+
29+
return of_match_node(tegra_machine_match, root) != NULL;
30+
}

‎include/soc/tegra/common.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (C) 2014 NVIDIA Corporation
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
7+
*/
8+
9+
#ifndef __SOC_TEGRA_COMMON_H__
10+
#define __SOC_TEGRA_COMMON_H__
11+
12+
bool soc_is_tegra(void);
13+
14+
#endif /* __SOC_TEGRA_COMMON_H__ */

0 commit comments

Comments
 (0)