2 * iwmc3200top - Intel Wireless MultiCom 3200 Top Driver
3 * drivers/misc/iwmc3200top/iwmc3200top.h
5 * Copyright (C) 2009 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * Author Name: Maxim Grabarnik <maxim.grabarnink@intel.com>
27 #ifndef __IWMC3200TOP_H__
28 #define __IWMC3200TOP_H__
30 #include <linux/workqueue.h>
32 #define DRV_NAME "iwmc3200top"
34 #define _FW_NAME(api) DRV_NAME "." #api ".fw"
35 #define FW_NAME(api) _FW_NAME(api)
37 #define IWMC_SDIO_BLK_SIZE 256
38 #define IWMC_DEFAULT_TR_BLK 64
39 #define IWMC_SDIO_DATA_ADDR 0x0
40 #define IWMC_SDIO_INTR_ENABLE_ADDR 0x14
41 #define IWMC_SDIO_INTR_STATUS_ADDR 0x13
42 #define IWMC_SDIO_INTR_CLEAR_ADDR 0x13
43 #define IWMC_SDIO_INTR_GET_SIZE_ADDR 0x2C
45 #define COMM_HUB_HEADER_LENGTH 16
46 #define LOGGER_HEADER_LENGTH 10
49 #define BARKER_DNLOAD_BT_POS 0
50 #define BARKER_DNLOAD_BT_MSK BIT(BARKER_DNLOAD_BT_POS)
51 #define BARKER_DNLOAD_GPS_POS 1
52 #define BARKER_DNLOAD_GPS_MSK BIT(BARKER_DNLOAD_GPS_POS)
53 #define BARKER_DNLOAD_TOP_POS 2
54 #define BARKER_DNLOAD_TOP_MSK BIT(BARKER_DNLOAD_TOP_POS)
55 #define BARKER_DNLOAD_RESERVED1_POS 3
56 #define BARKER_DNLOAD_RESERVED1_MSK BIT(BARKER_DNLOAD_RESERVED1_POS)
57 #define BARKER_DNLOAD_JUMP_POS 4
58 #define BARKER_DNLOAD_JUMP_MSK BIT(BARKER_DNLOAD_JUMP_POS)
59 #define BARKER_DNLOAD_SYNC_POS 5
60 #define BARKER_DNLOAD_SYNC_MSK BIT(BARKER_DNLOAD_SYNC_POS)
61 #define BARKER_DNLOAD_RESERVED2_POS 6
62 #define BARKER_DNLOAD_RESERVED2_MSK (0x3 << BARKER_DNLOAD_RESERVED2_POS)
63 #define BARKER_DNLOAD_BARKER_POS 8
64 #define BARKER_DNLOAD_BARKER_MSK (0xffffff << BARKER_DNLOAD_BARKER_POS)
66 #define IWMC_BARKER_REBOOT (0xdeadbe << BARKER_DNLOAD_BARKER_POS)
67 /* whole field barker */
68 #define IWMC_BARKER_ACK 0xfeedbabe
70 #define IWMC_CMD_SIGNATURE 0xcbbc
72 #define CMD_HDR_OPCODE_POS 0
73 #define CMD_HDR_OPCODE_MSK_MSK (0xf << CMD_HDR_OPCODE_MSK_POS)
74 #define CMD_HDR_RESPONSE_CODE_POS 4
75 #define CMD_HDR_RESPONSE_CODE_MSK (0xf << CMD_HDR_RESPONSE_CODE_POS)
76 #define CMD_HDR_USE_CHECKSUM_POS 8
77 #define CMD_HDR_USE_CHECKSUM_MSK BIT(CMD_HDR_USE_CHECKSUM_POS)
78 #define CMD_HDR_RESPONSE_REQUIRED_POS 9
79 #define CMD_HDR_RESPONSE_REQUIRED_MSK BIT(CMD_HDR_RESPONSE_REQUIRED_POS)
80 #define CMD_HDR_DIRECT_ACCESS_POS 10
81 #define CMD_HDR_DIRECT_ACCESS_MSK BIT(CMD_HDR_DIRECT_ACCESS_POS)
82 #define CMD_HDR_RESERVED_POS 11
83 #define CMD_HDR_RESERVED_MSK BIT(0x1f << CMD_HDR_RESERVED_POS)
84 #define CMD_HDR_SIGNATURE_POS 16
85 #define CMD_HDR_SIGNATURE_MSK BIT(0xffff << CMD_HDR_SIGNATURE_POS)
90 IWMC_OPCODE_WRITE
= 2,
92 IWMC_OPCODE_REBOOT
= 4,
93 IWMC_OPCODE_PERSISTENT_WRITE
= 5,
94 IWMC_OPCODE_PERSISTENT_READ
= 6,
95 IWMC_OPCODE_READ_MODIFY_WRITE
= 7,
96 IWMC_OPCODE_LAST_COMMAND
= 15
99 struct iwmct_fw_load_hdr
{
108 * struct iwmct_fw_hdr
109 * holds all sw components versions
111 struct iwmct_fw_hdr
{
125 * struct iwmct_fw_sec_hdr
126 * @type: function type
127 * @data_size: section's data size
128 * @target_addr: download address
130 struct iwmct_fw_sec_hdr
{
137 * struct iwmct_parser
139 * @file_size: fw size
140 * @cur_pos: position in file
141 * @buf: temp buf for download
142 * @buf_size: size of buf
143 * @entry_point: address to jump in fw kick-off
145 struct iwmct_parser
{
152 struct iwmct_fw_hdr versions
;
156 struct iwmct_work_struct
{
157 struct list_head list
;
169 int download_trans_blks
;
174 struct iwmct_debugfs
;
177 struct sdio_func
*func
;
178 struct iwmct_debugfs
*dbgfs
;
179 struct iwmct_parser parser
;
184 struct iwmct_dbg dbg
;
186 /* drivers work queue */
187 struct workqueue_struct
*wq
;
188 struct workqueue_struct
*bus_rescan_wq
;
189 struct work_struct bus_rescan_worker
;
190 struct work_struct isr_worker
;
192 /* drivers wait queue */
193 wait_queue_head_t wait_q
;
195 /* rx request list */
196 struct list_head read_req_list
;
199 extern int iwmct_tx(struct iwmct_priv
*priv
, void *src
, int count
);
200 extern int iwmct_fw_load(struct iwmct_priv
*priv
);
202 extern void iwmct_dbg_init_params(struct iwmct_priv
*drv
);
203 extern void iwmct_dbg_init_drv_attrs(struct device_driver
*drv
);
204 extern void iwmct_dbg_remove_drv_attrs(struct device_driver
*drv
);
205 extern int iwmct_send_hcmd(struct iwmct_priv
*priv
, u8
*cmd
, u16 len
);
207 #endif /* __IWMC3200TOP_H__ */