Path: blob/master/drivers/misc/iwmc3200top/iwmc3200top.h
15111 views
/*1* iwmc3200top - Intel Wireless MultiCom 3200 Top Driver2* drivers/misc/iwmc3200top/iwmc3200top.h3*4* Copyright (C) 2009 Intel Corporation. All rights reserved.5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License version8* 2 as published by the Free Software Foundation.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA18* 02110-1301, USA.19*20*21* Author Name: Maxim Grabarnik <[email protected]>22* -23*24*/2526#ifndef __IWMC3200TOP_H__27#define __IWMC3200TOP_H__2829#include <linux/workqueue.h>3031#define DRV_NAME "iwmc3200top"32#define FW_API_VER 133#define _FW_NAME(api) DRV_NAME "." #api ".fw"34#define FW_NAME(api) _FW_NAME(api)3536#define IWMC_SDIO_BLK_SIZE 25637#define IWMC_DEFAULT_TR_BLK 6438#define IWMC_SDIO_DATA_ADDR 0x039#define IWMC_SDIO_INTR_ENABLE_ADDR 0x1440#define IWMC_SDIO_INTR_STATUS_ADDR 0x1341#define IWMC_SDIO_INTR_CLEAR_ADDR 0x1342#define IWMC_SDIO_INTR_GET_SIZE_ADDR 0x2C4344#define COMM_HUB_HEADER_LENGTH 1645#define LOGGER_HEADER_LENGTH 10464748#define BARKER_DNLOAD_BT_POS 049#define BARKER_DNLOAD_BT_MSK BIT(BARKER_DNLOAD_BT_POS)50#define BARKER_DNLOAD_GPS_POS 151#define BARKER_DNLOAD_GPS_MSK BIT(BARKER_DNLOAD_GPS_POS)52#define BARKER_DNLOAD_TOP_POS 253#define BARKER_DNLOAD_TOP_MSK BIT(BARKER_DNLOAD_TOP_POS)54#define BARKER_DNLOAD_RESERVED1_POS 355#define BARKER_DNLOAD_RESERVED1_MSK BIT(BARKER_DNLOAD_RESERVED1_POS)56#define BARKER_DNLOAD_JUMP_POS 457#define BARKER_DNLOAD_JUMP_MSK BIT(BARKER_DNLOAD_JUMP_POS)58#define BARKER_DNLOAD_SYNC_POS 559#define BARKER_DNLOAD_SYNC_MSK BIT(BARKER_DNLOAD_SYNC_POS)60#define BARKER_DNLOAD_RESERVED2_POS 661#define BARKER_DNLOAD_RESERVED2_MSK (0x3 << BARKER_DNLOAD_RESERVED2_POS)62#define BARKER_DNLOAD_BARKER_POS 863#define BARKER_DNLOAD_BARKER_MSK (0xffffff << BARKER_DNLOAD_BARKER_POS)6465#define IWMC_BARKER_REBOOT (0xdeadbe << BARKER_DNLOAD_BARKER_POS)66/* whole field barker */67#define IWMC_BARKER_ACK 0xfeedbabe6869#define IWMC_CMD_SIGNATURE 0xcbbc7071#define CMD_HDR_OPCODE_POS 072#define CMD_HDR_OPCODE_MSK_MSK (0xf << CMD_HDR_OPCODE_MSK_POS)73#define CMD_HDR_RESPONSE_CODE_POS 474#define CMD_HDR_RESPONSE_CODE_MSK (0xf << CMD_HDR_RESPONSE_CODE_POS)75#define CMD_HDR_USE_CHECKSUM_POS 876#define CMD_HDR_USE_CHECKSUM_MSK BIT(CMD_HDR_USE_CHECKSUM_POS)77#define CMD_HDR_RESPONSE_REQUIRED_POS 978#define CMD_HDR_RESPONSE_REQUIRED_MSK BIT(CMD_HDR_RESPONSE_REQUIRED_POS)79#define CMD_HDR_DIRECT_ACCESS_POS 1080#define CMD_HDR_DIRECT_ACCESS_MSK BIT(CMD_HDR_DIRECT_ACCESS_POS)81#define CMD_HDR_RESERVED_POS 1182#define CMD_HDR_RESERVED_MSK BIT(0x1f << CMD_HDR_RESERVED_POS)83#define CMD_HDR_SIGNATURE_POS 1684#define CMD_HDR_SIGNATURE_MSK BIT(0xffff << CMD_HDR_SIGNATURE_POS)8586enum {87IWMC_OPCODE_PING = 0,88IWMC_OPCODE_READ = 1,89IWMC_OPCODE_WRITE = 2,90IWMC_OPCODE_JUMP = 3,91IWMC_OPCODE_REBOOT = 4,92IWMC_OPCODE_PERSISTENT_WRITE = 5,93IWMC_OPCODE_PERSISTENT_READ = 6,94IWMC_OPCODE_READ_MODIFY_WRITE = 7,95IWMC_OPCODE_LAST_COMMAND = 1596};9798struct iwmct_fw_load_hdr {99__le32 cmd;100__le32 target_addr;101__le32 data_size;102__le32 block_chksm;103u8 data[0];104};105106/**107* struct iwmct_fw_hdr108* holds all sw components versions109*/110struct iwmct_fw_hdr {111u8 top_major;112u8 top_minor;113u8 top_revision;114u8 gps_major;115u8 gps_minor;116u8 gps_revision;117u8 bt_major;118u8 bt_minor;119u8 bt_revision;120u8 tic_name[31];121};122123/**124* struct iwmct_fw_sec_hdr125* @type: function type126* @data_size: section's data size127* @target_addr: download address128*/129struct iwmct_fw_sec_hdr {130u8 type[4];131__le32 data_size;132__le32 target_addr;133};134135/**136* struct iwmct_parser137* @file: fw image138* @file_size: fw size139* @cur_pos: position in file140* @buf: temp buf for download141* @buf_size: size of buf142* @entry_point: address to jump in fw kick-off143*/144struct iwmct_parser {145const u8 *file;146size_t file_size;147size_t cur_pos;148u8 *buf;149size_t buf_size;150u32 entry_point;151struct iwmct_fw_hdr versions;152};153154155struct iwmct_work_struct {156struct list_head list;157ssize_t iosize;158};159160struct iwmct_dbg {161int blocks;162bool dump;163bool jump;164bool direct;165bool checksum;166bool fw_download;167int block_size;168int download_trans_blks;169170char label_fw[256];171};172173struct iwmct_debugfs;174175struct iwmct_priv {176struct sdio_func *func;177struct iwmct_debugfs *dbgfs;178struct iwmct_parser parser;179atomic_t reset;180atomic_t dev_sync;181u32 trans_len;182u32 barker;183struct iwmct_dbg dbg;184185/* drivers work items */186struct work_struct bus_rescan_worker;187struct work_struct isr_worker;188189/* drivers wait queue */190wait_queue_head_t wait_q;191192/* rx request list */193struct list_head read_req_list;194};195196extern int iwmct_tx(struct iwmct_priv *priv, void *src, int count);197extern int iwmct_fw_load(struct iwmct_priv *priv);198199extern void iwmct_dbg_init_params(struct iwmct_priv *drv);200extern void iwmct_dbg_init_drv_attrs(struct device_driver *drv);201extern void iwmct_dbg_remove_drv_attrs(struct device_driver *drv);202extern int iwmct_send_hcmd(struct iwmct_priv *priv, u8 *cmd, u16 len);203204#endif /* __IWMC3200TOP_H__ */205206207