146fe7771SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2bf38b871SChristophe Ricard /*
3bf38b871SChristophe Ricard  * STMicroelectronics TPM Linux driver for TPM ST33ZP24
42c2b217aSChristophe RICARD  * Copyright (C) 2009 - 2016  STMicroelectronics
5bf38b871SChristophe Ricard  */
6bf38b871SChristophe Ricard 
7bf38b871SChristophe Ricard #ifndef __LOCAL_ST33ZP24_H__
8bf38b871SChristophe Ricard #define __LOCAL_ST33ZP24_H__
9bf38b871SChristophe Ricard 
1004593028SDmitry Torokhov #define TPM_ST33_I2C		"st33zp24-i2c"
1104593028SDmitry Torokhov #define TPM_ST33_SPI		"st33zp24-spi"
1204593028SDmitry Torokhov 
13f042a315SChristophe Ricard #define TPM_WRITE_DIRECTION	0x80
148ab547a2SJarkko Sakkinen #define ST33ZP24_BUFSIZE	2048
15f042a315SChristophe Ricard 
16570a3609SChristophe Ricard struct st33zp24_dev {
17570a3609SChristophe Ricard 	struct tpm_chip *chip;
18570a3609SChristophe Ricard 	void *phy_id;
19570a3609SChristophe Ricard 	const struct st33zp24_phy_ops *ops;
2056671c89SChristophe Ricard 	int locality;
21570a3609SChristophe Ricard 	int irq;
22570a3609SChristophe Ricard 	u32 intrs;
23*3f801909SDmitry Torokhov 	struct gpio_desc *io_lpcpd;
246e599f6fSChristophe Ricard 	wait_queue_head_t read_queue;
25570a3609SChristophe Ricard };
26570a3609SChristophe Ricard 
27570a3609SChristophe Ricard 
28bf38b871SChristophe Ricard struct st33zp24_phy_ops {
29bf38b871SChristophe Ricard 	int (*send)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
30bf38b871SChristophe Ricard 	int (*recv)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
31bf38b871SChristophe Ricard };
32bf38b871SChristophe Ricard 
33bf38b871SChristophe Ricard #ifdef CONFIG_PM_SLEEP
34bf38b871SChristophe Ricard int st33zp24_pm_suspend(struct device *dev);
35bf38b871SChristophe Ricard int st33zp24_pm_resume(struct device *dev);
36bf38b871SChristophe Ricard #endif
37bf38b871SChristophe Ricard 
38bf38b871SChristophe Ricard int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
39*3f801909SDmitry Torokhov 		   struct device *dev, int irq);
40316f569dSUwe Kleine-König void st33zp24_remove(struct tpm_chip *chip);
41bf38b871SChristophe Ricard #endif /* __LOCAL_ST33ZP24_H__ */
42