1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include "hisax_if.h"
3 #include "hisax_isac.h"
4 #include <linux/pci.h>
5 
6 #define HSCX_BUFMAX	4096
7 
8 enum {
9 	AVM_FRITZ_PCI,
10 	AVM_FRITZ_PNP,
11 	AVM_FRITZ_PCIV2,
12 };
13 
14 struct hdlc_stat_reg {
15 #ifdef __BIG_ENDIAN
16 	u_char fill;
17 	u_char mode;
18 	u_char xml;
19 	u_char cmd;
20 #else
21 	u_char cmd;
22 	u_char xml;
23 	u_char mode;
24 	u_char fill;
25 #endif
26 } __attribute__((packed));
27 
28 struct fritz_bcs {
29 	struct hisax_b_if b_if;
30 	struct fritz_adapter *adapter;
31 	int mode;
32 	int channel;
33 
34 	union {
35 		u_int ctrl;
36 		struct hdlc_stat_reg sr;
37 	} ctrl;
38 	u_int stat;
39 	int rcvidx;
40 	int fifo_size;
41 	u_char rcvbuf[HSCX_BUFMAX]; /* B-Channel receive Buffer */
42 
43 	int tx_cnt;		    /* B-Channel transmit counter */
44 	struct sk_buff *tx_skb;     /* B-Channel transmit Buffer */
45 };
46 
47 struct fritz_adapter {
48 	int type;
49 	spinlock_t hw_lock;
50 	unsigned int io;
51 	unsigned int irq;
52 	struct isac isac;
53 
54 	struct fritz_bcs bcs[2];
55 
56 	u32  (*read_hdlc_status) (struct fritz_adapter *adapter, int nr);
57 	void (*write_ctrl) (struct fritz_bcs *bcs, int which);
58 };
59