0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef _QCA_SPI_H
0027 #define _QCA_SPI_H
0028
0029 #include <linux/netdevice.h>
0030 #include <linux/sched.h>
0031 #include <linux/skbuff.h>
0032 #include <linux/spi/spi.h>
0033 #include <linux/types.h>
0034
0035 #include "qca_7k_common.h"
0036
0037 #define QCASPI_DRV_VERSION "0.2.7-i"
0038 #define QCASPI_DRV_NAME "qcaspi"
0039
0040 #define QCASPI_GOOD_SIGNATURE 0xAA55
0041
0042 #define TX_RING_MAX_LEN 10
0043 #define TX_RING_MIN_LEN 2
0044
0045
0046 #define QCASPI_SYNC_UNKNOWN 0
0047 #define QCASPI_SYNC_RESET 1
0048 #define QCASPI_SYNC_READY 2
0049
0050 #define QCASPI_RESET_TIMEOUT 10
0051
0052
0053 #define QCASPI_EVENT_UPDATE 0
0054 #define QCASPI_EVENT_CPUON 1
0055
0056 struct tx_ring {
0057 struct sk_buff *skb[TX_RING_MAX_LEN];
0058 u16 head;
0059 u16 tail;
0060 u16 size;
0061 u16 count;
0062 };
0063
0064 struct qcaspi_stats {
0065 u64 trig_reset;
0066 u64 device_reset;
0067 u64 reset_timeout;
0068 u64 read_err;
0069 u64 write_err;
0070 u64 read_buf_err;
0071 u64 write_buf_err;
0072 u64 out_of_mem;
0073 u64 write_buf_miss;
0074 u64 ring_full;
0075 u64 spi_err;
0076 u64 write_verify_failed;
0077 u64 buf_avail_err;
0078 u64 bad_signature;
0079 };
0080
0081 struct qcaspi {
0082 struct net_device *net_dev;
0083 struct spi_device *spi_dev;
0084 struct task_struct *spi_thread;
0085
0086 struct tx_ring txr;
0087 struct qcaspi_stats stats;
0088
0089 u8 *rx_buffer;
0090 u32 buffer_size;
0091 u8 sync;
0092
0093 struct qcafrm_handle frm_handle;
0094 struct sk_buff *rx_skb;
0095
0096 unsigned int intr_req;
0097 unsigned int intr_svc;
0098 u16 reset_count;
0099
0100 #ifdef CONFIG_DEBUG_FS
0101 struct dentry *device_root;
0102 #endif
0103
0104
0105 u32 clkspeed;
0106 u8 legacy_mode;
0107 u16 burst_len;
0108 };
0109
0110 #endif