Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2015 Infineon Technologies AG
0004  * Copyright (C) 2016 STMicroelectronics SAS
0005  */
0006 
0007 #ifndef TPM_TIS_SPI_H
0008 #define TPM_TIS_SPI_H
0009 
0010 #include "tpm_tis_core.h"
0011 
0012 struct tpm_tis_spi_phy {
0013     struct tpm_tis_data priv;
0014     struct spi_device *spi_device;
0015     int (*flow_control)(struct tpm_tis_spi_phy *phy,
0016                  struct spi_transfer *xfer);
0017     struct completion ready;
0018     unsigned long wake_after;
0019 
0020     u8 *iobuf;
0021 };
0022 
0023 static inline struct tpm_tis_spi_phy *to_tpm_tis_spi_phy(struct tpm_tis_data *data)
0024 {
0025     return container_of(data, struct tpm_tis_spi_phy, priv);
0026 }
0027 
0028 extern int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
0029                 int irq, const struct tpm_tis_phy_ops *phy_ops);
0030 
0031 extern int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
0032                 u8 *in, const u8 *out);
0033 
0034 #ifdef CONFIG_TCG_TIS_SPI_CR50
0035 extern int cr50_spi_probe(struct spi_device *spi);
0036 #else
0037 static inline int cr50_spi_probe(struct spi_device *spi)
0038 {
0039     return -ENODEV;
0040 }
0041 #endif
0042 
0043 #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_TCG_TIS_SPI_CR50)
0044 extern int tpm_tis_spi_resume(struct device *dev);
0045 #else
0046 #define tpm_tis_spi_resume  NULL
0047 #endif
0048 
0049 #endif