drivers/tpm/spi: Refactor out some cr50-specific logic
Mainboards accessing the cr50 over an I2C bus may want to reuse some of the same firmware version and BOARD_CFG logic, therefore refactor this logic out into a bus-agnostic file, drivers/tpm/cr50.c. This file uses the new tis_vendor_read/write() functions in order to access the cr50 regardless of the bus which is physically used. In order to leave SPI devices intact, the tis_vendor_* functions are added to the SPI driver. BUG=b:202246591 TEST=boot to OS on google/dratini, see the same FW version and board_cfg console prints as before the change. Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: Ie68618cbe026a2b9221f93d0fe41d0b2054e8091 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61977 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
24
src/drivers/tpm/cr50.h
Normal file
24
src/drivers/tpm/cr50.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef __DRIVERS_TPM_CR50_H__
|
||||
#define __DRIVERS_TPM_CR50_H__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/* Structure describing the elements of Cr50 firmware version. */
|
||||
struct cr50_firmware_version {
|
||||
int epoch;
|
||||
int major;
|
||||
int minor;
|
||||
};
|
||||
|
||||
/* Indicates whether Cr50 ready pulses are guaranteed to be at least 100us. */
|
||||
bool cr50_is_long_interrupt_pulse_enabled(void);
|
||||
|
||||
/* Get the Cr50 firmware version information. */
|
||||
cb_err_t cr50_get_firmware_version(struct cr50_firmware_version *version);
|
||||
|
||||
/* Set the BOARD_CFG register depending on Cr50 Kconfigs */
|
||||
cb_err_t cr50_set_board_cfg(void);
|
||||
|
||||
#endif /* __DRIVERS_TPM_CR50_H__ */
|
Reference in New Issue
Block a user