xref: /OK3568_Linux_fs/kernel/drivers/char/tpm/st33zp24/st33zp24.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * STMicroelectronics TPM Linux driver for TPM ST33ZP24
4*4882a593Smuzhiyun  * Copyright (C) 2009 - 2016  STMicroelectronics
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef __LOCAL_ST33ZP24_H__
8*4882a593Smuzhiyun #define __LOCAL_ST33ZP24_H__
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #define TPM_WRITE_DIRECTION	0x80
11*4882a593Smuzhiyun #define ST33ZP24_BUFSIZE	2048
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun struct st33zp24_dev {
14*4882a593Smuzhiyun 	struct tpm_chip *chip;
15*4882a593Smuzhiyun 	void *phy_id;
16*4882a593Smuzhiyun 	const struct st33zp24_phy_ops *ops;
17*4882a593Smuzhiyun 	int locality;
18*4882a593Smuzhiyun 	int irq;
19*4882a593Smuzhiyun 	u32 intrs;
20*4882a593Smuzhiyun 	int io_lpcpd;
21*4882a593Smuzhiyun 	wait_queue_head_t read_queue;
22*4882a593Smuzhiyun };
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun struct st33zp24_phy_ops {
26*4882a593Smuzhiyun 	int (*send)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
27*4882a593Smuzhiyun 	int (*recv)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #ifdef CONFIG_PM_SLEEP
31*4882a593Smuzhiyun int st33zp24_pm_suspend(struct device *dev);
32*4882a593Smuzhiyun int st33zp24_pm_resume(struct device *dev);
33*4882a593Smuzhiyun #endif
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
36*4882a593Smuzhiyun 		   struct device *dev, int irq, int io_lpcpd);
37*4882a593Smuzhiyun int st33zp24_remove(struct tpm_chip *chip);
38*4882a593Smuzhiyun #endif /* __LOCAL_ST33ZP24_H__ */
39