OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 |
| 6 #include <config.h> |
| 7 #include <common.h> |
| 8 #include <i2c.h> |
| 9 #include "tddl.h" |
| 10 |
| 11 #define TPM_V05_DEFAULT_ADDR (0x20) |
| 12 |
| 13 #ifdef CONFIG_TPM_SLB9635_I2C_ADDR |
| 14 #define TPM_V05_ADDR CONFIG_TPM_SLB9635_I2C_ADDR |
| 15 #else |
| 16 #define TPM_V05_ADDR TPM_V05_DEFAULT_ADDR |
| 17 #endif |
| 18 |
| 19 int tpm_init_v05(void) |
| 20 { |
| 21 return i2c_probe(TPM_V05_ADDR ); |
| 22 } |
| 23 |
| 24 int tpm_open_v05(void) |
| 25 { |
| 26 if (TDDL_Open(TPM_V05_ADDR )) |
| 27 return -1; |
| 28 return 0; |
| 29 } |
| 30 |
| 31 int tpm_close_v05(void) |
| 32 { |
| 33 if (TDDL_Close()) |
| 34 return -1; |
| 35 return 0; |
| 36 } |
| 37 |
| 38 int tpm_sendrecv_v05(const uint8_t *sendbuf, size_t buf_size, |
| 39 uint8_t *recvbuf, size_t *recv_len) |
| 40 { |
| 41 if (TDDL_TransmitData((uint8_t*)sendbuf, (uint32_t)buf_size, recvbuf, |
| 42 (uint32_t*)recv_len)) |
| 43 return -1; |
| 44 return 0; |
| 45 } |
| 46 |
OLD | NEW |