#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
#include <linux/i2c.h>
#include <linux/of.h>
#include <linux/property.h>
#include "tpm.h"
#define TPM_STS …
#define TPM_BURST_COUNT …
#define TPM_DATA_FIFO_W …
#define TPM_DATA_FIFO_R …
#define TPM_VID_DID_RID …
#define TPM_I2C_RETRIES …
#define TPM_I2C_MAX_BUF_SIZE …
#define TPM_I2C_RETRY_COUNT …
#define TPM_I2C_BUS_DELAY …
#define TPM_I2C_RETRY_DELAY_SHORT …
#define TPM_I2C_RETRY_DELAY_LONG …
#define TPM_I2C_DELAY_RANGE …
#define OF_IS_TPM2 …
#define I2C_IS_TPM2 …
struct priv_data { … };
static s32 i2c_nuvoton_read_buf(struct i2c_client *client, u8 offset, u8 size,
u8 *data)
{ … }
static s32 i2c_nuvoton_write_buf(struct i2c_client *client, u8 offset, u8 size,
u8 *data)
{ … }
#define TPM_STS_VALID …
#define TPM_STS_COMMAND_READY …
#define TPM_STS_GO …
#define TPM_STS_DATA_AVAIL …
#define TPM_STS_EXPECT …
#define TPM_STS_RESPONSE_RETRY …
#define TPM_STS_ERR_VAL …
#define TPM_I2C_SHORT_TIMEOUT …
#define TPM_I2C_LONG_TIMEOUT …
static u8 i2c_nuvoton_read_status(struct tpm_chip *chip)
{ … }
static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
{ … }
static void i2c_nuvoton_ready(struct tpm_chip *chip)
{ … }
static int i2c_nuvoton_get_burstcount(struct i2c_client *client,
struct tpm_chip *chip)
{ … }
static bool i2c_nuvoton_check_status(struct tpm_chip *chip, u8 mask, u8 value)
{ … }
static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
u32 timeout, wait_queue_head_t *queue)
{ … }
static int i2c_nuvoton_wait_for_data_avail(struct tpm_chip *chip, u32 timeout,
wait_queue_head_t *queue)
{ … }
static int i2c_nuvoton_recv_data(struct i2c_client *client,
struct tpm_chip *chip, u8 *buf, size_t count)
{ … }
static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{ … }
static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
{ … }
static bool i2c_nuvoton_req_canceled(struct tpm_chip *chip, u8 status)
{ … }
static const struct tpm_class_ops tpm_i2c = …;
static irqreturn_t i2c_nuvoton_int_handler(int dummy, void *dev_id)
{ … }
static int get_vid(struct i2c_client *client, u32 *res)
{ … }
static int i2c_nuvoton_probe(struct i2c_client *client)
{ … }
static void i2c_nuvoton_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id i2c_nuvoton_id[] = …;
MODULE_DEVICE_TABLE(i2c, i2c_nuvoton_id);
#ifdef CONFIG_OF
static const struct of_device_id i2c_nuvoton_of_match[] = …;
MODULE_DEVICE_TABLE(of, i2c_nuvoton_of_match);
#endif
static SIMPLE_DEV_PM_OPS(i2c_nuvoton_pm_ops, tpm_pm_suspend, tpm_pm_resume);
static struct i2c_driver i2c_nuvoton_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;