15c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach/******************************************************************************
25c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
35c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * This file is provided under a dual BSD/GPLv2 license.  When using or
45c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * redistributing this file, you may do so under either license.
55c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
65c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * GPL LICENSE SUMMARY
75c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
851368bf792c79eb917694a4155d62f04359e3734Emmanuel Grumbach * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
98b4139dc9f2171f313fc703c08269f6f8a6f6fc4Johannes Berg * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
105c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
115c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * This program is free software; you can redistribute it and/or modify
125c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * it under the terms of version 2 of the GNU General Public License as
135c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * published by the Free Software Foundation.
145c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
155c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * This program is distributed in the hope that it will be useful, but
165c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * WITHOUT ANY WARRANTY; without even the implied warranty of
175c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
185c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * General Public License for more details.
195c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
205c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * You should have received a copy of the GNU General Public License
215c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * along with this program; if not, write to the Free Software
225c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
235c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * USA
245c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
255c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * The full GNU General Public License is included in this distribution
26410dc5aa5906ed49e2733b451a5287884e8a16dcEmmanuel Grumbach * in the file called COPYING.
275c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
285c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * Contact Information:
295c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *  Intel Linux Wireless <ilw@linux.intel.com>
305c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
315c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
325c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * BSD LICENSE
335c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
3451368bf792c79eb917694a4155d62f04359e3734Emmanuel Grumbach * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
358b4139dc9f2171f313fc703c08269f6f8a6f6fc4Johannes Berg * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
365c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * All rights reserved.
375c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
385c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * Redistribution and use in source and binary forms, with or without
395c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * modification, are permitted provided that the following conditions
405c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * are met:
415c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
425c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *  * Redistributions of source code must retain the above copyright
435c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    notice, this list of conditions and the following disclaimer.
445c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *  * Redistributions in binary form must reproduce the above copyright
455c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    notice, this list of conditions and the following disclaimer in
465c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    the documentation and/or other materials provided with the
475c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    distribution.
485c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *  * Neither the name Intel Corporation nor the names of its
495c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    contributors may be used to endorse or promote products derived
505c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    from this software without specific prior written permission.
515c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
525c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
535c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
545c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
555c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
565c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
575c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
585c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
595c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
605c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
615c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
625c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
635c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *****************************************************************************/
645c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach
655c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach#ifndef __iwl_drv_h__
665c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach#define __iwl_drv_h__
67565f5a942b0391b528c5fc6f3c535900f4617816Johannes Berg#include <linux/export.h>
6848e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg
69825751027d18d63fa25a8236c983822aef4be220Johannes Berg/* for all modules */
70825751027d18d63fa25a8236c983822aef4be220Johannes Berg#define DRV_NAME        "iwlwifi"
71825751027d18d63fa25a8236c983822aef4be220Johannes Berg#define IWLWIFI_VERSION "in-tree:"
7251368bf792c79eb917694a4155d62f04359e3734Emmanuel Grumbach#define DRV_COPYRIGHT	"Copyright(c) 2003- 2014 Intel Corporation"
73825751027d18d63fa25a8236c983822aef4be220Johannes Berg#define DRV_AUTHOR     "<ilw@linux.intel.com>"
74825751027d18d63fa25a8236c983822aef4be220Johannes Berg
7577db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary/* radio config bits (actual values from NVM definition) */
7677db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_DASH_MSK(x)   (x & 0x3)         /* bits 0-1   */
7777db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_STEP_MSK(x)   ((x >> 2)  & 0x3) /* bits 2-3   */
7877db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_TYPE_MSK(x)   ((x >> 4)  & 0x3) /* bits 4-5   */
7977db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_PNUM_MSK(x)   ((x >> 6)  & 0x3) /* bits 6-7   */
8077db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_TX_ANT_MSK(x) ((x >> 8)  & 0xF) /* bits 8-11  */
8177db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */
8277db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary
8377db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_FLAVOR_MSK_FAMILY_8000(x)   (x & 0xF)
8477db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_DASH_MSK_FAMILY_8000(x)   ((x >> 4) & 0xF)
8577db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_STEP_MSK_FAMILY_8000(x)   ((x >> 8) & 0xF)
8677db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_TYPE_MSK_FAMILY_8000(x)   ((x >> 12) & 0xFFF)
8777db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_TX_ANT_MSK_FAMILY_8000(x) ((x >> 24) & 0xF)
8877db0a3c27dc0f027e5f3956f4ba77246c89a548Eran Harary#define NVM_RF_CFG_RX_ANT_MSK_FAMILY_8000(x) ((x >> 28) & 0xF)
89825751027d18d63fa25a8236c983822aef4be220Johannes Berg
905c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach/**
915c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * DOC: Driver system flows - drv component
925c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
935c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * This component implements the system flows such as bus enumeration, bus
945c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * removal. Bus dependent parts of system flows (such as iwl_pci_probe) are in
955c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * bus specific files (transport files). This is the code that is common among
965c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * different buses.
975c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
985c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * This component is also in charge of managing the several implementations of
995c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * the wifi flows: it will allow to have several fw API implementation. These
1005c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * different implementations will differ in the way they implement mac80211's
1015c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * handlers too.
1025c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach
1035c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * The init flow wrt to the drv component looks like this:
1045c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * 1) The bus specific component is called from module_init
1055c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * 2) The bus specific component registers the bus driver
1065c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * 3) The bus driver calls the probe function
1075c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * 4) The bus specific component configures the bus
1085c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * 5) The bus specific component calls to the drv bus agnostic part
1095c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *    (iwl_drv_start)
1101c8e11e117c28ef6b9591b489f2bbd38894ba811Emmanuel Grumbach * 6) iwl_drv_start fetches the fw ASYNC, iwl_req_fw_callback
1111c8e11e117c28ef6b9591b489f2bbd38894ba811Emmanuel Grumbach * 7) iwl_req_fw_callback parses the fw file
1121c8e11e117c28ef6b9591b489f2bbd38894ba811Emmanuel Grumbach * 8) iwl_req_fw_callback starts the wifi implementation to matches the fw
1135c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach */
1145c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach
1159130bab137844d9ad3db6ab524de299cd2b9e39dEmmanuel Grumbachstruct iwl_drv;
11687ce05a251227c0b607c6395f24ace96fc592806Emmanuel Grumbachstruct iwl_trans;
117ff8ead40e24947ce5d637a27165ad9987154a077Emmanuel Grumbachstruct iwl_cfg;
1185c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach/**
1195c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * iwl_drv_start - start the drv
1205c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
1215c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * @trans_ops: the ops of the transport
1225c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * @cfg: device specific constants / virtual functions
1235c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach *
1245c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * starts the driver: fetches the firmware. This should be called by bus
1255c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * specific system flows implementations. For example, the bus specific probe
1265c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach * function should do bus related operations only, and then call to this
1279130bab137844d9ad3db6ab524de299cd2b9e39dEmmanuel Grumbach * function. It returns the driver object or %NULL if an error occured.
1285c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach */
12987ce05a251227c0b607c6395f24ace96fc592806Emmanuel Grumbachstruct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
1309130bab137844d9ad3db6ab524de299cd2b9e39dEmmanuel Grumbach			      const struct iwl_cfg *cfg);
1315c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach
13207590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach/**
13307590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach * iwl_drv_stop - stop the drv
13407590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach *
13587ce05a251227c0b607c6395f24ace96fc592806Emmanuel Grumbach * @drv:
13607590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach *
13707590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach * Stop the driver. This should be called by bus specific system flows
13807590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach * implementations. For example, the bus specific remove function should first
13907590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach * call this function and then do the bus related operations only.
14007590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach */
1419130bab137844d9ad3db6ab524de299cd2b9e39dEmmanuel Grumbachvoid iwl_drv_stop(struct iwl_drv *drv);
14207590f080d5f29e33158b22f7ad6079b85d87609Emmanuel Grumbach
14348e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg/*
14448e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg * exported symbol management
14548e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg *
14648e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg * The driver can be split into multiple modules, in which case some symbols
14748e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg * must be exported for the sub-modules. However, if it's not split and
14848e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg * everything is built-in, then we can avoid that.
14948e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg */
15048e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR
15148e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg#define IWL_EXPORT_SYMBOL(sym)	EXPORT_SYMBOL_GPL(sym)
15248e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg#else
15348e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg#define IWL_EXPORT_SYMBOL(sym)
15448e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg#endif
15548e29340d54104ab0d8f995f32485e28ff00e59eJohannes Berg
1565c58edc63edd6cd8097e2bee90e2d341e33bcd60Emmanuel Grumbach#endif /* __iwl_drv_h__ */
157