1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2 | /* |
3 | Mantis PCI bridge driver |
4 | |
5 | Copyright (C) Manu Abraham (abraham.manu@gmail.com) |
6 | |
7 | */ |
8 | |
9 | #ifndef __MANTIS_LINK_H |
10 | #define __MANTIS_LINK_H |
11 | |
12 | #include <linux/mutex.h> |
13 | #include <linux/workqueue.h> |
14 | #include <media/dvb_ca_en50221.h> |
15 | |
16 | enum mantis_sbuf_status { |
17 | MANTIS_SBUF_DATA_AVAIL = 1, |
18 | MANTIS_SBUF_DATA_EMPTY = 2, |
19 | MANTIS_SBUF_DATA_OVFLW = 3 |
20 | }; |
21 | |
22 | struct mantis_slot { |
23 | u32 timeout; |
24 | u32 slave_cfg; |
25 | u32 bar; |
26 | }; |
27 | |
28 | /* Physical layer */ |
29 | enum mantis_slot_state { |
30 | MODULE_INSERTED = 3, |
31 | MODULE_XTRACTED = 4 |
32 | }; |
33 | |
34 | struct mantis_ca { |
35 | struct mantis_slot slot[4]; |
36 | |
37 | struct work_struct hif_evm_work; |
38 | |
39 | u32 hif_event; |
40 | wait_queue_head_t hif_opdone_wq; |
41 | wait_queue_head_t hif_brrdyw_wq; |
42 | wait_queue_head_t hif_data_wq; |
43 | wait_queue_head_t hif_write_wq; /* HIF Write op */ |
44 | |
45 | enum mantis_sbuf_status sbuf_status; |
46 | |
47 | enum mantis_slot_state slot_state; |
48 | |
49 | void *ca_priv; |
50 | |
51 | struct dvb_ca_en50221 en50221; |
52 | struct mutex ca_lock; |
53 | }; |
54 | |
55 | /* CA */ |
56 | extern void mantis_event_cam_plugin(struct mantis_ca *ca); |
57 | extern void mantis_event_cam_unplug(struct mantis_ca *ca); |
58 | extern int mantis_pcmcia_init(struct mantis_ca *ca); |
59 | extern void mantis_pcmcia_exit(struct mantis_ca *ca); |
60 | extern int mantis_evmgr_init(struct mantis_ca *ca); |
61 | extern void mantis_evmgr_exit(struct mantis_ca *ca); |
62 | |
63 | /* HIF */ |
64 | extern int mantis_hif_init(struct mantis_ca *ca); |
65 | extern void mantis_hif_exit(struct mantis_ca *ca); |
66 | extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr); |
67 | extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data); |
68 | extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr); |
69 | extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data); |
70 | |
71 | #endif /* __MANTIS_LINK_H */ |
72 | |