#include <linux/completion.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm.h>
#include <linux/spi/spi.h>
#include <linux/wait.h>
#include "tpm_tis_core.h"
#include "tpm_tis_spi.h"
#define CR50_SLEEP_DELAY_MSEC …
#define CR50_WAKE_START_DELAY_USEC …
#define CR50_NOIRQ_ACCESS_DELAY …
#define CR50_READY_IRQ_TIMEOUT …
#define CR50_FLOW_CONTROL …
#define MAX_IRQ_CONFIRMATION_ATTEMPTS …
#define TPM_CR50_FW_VER(l) …
#define TPM_CR50_MAX_FW_VER_LEN …
#define TPM_CR50_DEFAULT_RNG_QUALITY …
struct cr50_spi_phy { … };
static inline struct cr50_spi_phy *to_cr50_spi_phy(struct tpm_tis_spi_phy *phy)
{ … }
static irqreturn_t cr50_spi_irq_handler(int dummy, void *dev_id)
{ … }
static void cr50_ensure_access_delay(struct cr50_spi_phy *phy)
{ … }
static bool cr50_needs_waking(struct cr50_spi_phy *phy)
{ … }
static void cr50_wake_if_needed(struct cr50_spi_phy *cr50_phy)
{ … }
static int cr50_spi_flow_control(struct tpm_tis_spi_phy *phy,
struct spi_transfer *spi_xfer)
{ … }
static bool tpm_cr50_spi_is_firmware_power_managed(struct device *dev)
{ … }
static int tpm_tis_spi_cr50_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
u8 *in, const u8 *out)
{ … }
static int tpm_tis_spi_cr50_read_bytes(struct tpm_tis_data *data, u32 addr,
u16 len, u8 *result, enum tpm_tis_io_mode io_mode)
{ … }
static int tpm_tis_spi_cr50_write_bytes(struct tpm_tis_data *data, u32 addr,
u16 len, const u8 *value, enum tpm_tis_io_mode io_mode)
{ … }
static const struct tpm_tis_phy_ops tpm_spi_cr50_phy_ops = …;
static void cr50_print_fw_version(struct tpm_tis_data *data)
{ … }
int cr50_spi_probe(struct spi_device *spi)
{ … }
#ifdef CONFIG_PM_SLEEP
int tpm_tis_spi_resume(struct device *dev)
{ … }
#endif