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 *****************************************************************************/
15 #define DRVNAME "ifx6x60"
16 #define TTYNAME "ttyIFX"
18 #define IFX_SPI_MAX_MINORS 1
19 #define IFX_SPI_TRANSFER_SIZE 2048
20 #define IFX_SPI_FIFO_SIZE 4096
22 #define IFX_SPI_HEADER_OVERHEAD 4
23 #define IFX_RESET_TIMEOUT msecs_to_jiffies(50)
25 /* device flags bitfield definitions */
26 #define IFX_SPI_STATE_PRESENT 0
27 #define IFX_SPI_STATE_IO_IN_PROGRESS 1
28 #define IFX_SPI_STATE_IO_READY 2
29 #define IFX_SPI_STATE_TIMER_PENDING 3
30 #define IFX_SPI_STATE_IO_AVAILABLE 4
32 /* flow control bitfields */
39 #define IFX_SPI_TX_FC 6
40 #define IFX_SPI_RX_FC 7
41 #define IFX_SPI_UPDATE 8
43 #define IFX_SPI_PAYLOAD_SIZE (IFX_SPI_TRANSFER_SIZE - \
44 IFX_SPI_HEADER_OVERHEAD)
46 #define IFX_SPI_IRQ_TYPE DETECT_EDGE_RISING
47 #define IFX_SPI_GPIO_TARGET 0
48 #define IFX_SPI_GPIO0 0x105
50 #define IFX_SPI_STATUS_TIMEOUT (2000*HZ)
52 /* values for bits in power status byte */
53 #define IFX_SPI_POWER_DATA_PENDING 1
54 #define IFX_SPI_POWER_SRDY 2
56 struct ifx_spi_device
{
58 struct spi_device
*spi_dev
;
60 /* Port specific data */
63 unsigned long signal_state
;
66 struct tty_port tty_port
;
67 struct device
*tty_dev
;
70 /* Low level I/O work */
71 struct tasklet_struct io_work_tasklet
;
76 int modem
; /* Modem type */
77 int use_dma
; /* provide dma-able addrs in SPI msg */
78 long max_hz
; /* max SPI frequency */
80 spinlock_t write_lock
;
82 spinlock_t power_lock
;
83 unsigned char power_status
;
85 unsigned char *rx_buffer
;
86 unsigned char *tx_buffer
;
89 unsigned char spi_more
;
90 unsigned char spi_slave_cts
;
92 struct timer_list spi_timer
;
94 struct spi_message spi_msg
;
95 struct spi_transfer spi_xfer
;
99 struct gpio_desc
*srdy
; /* slave-ready gpio */
100 struct gpio_desc
*mrdy
; /* master-ready gpio */
101 struct gpio_desc
*reset
; /* modem-reset gpio */
102 struct gpio_desc
*po
; /* modem-on gpio */
103 struct gpio_desc
*reset_out
; /* modem-in-reset gpio */
104 struct gpio_desc
*pmu_reset
; /* PMU reset gpio */
106 int unack_srdy_int_nb
;
110 unsigned long mdm_reset_state
;
112 #define MR_INPROGRESS 1
113 #define MR_COMPLETE 2
114 wait_queue_head_t mdm_reset_wait
;
115 void (*swap_buf
)(unsigned char *buf
, int len
, void *end
);
118 #endif /* _IFX6X60_H */