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 IWMC_SDIO_BLK_SIZE 256
35 #define IWMC_DEFAULT_TR_BLK 64
36 #define IWMC_SDIO_DATA_ADDR 0x0
37 #define IWMC_SDIO_INTR_ENABLE_ADDR 0x14
38 #define IWMC_SDIO_INTR_STATUS_ADDR 0x13
39 #define IWMC_SDIO_INTR_CLEAR_ADDR 0x13
40 #define IWMC_SDIO_INTR_GET_SIZE_ADDR 0x2C
42 #define COMM_HUB_HEADER_LENGTH 16
43 #define LOGGER_HEADER_LENGTH 10
46 #define BARKER_DNLOAD_BT_POS 0
47 #define BARKER_DNLOAD_BT_MSK BIT(BARKER_DNLOAD_BT_POS)
48 #define BARKER_DNLOAD_GPS_POS 1
49 #define BARKER_DNLOAD_GPS_MSK BIT(BARKER_DNLOAD_GPS_POS)
50 #define BARKER_DNLOAD_TOP_POS 2
51 #define BARKER_DNLOAD_TOP_MSK BIT(BARKER_DNLOAD_TOP_POS)
52 #define BARKER_DNLOAD_RESERVED1_POS 3
53 #define BARKER_DNLOAD_RESERVED1_MSK BIT(BARKER_DNLOAD_RESERVED1_POS)
54 #define BARKER_DNLOAD_JUMP_POS 4
55 #define BARKER_DNLOAD_JUMP_MSK BIT(BARKER_DNLOAD_JUMP_POS)
56 #define BARKER_DNLOAD_SYNC_POS 5
57 #define BARKER_DNLOAD_SYNC_MSK BIT(BARKER_DNLOAD_SYNC_POS)
58 #define BARKER_DNLOAD_RESERVED2_POS 6
59 #define BARKER_DNLOAD_RESERVED2_MSK (0x3 << BARKER_DNLOAD_RESERVED2_POS)
60 #define BARKER_DNLOAD_BARKER_POS 8
61 #define BARKER_DNLOAD_BARKER_MSK (0xffffff << BARKER_DNLOAD_BARKER_POS)
63 #define IWMC_BARKER_REBOOT (0xdeadbe << BARKER_DNLOAD_BARKER_POS)
64 /* whole field barker */
65 #define IWMC_BARKER_ACK 0xfeedbabe
67 #define IWMC_CMD_SIGNATURE 0xcbbc
69 #define CMD_HDR_OPCODE_POS 0
70 #define CMD_HDR_OPCODE_MSK_MSK (0xf << CMD_HDR_OPCODE_MSK_POS)
71 #define CMD_HDR_RESPONSE_CODE_POS 4
72 #define CMD_HDR_RESPONSE_CODE_MSK (0xf << CMD_HDR_RESPONSE_CODE_POS)
73 #define CMD_HDR_USE_CHECKSUM_POS 8
74 #define CMD_HDR_USE_CHECKSUM_MSK BIT(CMD_HDR_USE_CHECKSUM_POS)
75 #define CMD_HDR_RESPONSE_REQUIRED_POS 9
76 #define CMD_HDR_RESPONSE_REQUIRED_MSK BIT(CMD_HDR_RESPONSE_REQUIRED_POS)
77 #define CMD_HDR_DIRECT_ACCESS_POS 10
78 #define CMD_HDR_DIRECT_ACCESS_MSK BIT(CMD_HDR_DIRECT_ACCESS_POS)
79 #define CMD_HDR_RESERVED_POS 11
80 #define CMD_HDR_RESERVED_MSK BIT(0x1f << CMD_HDR_RESERVED_POS)
81 #define CMD_HDR_SIGNATURE_POS 16
82 #define CMD_HDR_SIGNATURE_MSK BIT(0xffff << CMD_HDR_SIGNATURE_POS)
87 IWMC_OPCODE_WRITE = 2,
89 IWMC_OPCODE_REBOOT = 4,
90 IWMC_OPCODE_PERSISTENT_WRITE = 5,
91 IWMC_OPCODE_PERSISTENT_READ = 6,
92 IWMC_OPCODE_READ_MODIFY_WRITE = 7,
93 IWMC_OPCODE_LAST_COMMAND = 15
96 struct iwmct_fw_load_hdr {
105 * struct iwmct_fw_hdr
106 * holds all sw components versions
108 struct iwmct_fw_hdr {
122 * struct iwmct_fw_sec_hdr
123 * @type: function type
124 * @data_size: section's data size
125 * @target_addr: download address
127 struct iwmct_fw_sec_hdr {
134 * struct iwmct_parser
136 * @file_size: fw size
137 * @cur_pos: position in file
138 * @buf: temp buf for download
139 * @buf_size: size of buf
140 * @entry_point: address to jump in fw kick-off
142 struct iwmct_parser {
149 struct iwmct_fw_hdr versions;
153 struct iwmct_work_struct {
154 struct list_head list;
166 int download_trans_blks;
171 struct iwmct_debugfs;
174 struct sdio_func *func;
175 struct iwmct_debugfs *dbgfs;
176 struct iwmct_parser parser;
181 struct iwmct_dbg dbg;
183 /* drivers work queue */
184 struct workqueue_struct *wq;
185 struct workqueue_struct *bus_rescan_wq;
186 struct work_struct bus_rescan_worker;
187 struct work_struct isr_worker;
189 /* drivers wait queue */
190 wait_queue_head_t wait_q;
192 /* rx request list */
193 struct list_head read_req_list;
196 extern int iwmct_tx(struct iwmct_priv *priv, unsigned int addr,
197 void *src, int count);
199 extern int iwmct_fw_load(struct iwmct_priv *priv);
201 extern void iwmct_dbg_init_params(struct iwmct_priv *drv);
202 extern void iwmct_dbg_init_drv_attrs(struct device_driver *drv);
203 extern void iwmct_dbg_remove_drv_attrs(struct device_driver *drv);
204 extern int iwmct_send_hcmd(struct iwmct_priv *priv, u8 *cmd, u16 len);
206 #endif /* __IWMC3200TOP_H__ */