Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *   Copyright (c) 2011, 2012, Qualcomm Atheros Communications Inc.
0003  *   Copyright (c) 2014, I2SE GmbH
0004  *
0005  *   Permission to use, copy, modify, and/or distribute this software
0006  *   for any purpose with or without fee is hereby granted, provided
0007  *   that the above copyright notice and this permission notice appear
0008  *   in all copies.
0009  *
0010  *   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
0011  *   WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
0012  *   WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
0013  *   THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
0014  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
0015  *   LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
0016  *   NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
0017  *   CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0018  */
0019 
0020 /*   Qualcomm Atheros SPI register definition.
0021  *
0022  *   This module is designed to define the Qualcomm Atheros SPI register
0023  *   placeholders;
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 /* sync related constants */
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 /* sync events */
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     /* user configurable options */
0105     u32 clkspeed;
0106     u8 legacy_mode;
0107     u16 burst_len;
0108 };
0109 
0110 #endif /* _QCA_SPI_H */