2 * Copyright (C) 2011 Infineon Technologies
5 * Peter Huewe <huewe.external@infineon.com>
10 * Device driver for TCG/TCPA TPM (trusted platform module).
11 * Specifications at www.trustedcomputinggroup.org
13 * It is based on the Linux kernel driver tpm.c from Leendert van
14 * Dorn, Dave Safford, Reiner Sailer, and Kyleen Hall.
16 * SPDX-License-Identifier: GPL-2.0
19 #ifndef _TPM_TIS_I2C_H
20 #define _TPM_TIS_I2C_H
22 #include <linux/compiler.h>
23 #include <linux/types.h>
26 TPM_TIMEOUT = 5, /* msecs */
29 /* Size of external transmit buffer (used in tpm_transmit)*/
30 #define TPM_BUFSIZE 4096
32 /* Index of Count field in TPM response buffer */
33 #define TPM_RSP_SIZE_BYTE 2
34 #define TPM_RSP_RC_BYTE 6
38 struct tpm_vendor_specific {
39 const u8 req_complete_mask;
40 const u8 req_complete_val;
41 const u8 req_canceled;
43 int (*recv) (struct tpm_chip *, u8 *, size_t);
44 int (*send) (struct tpm_chip *, u8 *, size_t);
45 void (*cancel) (struct tpm_chip *);
46 u8(*status) (struct tpm_chip *);
48 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* msec */
49 unsigned long duration[3]; /* msec */
54 struct tpm_vendor_specific vendor;
57 struct tpm_input_header {
63 struct tpm_output_header {
83 struct timeout_t timeout;
84 struct duration_t duration;
87 struct tpm_getcap_params_in {
93 struct tpm_getcap_params_out {
98 union tpm_cmd_header {
99 struct tpm_input_header in;
100 struct tpm_output_header out;
103 union tpm_cmd_params {
104 struct tpm_getcap_params_out getcap_out;
105 struct tpm_getcap_params_in getcap_in;
109 union tpm_cmd_header header;
110 union tpm_cmd_params params;
113 struct tpm_chip *tpm_register_hardware(const struct tpm_vendor_specific *);
116 int tpm_vendor_init(struct udevice *dev);
118 void tpm_vendor_cleanup(struct tpm_chip *chip);