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.
17 * See file CREDITS for list of people who contributed to this
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License as
22 * published by the Free Software Foundation, version 2 of the
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
36 #ifndef _TPM_PRIVATE_H_
37 #define _TPM_PRIVATE_H_
39 #include <linux/compiler.h>
40 #include <linux/types.h>
43 TPM_TIMEOUT = 5, /* msecs */
46 /* Size of external transmit buffer (used in tpm_transmit)*/
47 #define TPM_BUFSIZE 4096
49 /* Index of Count field in TPM response buffer */
50 #define TPM_RSP_SIZE_BYTE 2
51 #define TPM_RSP_RC_BYTE 6
55 struct tpm_vendor_specific {
56 const u8 req_complete_mask;
57 const u8 req_complete_val;
58 const u8 req_canceled;
60 int (*recv) (struct tpm_chip *, u8 *, size_t);
61 int (*send) (struct tpm_chip *, u8 *, size_t);
62 void (*cancel) (struct tpm_chip *);
63 u8(*status) (struct tpm_chip *);
65 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* msec */
66 unsigned long duration[3]; /* msec */
71 struct tpm_vendor_specific vendor;
74 struct tpm_input_header {
80 struct tpm_output_header {
100 struct timeout_t timeout;
101 struct duration_t duration;
104 struct tpm_getcap_params_in {
110 struct tpm_getcap_params_out {
115 union tpm_cmd_header {
116 struct tpm_input_header in;
117 struct tpm_output_header out;
120 union tpm_cmd_params {
121 struct tpm_getcap_params_out getcap_out;
122 struct tpm_getcap_params_in getcap_in;
126 union tpm_cmd_header header;
127 union tpm_cmd_params params;
130 struct tpm_chip *tpm_register_hardware(const struct tpm_vendor_specific *);
132 int tpm_vendor_init(uint32_t dev_addr);
135 int tpm_vendor_init_dev(struct udevice *dev);
137 void tpm_vendor_cleanup(struct tpm_chip *chip);