xref: /linux/drivers/misc/issei/hw_heci.h (revision 93e4b3076b5f2d853462b9777d083c77fc0b7b23)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2023-2026 Intel Corporation */
3 #ifndef _ISSEI_HW_HECI_H_
4 #define _ISSEI_HW_HECI_H_
5 #include <linux/irqreturn.h>
6 #include <linux/spinlock.h>
7 #include <linux/types.h>
8 
9 #include "issei_dev.h"
10 
11 /*
12  * hw_heci_cfg - issei heci device configuration
13  *
14  * @dma_length: DMA area length
15  */
16 struct hw_heci_cfg {
17 	const struct issei_dma_length dma_length;
18 };
19 
20 /**
21  * struct issei_heci_hw - issei heci hw specific data
22  *
23  * @cfg: per device generation config and ops
24  * @mem_addr: io memory address
25  * @irq: device irq number
26  * @access_lock: spinlock to protect hw access
27  * @hbuf_depth: depth of hardware host/write buffer in slots
28  */
29 struct issei_heci_hw {
30 	const struct hw_heci_cfg *cfg;
31 	void __iomem *mem_addr;
32 	int irq;
33 	spinlock_t access_lock;
34 	u8 hbuf_depth;
35 };
36 
37 #define to_heci_hw(dev) ((struct issei_heci_hw *)(dev)->hw)
38 
39 const struct hw_heci_cfg *issei_heci_get_cfg(kernel_ulong_t idx);
40 const struct issei_hw_ops *issei_heci_get_ops(void);
41 
42 void issei_heci_dev_init(struct issei_device *idev,
43 			 void __iomem *mem_addr, const struct hw_heci_cfg *cfg);
44 
45 irqreturn_t issei_heci_irq_quick_handler(int irq, void *dev_id);
46 
47 #endif /* _ISSEI_HW_HECI_H_ */
48