1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Texas Instruments System Control Interface Protocol
4  * Based on include/linux/soc/ti/ti_sci_protocol.h from Linux.
5  *
6  * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
7  *	Nishanth Menon
8  *	Lokesh Vutla <lokeshvutla@ti.com>
9  */
10 
11 #ifndef __TISCI_PROTOCOL_H
12 #define __TISCI_PROTOCOL_H
13 
14 /**
15  * struct ti_sci_version_info - version information structure
16  * @abi_major:	Major ABI version. Change here implies risk of backward
17  *		compatibility break.
18  * @abi_minor:	Minor ABI version. Change here implies new feature addition,
19  *		or compatible change in ABI.
20  * @firmware_revision:	Firmware revision (not usually used).
21  * @firmware_description: Firmware description (not usually used).
22  */
23 struct ti_sci_version_info {
24 	u8 abi_major;
25 	u8 abi_minor;
26 	u16 firmware_revision;
27 	char firmware_description[32];
28 };
29 
30 struct ti_sci_handle;
31 
32 /**
33  * struct ti_sci_handle - Handle returned to TI SCI clients for usage.
34  * @version:	structure containing version information
35  */
36 struct ti_sci_handle {
37 	struct ti_sci_version_info version;
38 };
39 
40 #if IS_ENABLED(CONFIG_TI_SCI_PROTOCOL)
41 
42 const struct ti_sci_handle *ti_sci_get_handle_from_sysfw(struct udevice *dev);
43 const struct ti_sci_handle *ti_sci_get_handle(struct udevice *dev);
44 const struct ti_sci_handle *ti_sci_get_by_phandle(struct udevice *dev,
45 						  const char *property);
46 
47 #else	/* CONFIG_TI_SCI_PROTOCOL */
48 
49 static inline
50 const struct ti_sci_handle *ti_sci_get_handle_from_sysfw(struct udevice *dev)
51 {
52 	return ERR_PTR(-EINVAL);
53 }
54 
55 static inline const struct ti_sci_handle *ti_sci_get_handle(struct udevice *dev)
56 {
57 	return ERR_PTR(-EINVAL);
58 }
59 
60 static inline
61 const struct ti_sci_handle *ti_sci_get_by_phandle(struct udevice *dev,
62 						  const char *property)
63 {
64 	return ERR_PTR(-EINVAL);
65 }
66 #endif	/* CONFIG_TI_SCI_PROTOCOL */
67 
68 #endif	/* __TISCI_PROTOCOL_H */
69