]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/tpm/tpm_tis_i2c.h
tpm: tpm_tis_i2c: Drop unnecessary methods
[karo-tx-uboot.git] / drivers / tpm / tpm_tis_i2c.h
1 /*
2  * Copyright (C) 2011 Infineon Technologies
3  *
4  * Authors:
5  * Peter Huewe <huewe.external@infineon.com>
6  *
7  * Version: 2.1.1
8  *
9  * Description:
10  * Device driver for TCG/TCPA TPM (trusted platform module).
11  * Specifications at www.trustedcomputinggroup.org
12  *
13  * It is based on the Linux kernel driver tpm.c from Leendert van
14  * Dorn, Dave Safford, Reiner Sailer, and Kyleen Hall.
15  *
16  * SPDX-License-Identifier:     GPL-2.0
17  */
18
19 #ifndef _TPM_TIS_I2C_H
20 #define _TPM_TIS_I2C_H
21
22 #include <linux/compiler.h>
23 #include <linux/types.h>
24
25 enum tpm_timeout {
26         TPM_TIMEOUT = 5,        /* msecs */
27 };
28
29 /* Size of external transmit buffer (used in tpm_transmit)*/
30 #define TPM_BUFSIZE 4096
31
32 /* Index of Count field in TPM response buffer */
33 #define TPM_RSP_SIZE_BYTE       2
34 #define TPM_RSP_RC_BYTE         6
35
36 struct tpm_chip;
37
38 struct tpm_vendor_specific {
39         const u8 req_complete_mask;
40         const u8 req_complete_val;
41         const u8 req_canceled;
42         int irq;
43         int locality;
44         unsigned long timeout_a, timeout_b, timeout_c, timeout_d;  /* msec */
45         unsigned long duration[3];  /* msec */
46 };
47
48 struct tpm_chip {
49         int is_open;
50         struct tpm_vendor_specific vendor;
51 };
52
53 struct tpm_input_header {
54         __be16 tag;
55         __be32 length;
56         __be32 ordinal;
57 } __packed;
58
59 struct tpm_output_header {
60         __be16 tag;
61         __be32 length;
62         __be32 return_code;
63 } __packed;
64
65 struct timeout_t {
66         __be32 a;
67         __be32 b;
68         __be32 c;
69         __be32 d;
70 } __packed;
71
72 struct duration_t {
73         __be32 tpm_short;
74         __be32 tpm_medium;
75         __be32 tpm_long;
76 } __packed;
77
78 union cap_t {
79         struct timeout_t timeout;
80         struct duration_t duration;
81 };
82
83 struct tpm_getcap_params_in {
84         __be32 cap;
85         __be32 subcap_size;
86         __be32 subcap;
87 } __packed;
88
89 struct tpm_getcap_params_out {
90         __be32 cap_size;
91         union cap_t cap;
92 } __packed;
93
94 union tpm_cmd_header {
95         struct tpm_input_header in;
96         struct tpm_output_header out;
97 };
98
99 union tpm_cmd_params {
100         struct tpm_getcap_params_out getcap_out;
101         struct tpm_getcap_params_in getcap_in;
102 };
103
104 struct tpm_cmd_t {
105         union tpm_cmd_header header;
106         union tpm_cmd_params params;
107 } __packed;
108
109 struct tpm_chip *tpm_register_hardware(const struct tpm_vendor_specific *);
110
111 struct udevice;
112 int tpm_vendor_init(struct udevice *dev);
113
114 void tpm_vendor_cleanup(struct tpm_chip *chip);
115
116 #endif