Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ifx6x60.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Driver for the IFX spi modem.
4  *
5  * Copyright (C) 2009, 2010 Intel Corp
6  * Jim Stanley <[email protected]>
7  *
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA
22  *
23  *
24  *
25  *****************************************************************************/
26 #ifndef _IFX6X60_H
27 #define _IFX6X60_H
28 
29 #define DRVNAME "ifx6x60"
30 #define TTYNAME "ttyIFX"
31 
32 #define IFX_SPI_MAX_MINORS 1
33 #define IFX_SPI_TRANSFER_SIZE 2048
34 #define IFX_SPI_FIFO_SIZE 4096
35 
36 #define IFX_SPI_HEADER_OVERHEAD 4
37 #define IFX_RESET_TIMEOUT msecs_to_jiffies(50)
38 
39 /* device flags bitfield definitions */
40 #define IFX_SPI_STATE_PRESENT 0
41 #define IFX_SPI_STATE_IO_IN_PROGRESS 1
42 #define IFX_SPI_STATE_IO_READY 2
43 #define IFX_SPI_STATE_TIMER_PENDING 3
44 
45 /* flow control bitfields */
46 #define IFX_SPI_DCD 0
47 #define IFX_SPI_CTS 1
48 #define IFX_SPI_DSR 2
49 #define IFX_SPI_RI 3
50 #define IFX_SPI_DTR 4
51 #define IFX_SPI_RTS 5
52 #define IFX_SPI_TX_FC 6
53 #define IFX_SPI_RX_FC 7
54 #define IFX_SPI_UPDATE 8
55 
56 #define IFX_SPI_PAYLOAD_SIZE (IFX_SPI_TRANSFER_SIZE - \
57  IFX_SPI_HEADER_OVERHEAD)
58 
59 #define IFX_SPI_IRQ_TYPE DETECT_EDGE_RISING
60 #define IFX_SPI_GPIO_TARGET 0
61 #define IFX_SPI_GPIO0 0x105
62 
63 #define IFX_SPI_STATUS_TIMEOUT (2000*HZ)
64 
65 /* values for bits in power status byte */
66 #define IFX_SPI_POWER_DATA_PENDING 1
67 #define IFX_SPI_POWER_SRDY 2
68 
70  /* Our SPI device */
72 
73  /* Port specific data */
74  struct kfifo tx_fifo;
76  unsigned long signal_state;
77 
78  /* TTY Layer logic */
80  struct device *tty_dev;
81  int minor;
82 
83  /* Low level I/O work */
85  unsigned long flags;
88 
89  int modem; /* Modem type */
90  int use_dma; /* provide dma-able addrs in SPI msg */
91  long max_hz; /* max SPI frequency */
92 
96  unsigned char power_status;
97 
98  unsigned char *rx_buffer;
99  unsigned char *tx_buffer;
102  unsigned char spi_more;
103  unsigned char spi_slave_cts;
104 
106 
109 
110  struct {
111  /* gpio lines */
112  unsigned short srdy; /* slave-ready gpio */
113  unsigned short mrdy; /* master-ready gpio */
114  unsigned short reset; /* modem-reset gpio */
115  unsigned short po; /* modem-on gpio */
116  unsigned short reset_out; /* modem-in-reset gpio */
117  /* state/stats */
119  } gpio;
120 
121  /* modem reset */
122  unsigned long mdm_reset_state;
123 #define MR_START 0
124 #define MR_INPROGRESS 1
125 #define MR_COMPLETE 2
127 };
128 
129 #endif /* _IFX6X60_H */