2 * drivers/mmc/card/modem_sdio.h
4 * VIA CBP SDIO driver for Linux
6 * Copyright (C) 2009 VIA TELECOM Corporation, Inc.
7 * Author: VIA TELECOM Corporation, Inc.
9 * This package 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.
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 #define SDIO_TTY_NR 6 /* Number of UARTs this driver can handle */
23 /*SDIO buffer in lens*/
24 #define SDIO_PPP_BUF_IN_MAX_NUM 100
25 #define SDIO_ETS_BUF_IN_MAX_NUM 500
26 #define SDIO_IFS_BUF_IN_MAX_NUM 100
27 #define SDIO_AT_BUF_IN_MAX_NUM 100
28 #define SDIO_PCV_BUF_IN_MAX_NUM 100
29 #define SDIO_DEF_BUF_IN_MAX_NUM 100
30 #define SDIO_BUF_IN_MAX_SIZE 64512 /*max buffer in size = 63K*/
32 #define MODEM_FC_PRINT_MAX 3
36 unsigned char start_flag
; /*start flag(1), little endian*/
37 unsigned char chanInfo
; /*channel id*/
38 unsigned char tranHi
; /*len High byte, little endian*/
39 unsigned char tranLow
; /*len low byte, little endian*/
44 struct sdio_msg_head head
;
45 unsigned char buffer
[4096];
49 SFLOW_CTRL_DISABLE
= 0,
53 struct sdio_modem_port
;
54 struct sdio_modem_port
{
55 struct sdio_modem
*modem
;
56 struct sdio_func
*func
;
59 spinlock_t write_lock
;
60 struct tty_struct
*tty
;
63 struct kfifo transmit_fifo
;
66 struct workqueue_struct
*write_q
;
67 struct work_struct write_work
;
70 struct mutex sdio_buf_in_mutex
;
71 struct list_head sdio_buf_in_list
;
72 unsigned char sdio_buf_in
;
73 unsigned int sdio_buf_in_num
; /*buffer in list num*/
74 unsigned int sdio_buf_in_max_num
; /*buffer in list max num*/
75 unsigned int sdio_buf_in_size
; /*buffer in size*/
77 wait_queue_head_t sflow_ctrl_wait_q
;
78 atomic_t sflow_ctrl_state
;
79 struct semaphore write_sem
;
81 /* Settings for the port */
82 int rts_state
; /* Handshaking pins (outputs) */
84 int cts_state
; /* Handshaking pins (inputs) */
86 spinlock_t inception_lock
;
90 struct sdio_buf_in_packet
{
91 struct list_head node
;
93 unsigned char *buffer
;
97 struct sdio_msg_head head
;
100 unsigned char chan_num
;
101 unsigned char option
;
104 struct sdio_modem_ctrl_port
{
105 struct ctrl_port_msg chan_ctrl_msg
;
106 unsigned int chan_state
;
108 wait_queue_head_t sflow_ctrl_wait_q
;
109 atomic_t sflow_ctrl_state
;
113 struct sdio_modem_port
*port
[SDIO_TTY_NR
];
114 struct sdio_modem_ctrl_port
*ctrl_port
;
115 struct sdio_func
*func
;
116 struct sdio_msg
*msg
;
117 unsigned char *trans_buffer
;
118 struct cbp_platform_data
*cbp_data
;
119 struct semaphore sem
;
120 unsigned int data_length
;
123 extern int sdio_log_level
;
128 #define LOG_NOTICE2 3
131 #define LOGPRT(lvl,x...) do{ \
132 if(lvl < (sdio_log_level + 1)) \
133 printk("[SDIO MODEM] " x); \
136 extern int modem_sdio_init(struct cbp_platform_data
*pdata
);
137 extern void modem_sdio_exit(void);
138 extern int modem_err_indication_usr(int revocery
);
139 extern int modem_ipoh_indication_usr(void);