#include <linux/init.h>
#include <linux/pnp.h>
#include "tpm.h"
#define TPM_MAX_WTX_PACKAGES …
#define TPM_WTX_MSLEEP_TIME …
#define TPM_MSLEEP_TIME …
#define TPM_MAX_TRIES …
#define TPM_INFINEON_DEV_VEN_VALUE …
#define TPM_INF_IO_PORT …
#define TPM_INF_IO_MEM …
#define TPM_INF_ADDR …
#define TPM_INF_DATA …
struct tpm_inf_dev { … };
static struct tpm_inf_dev tpm_dev;
static inline void tpm_data_out(unsigned char data, unsigned char offset)
{ … }
static inline unsigned char tpm_data_in(unsigned char offset)
{ … }
static inline void tpm_config_out(unsigned char data, unsigned char offset)
{ … }
static inline unsigned char tpm_config_in(unsigned char offset)
{ … }
enum infineon_tpm_header { … };
enum infineon_tpm_register { … };
enum infineon_tpm_command_bits { … };
enum infineon_tpm_status_bits { … };
enum infineon_tpm_values { … };
static int number_of_wtx;
static int empty_fifo(struct tpm_chip *chip, int clear_wrfifo)
{ … }
static int wait(struct tpm_chip *chip, int wait_for_bit)
{
int status;
int i;
for (i = 0; i < TPM_MAX_TRIES; i++) {
status = tpm_data_in(STAT);
if (status & 1 << wait_for_bit)
break;
tpm_msleep(TPM_MSLEEP_TIME);
}
if (i == TPM_MAX_TRIES) {
if (wait_for_bit == STAT_XFE)
dev_err(&chip->dev, "Timeout in wait(STAT_XFE)\n");
if (wait_for_bit == STAT_RDA)
dev_err(&chip->dev, "Timeout in wait(STAT_RDA)\n");
return -EIO;
}
return 0;
};
static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
{ … }
static void tpm_wtx(struct tpm_chip *chip)
{ … }
static void tpm_wtx_abort(struct tpm_chip *chip)
{ … }
static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
{ … }
static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count)
{ … }
static void tpm_inf_cancel(struct tpm_chip *chip)
{ … }
static u8 tpm_inf_status(struct tpm_chip *chip)
{ … }
static const struct tpm_class_ops tpm_inf = …;
static const struct pnp_device_id tpm_inf_pnp_tbl[] = …;
MODULE_DEVICE_TABLE(pnp, tpm_inf_pnp_tbl);
static int tpm_inf_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *dev_id)
{ … }
static void tpm_inf_pnp_remove(struct pnp_dev *dev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int tpm_inf_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(tpm_inf_pm, tpm_pm_suspend, tpm_inf_resume);
static struct pnp_driver tpm_inf_pnp_driver = …;
module_pnp_driver(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_VERSION(…) …;
MODULE_LICENSE(…) …;