1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #ifndef _QCA_SPI_H
27 #define _QCA_SPI_H
28
29 #include <linux/netdevice.h>
30 #include <linux/sched.h>
31 #include <linux/skbuff.h>
32 #include <linux/spi/spi.h>
33 #include <linux/types.h>
34
35 #include "qca_7k_common.h"
36
37 #define QCASPI_DRV_VERSION "0.2.7-i"
38 #define QCASPI_DRV_NAME "qcaspi"
39
40 #define QCASPI_GOOD_SIGNATURE 0xAA55
41
42 #define TX_RING_MAX_LEN 10
43 #define TX_RING_MIN_LEN 2
44
45
46 #define QCASPI_SYNC_UNKNOWN 0
47 #define QCASPI_SYNC_RESET 1
48 #define QCASPI_SYNC_READY 2
49
50 #define QCASPI_RESET_TIMEOUT 10
51
52
53 #define QCASPI_EVENT_UPDATE 0
54 #define QCASPI_EVENT_CPUON 1
55
56 struct tx_ring {
57 struct sk_buff *skb[TX_RING_MAX_LEN];
58 u16 head;
59 u16 tail;
60 u16 size;
61 u16 count;
62 };
63
64 struct qcaspi_stats {
65 u64 trig_reset;
66 u64 device_reset;
67 u64 reset_timeout;
68 u64 read_err;
69 u64 write_err;
70 u64 read_buf_err;
71 u64 write_buf_err;
72 u64 out_of_mem;
73 u64 write_buf_miss;
74 u64 ring_full;
75 u64 spi_err;
76 u64 write_verify_failed;
77 u64 buf_avail_err;
78 };
79
80 struct qcaspi {
81 struct net_device *net_dev;
82 struct spi_device *spi_dev;
83 struct task_struct *spi_thread;
84
85 struct tx_ring txr;
86 struct qcaspi_stats stats;
87
88 u8 *rx_buffer;
89 u32 buffer_size;
90 u8 sync;
91
92 struct qcafrm_handle frm_handle;
93 struct sk_buff *rx_skb;
94
95 unsigned int intr_req;
96 unsigned int intr_svc;
97 u16 reset_count;
98
99 #ifdef CONFIG_DEBUG_FS
100 struct dentry *device_root;
101 #endif
102
103
104 u32 clkspeed;
105 u8 legacy_mode;
106 u16 burst_len;
107 };
108
109 #endif