1 // SPDX-License-Identifier: GPL-2.0
2 /****************************************************************************
4 * Driver for the IFX spi modem.
6 * Copyright (C) 2009, 2010 Intel Corp
7 * Jim Stanley <jim.stanley@intel.com>
9 *****************************************************************************/
13 #define DRVNAME "ifx6x60"
14 #define TTYNAME "ttyIFX"
16 #define IFX_SPI_MAX_MINORS 1
17 #define IFX_SPI_TRANSFER_SIZE 2048
18 #define IFX_SPI_FIFO_SIZE 4096
20 #define IFX_SPI_HEADER_OVERHEAD 4
21 #define IFX_RESET_TIMEOUT msecs_to_jiffies(50)
23 /* device flags bitfield definitions */
24 #define IFX_SPI_STATE_PRESENT 0
25 #define IFX_SPI_STATE_IO_IN_PROGRESS 1
26 #define IFX_SPI_STATE_IO_READY 2
27 #define IFX_SPI_STATE_TIMER_PENDING 3
28 #define IFX_SPI_STATE_IO_AVAILABLE 4
30 /* flow control bitfields */
37 #define IFX_SPI_TX_FC 6
38 #define IFX_SPI_RX_FC 7
39 #define IFX_SPI_UPDATE 8
41 #define IFX_SPI_PAYLOAD_SIZE (IFX_SPI_TRANSFER_SIZE - \
42 IFX_SPI_HEADER_OVERHEAD)
44 #define IFX_SPI_IRQ_TYPE DETECT_EDGE_RISING
45 #define IFX_SPI_GPIO_TARGET 0
46 #define IFX_SPI_GPIO0 0x105
48 #define IFX_SPI_STATUS_TIMEOUT (2000*HZ)
50 /* values for bits in power status byte */
51 #define IFX_SPI_POWER_DATA_PENDING 1
52 #define IFX_SPI_POWER_SRDY 2
54 struct ifx_spi_device
{
56 struct spi_device
*spi_dev
;
58 /* Port specific data */
61 unsigned long signal_state
;
64 struct tty_port tty_port
;
65 struct device
*tty_dev
;
68 /* Low level I/O work */
69 struct tasklet_struct io_work_tasklet
;
74 int modem
; /* Modem type */
75 int use_dma
; /* provide dma-able addrs in SPI msg */
76 long max_hz
; /* max SPI frequency */
78 spinlock_t write_lock
;
80 spinlock_t power_lock
;
81 unsigned char power_status
;
83 unsigned char *rx_buffer
;
84 unsigned char *tx_buffer
;
87 unsigned char spi_more
;
88 unsigned char spi_slave_cts
;
90 struct timer_list spi_timer
;
92 struct spi_message spi_msg
;
93 struct spi_transfer spi_xfer
;
97 unsigned short srdy
; /* slave-ready gpio */
98 unsigned short mrdy
; /* master-ready gpio */
99 unsigned short reset
; /* modem-reset gpio */
100 unsigned short po
; /* modem-on gpio */
101 unsigned short reset_out
; /* modem-in-reset gpio */
103 int unack_srdy_int_nb
;
107 unsigned long mdm_reset_state
;
109 #define MR_INPROGRESS 1
110 #define MR_COMPLETE 2
111 wait_queue_head_t mdm_reset_wait
;
112 void (*swap_buf
)(unsigned char *buf
, int len
, void *end
);
115 #endif /* _IFX6X60_H */