xref: /linux/drivers/media/pci/mantis/mantis_link.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
225aee3deSMauro Carvalho Chehab /*
325aee3deSMauro Carvalho Chehab 	Mantis PCI bridge driver
425aee3deSMauro Carvalho Chehab 
525aee3deSMauro Carvalho Chehab 	Copyright (C) Manu Abraham (abraham.manu@gmail.com)
625aee3deSMauro Carvalho Chehab 
725aee3deSMauro Carvalho Chehab */
825aee3deSMauro Carvalho Chehab 
925aee3deSMauro Carvalho Chehab #ifndef __MANTIS_LINK_H
1025aee3deSMauro Carvalho Chehab #define __MANTIS_LINK_H
1125aee3deSMauro Carvalho Chehab 
1225aee3deSMauro Carvalho Chehab #include <linux/mutex.h>
1325aee3deSMauro Carvalho Chehab #include <linux/workqueue.h>
14fada1935SMauro Carvalho Chehab #include <media/dvb_ca_en50221.h>
1525aee3deSMauro Carvalho Chehab 
1625aee3deSMauro Carvalho Chehab enum mantis_sbuf_status {
1725aee3deSMauro Carvalho Chehab 	MANTIS_SBUF_DATA_AVAIL		= 1,
1825aee3deSMauro Carvalho Chehab 	MANTIS_SBUF_DATA_EMPTY		= 2,
1925aee3deSMauro Carvalho Chehab 	MANTIS_SBUF_DATA_OVFLW		= 3
2025aee3deSMauro Carvalho Chehab };
2125aee3deSMauro Carvalho Chehab 
2225aee3deSMauro Carvalho Chehab struct mantis_slot {
2325aee3deSMauro Carvalho Chehab 	u32				timeout;
2425aee3deSMauro Carvalho Chehab 	u32				slave_cfg;
2525aee3deSMauro Carvalho Chehab 	u32				bar;
2625aee3deSMauro Carvalho Chehab };
2725aee3deSMauro Carvalho Chehab 
2825aee3deSMauro Carvalho Chehab /* Physical layer */
2925aee3deSMauro Carvalho Chehab enum mantis_slot_state {
3025aee3deSMauro Carvalho Chehab 	MODULE_INSERTED			= 3,
3125aee3deSMauro Carvalho Chehab 	MODULE_XTRACTED			= 4
3225aee3deSMauro Carvalho Chehab };
3325aee3deSMauro Carvalho Chehab 
3425aee3deSMauro Carvalho Chehab struct mantis_ca {
3525aee3deSMauro Carvalho Chehab 	struct mantis_slot		slot[4];
3625aee3deSMauro Carvalho Chehab 
3725aee3deSMauro Carvalho Chehab 	struct work_struct		hif_evm_work;
3825aee3deSMauro Carvalho Chehab 
3925aee3deSMauro Carvalho Chehab 	u32				hif_event;
4025aee3deSMauro Carvalho Chehab 	wait_queue_head_t		hif_opdone_wq;
4125aee3deSMauro Carvalho Chehab 	wait_queue_head_t		hif_brrdyw_wq;
4225aee3deSMauro Carvalho Chehab 	wait_queue_head_t		hif_data_wq;
4325aee3deSMauro Carvalho Chehab 	wait_queue_head_t		hif_write_wq; /* HIF Write op */
4425aee3deSMauro Carvalho Chehab 
4525aee3deSMauro Carvalho Chehab 	enum mantis_sbuf_status		sbuf_status;
4625aee3deSMauro Carvalho Chehab 
4725aee3deSMauro Carvalho Chehab 	enum mantis_slot_state		slot_state;
4825aee3deSMauro Carvalho Chehab 
4925aee3deSMauro Carvalho Chehab 	void				*ca_priv;
5025aee3deSMauro Carvalho Chehab 
5125aee3deSMauro Carvalho Chehab 	struct dvb_ca_en50221		en50221;
5225aee3deSMauro Carvalho Chehab 	struct mutex			ca_lock;
5325aee3deSMauro Carvalho Chehab };
5425aee3deSMauro Carvalho Chehab 
5525aee3deSMauro Carvalho Chehab /* CA */
5625aee3deSMauro Carvalho Chehab extern void mantis_event_cam_plugin(struct mantis_ca *ca);
5725aee3deSMauro Carvalho Chehab extern void mantis_event_cam_unplug(struct mantis_ca *ca);
5825aee3deSMauro Carvalho Chehab extern int mantis_pcmcia_init(struct mantis_ca *ca);
5925aee3deSMauro Carvalho Chehab extern void mantis_pcmcia_exit(struct mantis_ca *ca);
6025aee3deSMauro Carvalho Chehab extern int mantis_evmgr_init(struct mantis_ca *ca);
6125aee3deSMauro Carvalho Chehab extern void mantis_evmgr_exit(struct mantis_ca *ca);
6225aee3deSMauro Carvalho Chehab 
6325aee3deSMauro Carvalho Chehab /* HIF */
6425aee3deSMauro Carvalho Chehab extern int mantis_hif_init(struct mantis_ca *ca);
6525aee3deSMauro Carvalho Chehab extern void mantis_hif_exit(struct mantis_ca *ca);
6625aee3deSMauro Carvalho Chehab extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
6725aee3deSMauro Carvalho Chehab extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
6825aee3deSMauro Carvalho Chehab extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr);
6925aee3deSMauro Carvalho Chehab extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data);
7025aee3deSMauro Carvalho Chehab 
7125aee3deSMauro Carvalho Chehab #endif /* __MANTIS_LINK_H */
72