Merge remote-tracking branch 'asoc/fix/wm8993' into asoc-linus
[linux.git] / arch / arm / include / asm / trusted_foundations.h
1 /*
2  * Copyright (c) 2013, 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 as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 /*
16  * Support for the Trusted Foundations secure monitor.
17  *
18  * Trusted Foundation comes active on some ARM consumer devices (most
19  * Tegra-based devices sold on the market are concerned). Such devices can only
20  * perform some basic operations, like setting the CPU reset vector, through
21  * SMC calls to the secure monitor. The calls are completely specific to
22  * Trusted Foundations, and do *not* follow the SMC calling convention or the
23  * PSCI standard.
24  */
25
26 #ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H
27 #define __ASM_ARM_TRUSTED_FOUNDATIONS_H
28
29 #include <linux/kconfig.h>
30 #include <linux/printk.h>
31 #include <linux/bug.h>
32 #include <linux/of.h>
33
34 struct trusted_foundations_platform_data {
35         unsigned int version_major;
36         unsigned int version_minor;
37 };
38
39 #if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS)
40
41 void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
42 void of_register_trusted_foundations(void);
43
44 #else /* CONFIG_TRUSTED_FOUNDATIONS */
45
46 static inline void register_trusted_foundations(
47                                    struct trusted_foundations_platform_data *pd)
48 {
49         /*
50          * If we try to register TF, this means the system needs it to continue.
51          * Its absence if thus a fatal error.
52          */
53         panic("No support for Trusted Foundations, stopping...\n");
54 }
55
56 static inline void of_register_trusted_foundations(void)
57 {
58         /*
59          * If we find the target should enable TF but does not support it,
60          * fail as the system won't be able to do much anyway
61          */
62         if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations"))
63                 register_trusted_foundations(NULL);
64 }
65 #endif /* CONFIG_TRUSTED_FOUNDATIONS */
66
67 #endif