staging: wilc1000: Merge wilc-branch-arnd into work-testing
This was done to handle two large patch sets that conflicted to be
merged together without forcing each developer to redo their work.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index ee51b42..2923122 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,16 +1,39 @@
-config WILC1000_DRIVER
- bool "WILC1000 support (WiFi only)"
- depends on CFG80211 && WEXT_CORE && INET
+config WILC1000
+ tristate
+ select WIRELESS_EXT
---help---
This module only support IEEE 802.11n WiFi.
-if WILC1000_DRIVER
+config WILC1000_SDIO
+ tristate "Atmel WILC1000 SDIO (WiFi only)"
+ depends on CFG80211 && INET && MMC
+ select WILC1000
+ ---help---
+ This module adds support for the SDIO interface of adapters using
+ WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
+ It meets SDIO card specification version 2.0. The interface supports
+ the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz.
+ The host can use this interface to read and write from any register
+ within the chip as well as configure the WILC1000 for data DMA.
+ To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
+ this if your platform is using the SDIO bus.
-config WILC1000
- tristate
+config WILC1000_SPI
+ tristate "Atmel WILC1000 SPI (WiFi only)"
+ depends on CFG80211 && INET && SPI
+ select WILC1000
+ ---help---
+ This module adds support for the SPI interface of adapters using
+ WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
+ Interface (SPI) that operates as a SPI slave. This SPI interface can
+ be used for control and for serial I/O of 802.11 data. The SPI is a
+ full-duplex slave synchronous serial interface that is available
+ immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
+ VDDIO. Select this if your platform is using the SPI bus.
choice
- prompt "Memory Allocation"
+ prompt "WILC1000 Memory Allocation"
+ depends on WILC1000
default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
@@ -29,40 +52,9 @@
when it is required.
endchoice
-choice
- prompt "Bus Type"
- default WILC1000_SDIO
-
-config WILC1000_SDIO
- bool "SDIO support"
- depends on MMC
- select WILC1000
- ---help---
- This module adds support for the SDIO interface of adapters using
- WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
- It meets SDIO card specification version 2.0. The interface supports
- the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz.
- The host can use this interface to read and write from any register
- within the chip as well as configure the WILC1000 for data DMA.
- To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
- this if your platform is using the SDIO bus.
-
-config WILC1000_SPI
- depends on SPI
- select WILC1000
- bool "SPI support"
- ---help---
- This module adds support for the SPI interface of adapters using
- WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
- Interface (SPI) that operates as a SPI slave. This SPI interface can
- be used for control and for serial I/O of 802.11 data. The SPI is a
- full-duplex slave synchronous serial interface that is available
- immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
- VDDIO. Select this if your platform is using the SPI bus.
-endchoice
config WILC1000_HW_OOB_INTR
- bool "Use out of band interrupt"
+ bool "WILC1000 out of band interrupt"
depends on WILC1000_SDIO
default n
---help---
@@ -71,5 +63,3 @@
mechanism for SDIO host controllers that don't support SDIO interrupt.
Select this option If the SDIO host controller in your platform
doesn't support SDIO time devision interrupt.
-
-endif
diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 650123d..198d536 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,15 +1,12 @@
obj-$(CONFIG_WILC1000) += wilc1000.o
-ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
-ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
+ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT
ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
- -Wno-unused-function -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
#ccflags-y += -DTCP_ACK_FILTER
ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
@@ -24,5 +21,8 @@
wilc_wlan_cfg.o wilc_debugfs.o \
wilc_wlan.o
-wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o
-wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o
+
+obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 56e0cf9..47fa82f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -287,7 +287,7 @@
return asoc_id;
}
-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
{
u16 u16index;
@@ -315,7 +315,7 @@
/* This function gets the current channel information from
* the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
{
u16 index;
@@ -344,7 +344,7 @@
* @date 1 Mar 2012
* @version 1.0
*/
-s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
{
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
@@ -466,7 +466,7 @@
* @date 1 Mar 2012
* @version 1.0
*/
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo)
+s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
{
s32 s32Error = 0;
@@ -499,7 +499,7 @@
* @date 2 Apr 2012
* @version 1.0
*/
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo)
{
s32 s32Error = 0;
@@ -551,7 +551,7 @@
* @date 2 Apr 2012
* @version 1.0
*/
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo)
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo)
{
s32 s32Error = 0;
@@ -588,7 +588,7 @@
* @date 1 Mar 2012
* @version 1.0
*/
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
+s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
{
s32 counter = 0, ret = 0;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 3253f6f..912d5c2 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -127,16 +127,16 @@
size_t ie_len;
} tstrDisconnectNotifInfo;
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
-s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
-s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
+s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
+s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
+s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
-s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
+s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
tstrConnectRespInfo **ppstrConnectRespInfo);
-s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo);
+s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length);
-void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length);
+void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length);
+void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length);
#endif
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 5bf9a55..4acd936 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4,17 +4,12 @@
#include <linux/delay.h>
#include "host_interface.h"
#include "coreconfigurator.h"
+#include "wilc_wlan.h"
#include "wilc_wlan_if.h"
#include "wilc_msgqueue.h"
#include <linux/etherdevice.h>
#include "wilc_wfi_netdevice.h"
-extern u8 connecting;
-
-extern struct timer_list hDuringIpTimer;
-
-extern u8 g_wilc_initialized;
-
#define HOST_IF_MSG_SCAN 0
#define HOST_IF_MSG_CONNECT 1
#define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2
@@ -233,8 +228,8 @@
static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
struct host_if_drv *terminated_handle;
-bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+bool wilc_optaining_ip;
+static u8 P2P_LISTEN_STATE;
static struct task_struct *hif_thread_handler;
static WILC_MsgQueueHandle hif_msg_q;
static struct semaphore hif_sema_thread;
@@ -243,7 +238,7 @@
static struct semaphore hif_sema_deinit;
static struct timer_list periodic_rssi;
-u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE];
@@ -259,10 +254,10 @@
static u32 clients_count;
static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
static u32 info_element_size;
static struct host_if_drv *join_req_drv;
#define REAL_JOIN_REQ 0
@@ -271,8 +266,6 @@
static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
-extern int linux_wlan_get_num_conn_ifcs(void);
-
static int add_handler_in_list(struct host_if_drv *handler)
{
int i;
@@ -336,7 +329,7 @@
PRINT_D(HOSTINF_DBG, "Setting channel\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -358,7 +351,7 @@
wid.val = (s8 *)&hif_drv_handler->handler;
wid.size = sizeof(u32);
- result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler);
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler);
if (!hif_drv)
up(&hif_sema_driver);
@@ -382,7 +375,7 @@
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if ((hif_op_mode->mode) == IDLE_MODE)
@@ -396,7 +389,9 @@
return result;
}
-s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx);
+
+static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx)
{
s32 result = 0;
struct wid wid;
@@ -415,7 +410,7 @@
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx);
@@ -430,7 +425,7 @@
return result;
}
-s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
{
s32 result = 0;
struct wid wid;
@@ -440,7 +435,7 @@
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -450,7 +445,7 @@
kfree(wid.val);
if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
- host_int_setup_ipaddress(hif_drv, set_ip[idx], idx);
+ wilc_setup_ipaddress(hif_drv, set_ip[idx], idx);
if (result != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -483,7 +478,7 @@
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -505,7 +500,7 @@
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -800,7 +795,7 @@
wid_cnt++;
}
- result = send_config_pkt(SET_CFG, wid_list, wid_cnt,
+ result = wilc_send_config_pkt(SET_CFG, wid_list, wid_cnt,
get_id_from_handler(hif_drv));
if (result)
@@ -813,10 +808,13 @@
static void Handle_wait_msg_q_empty(void)
{
- g_wilc_initialized = 0;
+ wilc_initialized = 0;
up(&hif_sema_wait_response);
}
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+ enum scan_event enuEvent);
+
static s32 Handle_Scan(struct host_if_drv *hif_drv,
struct scan_attr *pstrHostIFscanAttr)
{
@@ -843,7 +841,7 @@
goto ERRORHANDLER;
}
- if (g_obtainingIP || connecting) {
+ if (wilc_optaining_ip || wilc_connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
PRINT_ER("Don't do obss scan\n");
result = -EBUSY;
@@ -920,7 +918,7 @@
else if (hif_drv->hif_state == HOST_IF_IDLE)
scan_while_connected = false;
- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));
if (result)
@@ -964,7 +962,7 @@
wid.val = (s8 *)&u8abort_running_scan;
wid.size = sizeof(char);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -987,7 +985,7 @@
return result;
}
-u8 u8ConnectedSSID[6] = {0};
+u8 wilc_connected_SSID[6] = {0};
static s32 Handle_Connect(struct host_if_drv *hif_drv,
struct connect_attr *pstrHostIFconnectAttr)
{
@@ -999,7 +997,7 @@
PRINT_D(GENERIC_DBG, "Handling connect request\n");
- if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) {
+ if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_SSID, ETH_ALEN) == 0) {
result = 0;
PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
return result;
@@ -1212,13 +1210,13 @@
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
if (pstrHostIFconnectAttr->bssid) {
- memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN);
+ memcpy(wilc_connected_SSID, pstrHostIFconnectAttr->bssid, ETH_ALEN);
PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid);
- PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID);
+ PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_SSID);
}
- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("failed to send config packet\n");
@@ -1235,7 +1233,7 @@
del_timer(&hif_drv->connect_timer);
- PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n");
+ PRINT_D(HOSTINF_DBG, "could not start wilc_connecting to the required network\n");
memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
@@ -1315,7 +1313,7 @@
u32WidsCount++;
- result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(join_req_drv));
if (result) {
PRINT_ER("failed to send config packet\n");
@@ -1376,7 +1374,7 @@
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send dissconect config packet\n");
@@ -1387,7 +1385,7 @@
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc_connected_SSID);
if (join_req && join_req_drv == hif_drv) {
kfree(join_req);
@@ -1416,7 +1414,7 @@
if (hif_drv->usr_scan_req.scan_result) {
PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n");
- parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo);
+ wilc_parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo);
if ((!pstrNetworkInfo) ||
(!hif_drv->usr_scan_req.scan_result)) {
PRINT_ER("driver is null\n");
@@ -1476,13 +1474,18 @@
pstrRcvdNetworkInfo->buffer = NULL;
if (pstrNetworkInfo) {
- DeallocateNetworkInfo(pstrNetworkInfo);
+ wilc_dealloc_network_info(pstrNetworkInfo);
pstrNetworkInfo = NULL;
}
return result;
}
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+ u8 *pu8AssocRespInfo,
+ u32 u32MaxAssocRespInfoLen,
+ u32 *pu32RcvdAssocRespInfoLen);
+
static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
{
@@ -1550,10 +1553,10 @@
if (u32RcvdAssocRespInfoLen != 0) {
PRINT_D(HOSTINF_DBG, "Parsing association response\n");
- s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
+ s32Err = wilc_parse_assoc_resp_info(rcv_assoc_resp, u32RcvdAssocRespInfoLen,
&pstrConnectRespInfo);
if (s32Err) {
- PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err);
+ PRINT_ER("wilc_parse_assoc_resp_info() returned error %d\n", s32Err);
} else {
strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus;
@@ -1568,7 +1571,7 @@
}
if (pstrConnectRespInfo) {
- DeallocateAssocRespInfo(pstrConnectRespInfo);
+ wilc_dealloc_assoc_resp_info(pstrConnectRespInfo);
pstrConnectRespInfo = NULL;
}
}
@@ -1578,11 +1581,11 @@
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) {
PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc_connected_SSID);
} else if (u8MacStatus == MAC_DISCONNECTED) {
PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc_connected_SSID);
}
if (hif_drv->usr_conn_req.pu8bssid) {
@@ -1613,14 +1616,14 @@
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(hif_drv, 0, 0);
PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
hif_drv->hif_state = HOST_IF_CONNECTED;
PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n");
- g_obtainingIP = true;
- mod_timer(&hDuringIpTimer,
+ wilc_optaining_ip = true;
+ mod_timer(&wilc_during_ip_timer,
jiffies + msecs_to_jiffies(10000));
} else {
PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus);
@@ -1655,8 +1658,8 @@
strDisconnectNotifInfo.ie_len = 0;
if (hif_drv->usr_conn_req.conn_result) {
- g_obtainingIP = false;
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc_optaining_ip = false;
+ wilc_set_power_mgmt(hif_drv, 0, 0);
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
NULL,
@@ -1754,7 +1757,7 @@
strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len;
strWIDList[3].val = (s8 *)pu8keybuf;
- result = send_config_pkt(SET_CFG, strWIDList, 4,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, 4,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
}
@@ -1777,7 +1780,7 @@
wid.val = (s8 *)pu8keybuf;
wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->action & REMOVEKEY) {
@@ -1789,7 +1792,7 @@
wid.val = s8idxarray;
wid.size = 1;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
} else {
wid.id = (u16)WID_KEY_ID;
@@ -1799,7 +1802,7 @@
PRINT_D(HOSTINF_DBG, "Setting default key index\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
}
up(&hif_drv->sem_test_key_block);
@@ -1832,7 +1835,7 @@
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = RX_MIC_KEY_MSG_LEN;
- result = send_config_pkt(SET_CFG, strWIDList, 2,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, 2,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
@@ -1865,7 +1868,7 @@
wid.val = (s8 *)pu8keybuf;
wid.size = RX_MIC_KEY_MSG_LEN;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
@@ -1904,7 +1907,7 @@
strWIDList[1].val = (s8 *)pu8keybuf;
strWIDList[1].size = PTK_KEY_MSG_LEN + 1;
- result = send_config_pkt(SET_CFG, strWIDList, 2,
+ result = wilc_send_config_pkt(SET_CFG, strWIDList, 2,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1927,7 +1930,7 @@
wid.val = (s8 *)pu8keybuf;
wid.size = PTK_KEY_MSG_LEN;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
up(&hif_drv->sem_test_key_block);
@@ -1962,7 +1965,7 @@
wid.val = (s8 *)pu8keybuf;
wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(pu8keybuf);
@@ -1989,12 +1992,12 @@
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
- g_obtainingIP = false;
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc_optaining_ip = false;
+ wilc_set_power_mgmt(hif_drv, 0, 0);
- eth_zero_addr(u8ConnectedSSID);
+ eth_zero_addr(wilc_connected_SSID);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -2058,14 +2061,14 @@
up(&hif_drv->sem_test_disconn_block);
}
-void resolve_disconnect_aberration(struct host_if_drv *hif_drv)
+void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv)
{
if (!hif_drv)
return;
if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
(hif_drv->hif_state == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
- host_int_disconnect(hif_drv, 1);
+ wilc_disconnect(hif_drv, 1);
}
}
@@ -2081,7 +2084,7 @@
PRINT_D(HOSTINF_DBG, "Getting channel value\n");
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -2106,7 +2109,7 @@
PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to get RSSI value\n");
@@ -2130,7 +2133,7 @@
PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to get LINKSPEED value\n");
@@ -2140,7 +2143,7 @@
up(&hif_drv->sem_get_link_speed);
}
-s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
struct wid strWIDList[5];
u32 u32WidsCount = 0, result = 0;
@@ -2175,7 +2178,7 @@
strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt;
u32WidsCount++;
- result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount,
+ result = wilc_send_config_pkt(GET_CFG, strWIDList, u32WidsCount,
get_id_from_handler(hif_drv));
if (result)
@@ -2202,7 +2205,7 @@
PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -2215,7 +2218,7 @@
wid.val = (s8 *)&inactive_time;
wid.size = sizeof(u32);
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
@@ -2274,7 +2277,7 @@
memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len);
pu8CurrByte += pstrSetBeaconParam->tail_len;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add beacon config packet\n");
@@ -2303,7 +2306,7 @@
PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send delete beacon config packet\n");
@@ -2376,7 +2379,7 @@
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0)
PRINT_ER("Failed to send add station config packet\n");
@@ -2418,7 +2421,7 @@
pu8CurrByte += ETH_ALEN;
}
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2450,7 +2453,7 @@
memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send add station config packet\n");
@@ -2478,7 +2481,7 @@
pu8CurrByte = wid.val;
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send edit station config packet\n");
@@ -2517,7 +2520,7 @@
goto ERRORHANDLER;
}
- if (g_obtainingIP || connecting) {
+ if (wilc_optaining_ip || wilc_connecting) {
PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
result = -EBUSY;
goto ERRORHANDLER;
@@ -2539,7 +2542,7 @@
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = (s8)pstrHostIfRemainOnChan->ch;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0)
PRINT_ER("Failed to set remain on channel\n");
@@ -2587,7 +2590,7 @@
wid.size = sizeof(u16) + 2;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
PRINT_ER("Failed to frame register config packet\n");
@@ -2619,7 +2622,7 @@
wid.val[0] = u8remain_on_chan_flag;
wid.val[1] = FALSE_FRMWR_CHANNEL;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result != 0) {
PRINT_ER("Failed to set remain on channel\n");
@@ -2677,7 +2680,7 @@
PRINT_D(HOSTINF_DBG, "Handling Power Management\n");
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send power management config packet\n");
@@ -2711,10 +2714,10 @@
*pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF);
if ((strHostIfSetMulti->cnt) > 0)
- memcpy(pu8CurrByte, multicast_mac_addr_list,
+ memcpy(pu8CurrByte, wilc_multicast_mac_addr_list,
((strHostIfSetMulti->cnt) * ETH_ALEN));
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_ER("Failed to send setup multicast config packet\n");
@@ -2760,7 +2763,7 @@
*ptr++ = 8;
*ptr++ = 0;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
@@ -2779,7 +2782,7 @@
*ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF);
*ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF);
*ptr++ = 3;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
kfree(wid.val);
@@ -2814,7 +2817,7 @@
*ptr++ = 0;
*ptr++ = 32;
- result = send_config_pkt(SET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(SET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -2842,7 +2845,7 @@
break;
}
- if ((!g_wilc_initialized)) {
+ if ((!wilc_initialized)) {
PRINT_D(GENERIC_DBG, "--WAIT--");
usleep_range(200 * 1000, 200 * 1000);
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -2902,8 +2905,8 @@
del_timer(&hif_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
- if (!linux_wlan_get_num_conn_ifcs())
- chip_sleep_manually();
+ if (!wilc_wlan_get_num_conn_ifcs(wilc_dev))
+ wilc_chip_sleep_manually();
Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
@@ -3063,7 +3066,7 @@
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
}
-s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
+s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
{
struct wid wid;
@@ -3075,7 +3078,7 @@
return 0;
}
-int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
+int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3102,7 +3105,7 @@
return result;
}
-int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index)
+int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index)
{
int result = 0;
struct host_if_msg msg;
@@ -3129,7 +3132,7 @@
return result;
}
-int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
+int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
const u8 *key,
u8 len,
u8 index)
@@ -3163,12 +3166,12 @@
return result;
}
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
- const u8 *key,
- u8 len,
- u8 index,
- u8 mode,
- enum AUTHTYPE auth_type)
+int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+ const u8 *key,
+ u8 len,
+ u8 index,
+ u8 mode,
+ enum AUTHTYPE auth_type)
{
int result = 0;
struct host_if_msg msg;
@@ -3207,7 +3210,7 @@
return result;
}
-int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk,
+int wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk,
u8 ptk_key_len, const u8 *mac_addr,
const u8 *rx_mic, const u8 *tx_mic,
u8 mode, u8 cipher_mode, u8 index)
@@ -3273,7 +3276,7 @@
return result;
}
-int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk,
+int wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk,
u8 gtk_key_len, u8 index,
u32 key_rsc_len, const u8 *key_rsc,
const u8 *rx_mic, const u8 *tx_mic,
@@ -3341,7 +3344,7 @@
return result;
}
-s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
+s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3373,7 +3376,7 @@
return result;
}
-s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3394,7 +3397,7 @@
return result;
}
-s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
+s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3413,7 +3416,7 @@
return result;
}
-s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
+s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
@@ -3480,7 +3483,7 @@
return result;
}
-s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
+s32 wilc_flush_join_req(struct host_if_drv *hif_drv)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3505,7 +3508,7 @@
return result;
}
-s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
+s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3529,10 +3532,10 @@
return result;
}
-s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
- u8 *pu8AssocRespInfo,
- u32 u32MaxAssocRespInfoLen,
- u32 *pu32RcvdAssocRespInfoLen)
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+ u8 *pu8AssocRespInfo,
+ u32 u32MaxAssocRespInfoLen,
+ u32 *pu32RcvdAssocRespInfoLen)
{
s32 result = 0;
struct wid wid;
@@ -3547,7 +3550,7 @@
wid.val = pu8AssocRespInfo;
wid.size = u32MaxAssocRespInfoLen;
- result = send_config_pkt(GET_CFG, &wid, 1,
+ result = wilc_send_config_pkt(GET_CFG, &wid, 1,
get_id_from_handler(hif_drv));
if (result) {
*pu32RcvdAssocRespInfoLen = 0;
@@ -3560,7 +3563,7 @@
return result;
}
-int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
+int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
{
int result;
struct host_if_msg msg;
@@ -3584,7 +3587,7 @@
return 0;
}
-int host_int_wait_msg_queue_idle(void)
+int wilc_wait_msg_queue_idle(void)
{
int result = 0;
struct host_if_msg msg;
@@ -3602,7 +3605,7 @@
return result;
}
-int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv)
+int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv)
{
int result = 0;
struct host_if_msg msg;
@@ -3621,7 +3624,7 @@
return result;
}
-int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
+int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
{
int result = 0;
struct host_if_msg msg;
@@ -3640,32 +3643,7 @@
return result;
}
-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
- s32 result = 0;
- struct host_if_msg msg;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_GET_CHNL;
- msg.drv = hif_drv;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result)
- PRINT_ER("wilc mq send fail\n");
- down(&hif_drv->sem_get_chnl);
-
- *pu8ChNo = ch_no;
-
- return result;
-}
-
-s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
+s32 wilc_get_inactive_time(struct host_if_drv *hif_drv,
const u8 *mac, u32 *pu32InactiveTime)
{
s32 result = 0;
@@ -3693,35 +3671,7 @@
return result;
}
-s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
-{
- s32 result = 0;
- struct wid wid;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- wid.id = (u16)WID_MEMORY_ADDRESS;
- wid.type = WID_INT;
- wid.val = (s8 *)pu32TestMemAddr;
- wid.size = sizeof(u32);
-
- result = send_config_pkt(GET_CFG, &wid, 1,
- get_id_from_handler(hif_drv));
-
- if (result) {
- PRINT_ER("Failed to get wid value\n");
- return -EINVAL;
- } else {
- PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
- }
-
- return result;
-}
-
-s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
+s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3748,34 +3698,7 @@
return result;
}
-s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
-{
- struct host_if_msg msg;
- s32 result = 0;
-
- memset(&msg, 0, sizeof(struct host_if_msg));
- msg.id = HOST_IF_MSG_GET_LINKSPEED;
- msg.drv = hif_drv;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result) {
- PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
- return -EFAULT;
- }
-
- down(&hif_drv->sem_get_link_speed);
-
- if (!ps8lnkspd) {
- PRINT_ER("LINKSPEED pointer value is null");
- return -EFAULT;
- }
-
- *ps8lnkspd = link_speed;
-
- return result;
-}
-
-s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
+s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
{
s32 result = 0;
struct host_if_msg msg;
@@ -3795,7 +3718,7 @@
return result;
}
-s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
+s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
u8 u8ScanType, u8 *pu8ChnlFreqList,
u8 u8ChnlListLen, const u8 *pu8IEs,
size_t IEsLen, wilc_scan_result ScanResult,
@@ -3848,7 +3771,7 @@
return result;
}
-s32 hif_set_cfg(struct host_if_drv *hif_drv,
+s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv,
struct cfg_param_val *pstrCfgParamVal)
{
s32 result = 0;
@@ -3869,99 +3792,6 @@
return result;
}
-s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
-{
- s32 result = 0;
-
- down(&hif_drv->sem_cfg_values);
-
- if (!hif_drv) {
- PRINT_ER("hif_drv NULL\n");
- return -EFAULT;
- }
- PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
- switch (u16WID) {
- case WID_BSS_TYPE:
- *pu16WID_Value = (u16)hif_drv->cfg_values.bss_type;
- break;
-
- case WID_AUTH_TYPE:
- *pu16WID_Value = (u16)hif_drv->cfg_values.auth_type;
- break;
-
- case WID_AUTH_TIMEOUT:
- *pu16WID_Value = hif_drv->cfg_values.auth_timeout;
- break;
-
- case WID_POWER_MANAGEMENT:
- *pu16WID_Value = (u16)hif_drv->cfg_values.power_mgmt_mode;
- break;
-
- case WID_SHORT_RETRY_LIMIT:
- *pu16WID_Value = hif_drv->cfg_values.short_retry_limit;
- break;
-
- case WID_LONG_RETRY_LIMIT:
- *pu16WID_Value = hif_drv->cfg_values.long_retry_limit;
- break;
-
- case WID_FRAG_THRESHOLD:
- *pu16WID_Value = hif_drv->cfg_values.frag_threshold;
- break;
-
- case WID_RTS_THRESHOLD:
- *pu16WID_Value = hif_drv->cfg_values.rts_threshold;
- break;
-
- case WID_PREAMBLE:
- *pu16WID_Value = (u16)hif_drv->cfg_values.preamble_type;
- break;
-
- case WID_SHORT_SLOT_ALLOWED:
- *pu16WID_Value = (u16)hif_drv->cfg_values.short_slot_allowed;
- break;
-
- case WID_11N_TXOP_PROT_DISABLE:
- *pu16WID_Value = (u16)hif_drv->cfg_values.txop_prot_disabled;
- break;
-
- case WID_BEACON_INTERVAL:
- *pu16WID_Value = hif_drv->cfg_values.beacon_interval;
- break;
-
- case WID_DTIM_PERIOD:
- *pu16WID_Value = (u16)hif_drv->cfg_values.dtim_period;
- break;
-
- case WID_SITE_SURVEY:
- *pu16WID_Value = (u16)hif_drv->cfg_values.site_survey_enabled;
- break;
-
- case WID_SITE_SURVEY_SCAN_TIME:
- *pu16WID_Value = hif_drv->cfg_values.site_survey_scan_time;
- break;
-
- case WID_ACTIVE_SCAN_TIME:
- *pu16WID_Value = hif_drv->cfg_values.active_scan_time;
- break;
-
- case WID_PASSIVE_SCAN_TIME:
- *pu16WID_Value = hif_drv->cfg_values.passive_scan_time;
- break;
-
- case WID_CURRENT_TX_RATE:
- *pu16WID_Value = hif_drv->cfg_values.curr_tx_rate;
- break;
-
- default:
- break;
- }
-
- up(&hif_drv->sem_cfg_values);
-
- return result;
-}
-
static void GetPeriodicRSSI(unsigned long arg)
{
struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
@@ -3990,7 +3820,7 @@
mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000));
}
-s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
+s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
{
s32 result = 0;
struct host_if_drv *hif_drv;
@@ -4019,7 +3849,7 @@
goto _fail_timer_2;
}
- g_obtainingIP = false;
+ wilc_optaining_ip = false;
PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
if (clients_count == 0) {
@@ -4098,7 +3928,7 @@
return result;
}
-s32 host_int_deinit(struct host_if_drv *hif_drv)
+s32 wilc_deinit(struct host_if_drv *hif_drv)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4125,7 +3955,7 @@
del_timer_sync(&hif_drv->remain_on_ch_timer);
- host_int_set_wfi_drv_handler(NULL);
+ wilc_set_wfi_drv_handler(NULL);
down(&hif_sema_driver);
if (hif_drv->usr_scan_req.scan_result) {
@@ -4170,7 +4000,7 @@
return result;
}
-void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4199,7 +4029,7 @@
PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result);
}
-void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4240,7 +4070,7 @@
up(&hif_sema_deinit);
}
-void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
+void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4269,7 +4099,7 @@
return;
}
-s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
+s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
u32 u32duration, u16 chan,
wilc_remain_on_chan_expired RemainOnChanExpired,
wilc_remain_on_chan_ready RemainOnChanReady,
@@ -4301,7 +4131,7 @@
return result;
}
-s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID)
+s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4325,7 +4155,7 @@
return result;
}
-s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
+s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4364,7 +4194,7 @@
return result;
}
-s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
+s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
u32 u32TailLen, u8 *pu8Tail)
{
@@ -4418,7 +4248,7 @@
return result;
}
-int host_int_del_beacon(struct host_if_drv *hif_drv)
+int wilc_del_beacon(struct host_if_drv *hif_drv)
{
int result = 0;
struct host_if_msg msg;
@@ -4439,8 +4269,8 @@
return result;
}
-int host_int_add_station(struct host_if_drv *hif_drv,
- struct add_sta_param *sta_param)
+int wilc_add_station(struct host_if_drv *hif_drv,
+ struct add_sta_param *sta_param)
{
int result = 0;
struct host_if_msg msg;
@@ -4473,7 +4303,7 @@
return result;
}
-int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
+int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr)
{
int result = 0;
struct host_if_msg msg;
@@ -4502,7 +4332,7 @@
return result;
}
-s32 host_int_del_allstation(struct host_if_drv *hif_drv,
+s32 wilc_del_allstation(struct host_if_drv *hif_drv,
u8 pu8MacAddr[][ETH_ALEN])
{
s32 result = 0;
@@ -4553,7 +4383,7 @@
return result;
}
-s32 host_int_edit_station(struct host_if_drv *hif_drv,
+s32 wilc_edit_station(struct host_if_drv *hif_drv,
struct add_sta_param *pstrStaParams)
{
s32 result = 0;
@@ -4591,7 +4421,7 @@
return result;
}
-s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv,
+s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv,
bool bIsEnabled,
u32 u32Timeout)
{
@@ -4622,7 +4452,7 @@
return result;
}
-s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv,
+s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv,
bool bIsEnabled,
u32 u32count)
{
@@ -4808,7 +4638,7 @@
return (void *)pNewJoinBssParam;
}
-void host_int_freeJoinParams(void *pJoinParams)
+void wilc_free_join_params(void *pJoinParams)
{
if ((struct bss_param *)pJoinParams)
kfree((struct bss_param *)pJoinParams);
@@ -4816,35 +4646,7 @@
PRINT_ER("Unable to FREE null pointer\n");
}
-s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
-{
- s32 result = 0;
- struct host_if_msg msg;
- struct ba_session_info *pBASessionInfo = &msg.body.session_info;
-
- if (!hif_drv) {
- PRINT_ER("driver is null\n");
- return -EFAULT;
- }
-
- memset(&msg, 0, sizeof(struct host_if_msg));
-
- msg.id = HOST_IF_MSG_DEL_BA_SESSION;
-
- memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN);
- pBASessionInfo->tid = TID;
- msg.drv = hif_drv;
-
- result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
- if (result)
- PRINT_ER("wilc_mq_send fail\n");
-
- down(&hif_sema_wait_response);
-
- return result;
-}
-
-s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
+s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv,
char *pBSSID,
char TID)
{
@@ -4874,7 +4676,7 @@
return result;
}
-s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
s32 result = 0;
struct host_if_msg msg;
@@ -4901,7 +4703,7 @@
return result;
}
-s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
{
s32 result = 0;
struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index c01f441..efeb9e2 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -303,104 +303,104 @@
u16 flags_set;
};
-s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
-int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
-int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index);
-int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
+s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
+int wilc_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
+int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index);
+int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
const u8 *key, u8 len, u8 index);
-int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
+int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
const u8 *key, u8 len, u8 index, u8 mode,
enum AUTHTYPE auth_type);
-int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk,
- u8 ptk_key_len, const u8 *mac_addr,
- const u8 *rx_mic, const u8 *tx_mic,
- u8 mode, u8 cipher_mode, u8 index);
-s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac,
+s32 wilc_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk,
+ u8 u8PtkKeylen, const u8 *mac_addr,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode, u8 u8Idx);
+s32 wilc_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac,
u32 *pu32InactiveTime);
-int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk,
- u8 gtk_key_len, u8 index,
- u32 key_rsc_len, const u8 *key_rsc,
- const u8 *rx_mic, const u8 *tx_mic,
- u8 mode, u8 cipher_mode);
-s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv,
+s32 wilc_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk,
+ u8 u8GtkKeylen, u8 u8KeyIdx,
+ u32 u32KeyRSClen, const u8 *KeyRSC,
+ const u8 *pu8RxMic, const u8 *pu8TxMic,
+ u8 mode, u8 u8Ciphermode);
+s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen,
+ u8 *pu8TxGtk, u8 u8KeyIdx);
+s32 wilc_set_pmkid_info(struct host_if_drv *hWFIDrv,
struct host_if_pmkid_attr *pu8PmkidInfoArray);
-s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
-s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
-int host_int_wait_msg_queue_idle(void);
-s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
+s32 wilc_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
+s32 wilc_set_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
+int wilc_wait_msg_queue_idle(void);
+s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
+s32 wilc_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
const u8 *pu8ssid, size_t ssidLen,
const u8 *pu8IEs, size_t IEsLen,
wilc_connect_result pfConnectResult, void *pvUserArg,
u8 u8security, enum AUTHTYPE tenuAuth_type,
u8 u8channel, void *pJoinParams);
-s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
-s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
-s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv,
- u8 *pu8AssocRespInfo,
- u32 u32MaxAssocRespInfoLen,
- u32 *pu32RcvdAssocRespInfoLen);
-int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
-s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
-s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
-s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
-s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
+s32 wilc_flush_join_req(struct host_if_drv *hWFIDrv);
+s32 wilc_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
+int wilc_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
+s32 wilc_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
+s32 wilc_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
u8 u8ScanType, u8 *pu8ChnlFreqList,
u8 u8ChnlListLen, const u8 *pu8IEs,
size_t IEsLen, wilc_scan_result ScanResult,
void *pvUserArg, struct hidden_network *pstrHiddenNetwork);
-s32 hif_set_cfg(struct host_if_drv *hWFIDrv,
+s32 wilc_hif_set_cfg(struct host_if_drv *hWFIDrv,
struct cfg_param_val *pstrCfgParamVal);
-s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
-s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
-s32 host_int_deinit(struct host_if_drv *hWFIDrv);
-s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
+s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
+s32 wilc_deinit(struct host_if_drv *hWFIDrv);
+s32 wilc_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
u32 u32DTIMPeriod,
u32 u32HeadLen,
u8 *pu8Head,
u32 u32TailLen,
u8 *pu8tail);
-int host_int_del_beacon(struct host_if_drv *hif_drv);
-int host_int_add_station(struct host_if_drv *hif_drv,
+int wilc_del_beacon(struct host_if_drv *hif_drv);
+int wilc_add_station(struct host_if_drv *hif_drv,
struct add_sta_param *sta_param);
-s32 host_int_del_allstation(struct host_if_drv *hWFIDrv,
+s32 wilc_del_allstation(struct host_if_drv *hWFIDrv,
u8 pu8MacAddr[][ETH_ALEN]);
-int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr);
-s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
+int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr);
+s32 wilc_edit_station(struct host_if_drv *hWFIDrv,
struct add_sta_param *pstrStaParams);
-s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv,
+s32 wilc_set_power_mgmt(struct host_if_drv *hWFIDrv,
bool bIsEnabled,
u32 u32Timeout);
-s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv,
+s32 wilc_setup_multicast_filter(struct host_if_drv *hWFIDrv,
bool bIsEnabled,
u32 u32count);
-s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv,
+s32 wilc_setup_ipaddress(struct host_if_drv *hWFIDrv,
u8 *pu8IPAddr,
u8 idx);
-s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
-s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv,
+s32 wilc_del_all_rx_ba_session(struct host_if_drv *hWFIDrv,
char *pBSSID,
char TID);
-s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
-s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv,
+s32 wilc_remain_on_channel(struct host_if_drv *hWFIDrv,
u32 u32SessionID,
u32 u32duration,
u16 chan,
wilc_remain_on_chan_expired RemainOnChanExpired,
wilc_remain_on_chan_ready RemainOnChanReady,
void *pvUserArg);
-s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
-s32 host_int_frame_register(struct host_if_drv *hWFIDrv,
+s32 wilc_listen_state_expired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
+s32 wilc_frame_register(struct host_if_drv *hWFIDrv,
u16 u16FrameType,
bool bReg);
-int host_int_set_wfi_drv_handler(struct host_if_drv *address);
-int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
+int wilc_set_wfi_drv_handler(struct host_if_drv *address);
+int wilc_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
-static s32 Handle_ScanDone(struct host_if_drv *drvHandler,
- enum scan_event enuEvent);
+void wilc_free_join_params(void *pJoinParams);
-void host_int_freeJoinParams(void *pJoinParams);
-
-s32 host_int_get_statistics(struct host_if_drv *hWFIDrv,
+s32 wilc_get_statistics(struct host_if_drv *hWFIDrv,
struct rf_info *pstrStatistics);
-void resolve_disconnect_aberration(struct host_if_drv *hif_drv);
+void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv);
+
+extern bool wilc_optaining_ip;
+extern u8 wilc_connected_SSID[6];
+extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc_connecting;
+extern u8 wilc_initialized;
+extern struct timer_list wilc_during_ip_timer;
+
#endif
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index 589a11f..e550027 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,12 +26,9 @@
static struct net_device *wilc_wfi_mon; /* global monitor netdev */
-extern int mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
-u8 srcAdd[6];
-u8 bssid[6];
-u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static u8 srcAdd[6];
+static u8 bssid[6];
+static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
/**
* @brief WILC_WFI_monitor_rx
* @details
@@ -298,7 +295,7 @@
mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len);
dev_kfree_skb(skb);
} else
- ret = mac_xmit(skb, mon_priv->real_ndev);
+ ret = wilc_mac_xmit(skb, mon_priv->real_ndev);
return ret;
}
diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 086f1db..89b5aca 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -25,50 +25,6 @@
#include <linux/semaphore.h>
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#else
-#include "linux_wlan_spi.h"
-#endif
-
- #define _linux_wlan_device_power_on() {}
- #define _linux_wlan_device_power_off() {}
-
- #define _linux_wlan_device_detection() {}
- #define _linux_wlan_device_removal() {}
-
-extern bool g_obtainingIP;
-extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-extern struct timer_list hDuringIpTimer;
-
-static int linux_wlan_device_power(int on_off)
-{
- PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
- if (on_off) {
- _linux_wlan_device_power_on();
- } else {
- _linux_wlan_device_power_off();
- }
-
- return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
- PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
- if (on_off) {
- _linux_wlan_device_detection();
- } else {
- _linux_wlan_device_removal();
- }
-#endif
-
- return 0;
-}
-
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr);
static struct notifier_block g_dev_notifier = {
@@ -81,25 +37,22 @@
static int wlan_deinit_locks(struct net_device *dev);
static void wlan_deinitialize_threads(struct net_device *dev);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
static void linux_wlan_tx_complete(void *priv, int status);
static int mac_init_fn(struct net_device *ndev);
-int mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int mac_open(struct net_device *ndev);
-int mac_close(struct net_device *ndev);
static struct net_device_stats *mac_stats(struct net_device *dev);
static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
static void wilc_set_multicast_list(struct net_device *dev);
-struct wilc *g_linux_wlan;
-bool bEnablePS = true;
+struct wilc *wilc_dev;
+EXPORT_SYMBOL_GPL(wilc_dev);
+
+bool wilc_enable_ps = true;
static const struct net_device_ops wilc_netdev_ops = {
.ndo_init = mac_init_fn,
- .ndo_open = mac_open,
- .ndo_stop = mac_close,
- .ndo_start_xmit = mac_xmit,
+ .ndo_open = wilc_mac_open,
+ .ndo_stop = wilc_mac_close,
+ .ndo_start_xmit = wilc_mac_xmit,
.ndo_do_ioctl = mac_ioctl,
.ndo_get_stats = mac_stats,
.ndo_set_rx_mode = wilc_set_multicast_list,
@@ -155,13 +108,13 @@
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 1;
- g_obtainingIP = false;
- del_timer(&hDuringIpTimer);
+ wilc_optaining_ip = false;
+ del_timer(&wilc_during_ip_timer);
PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
}
- if (bEnablePS)
- host_int_set_power_mgmt(hif_drv, 1, 0);
+ if (wilc_enable_ps)
+ wilc_set_power_mgmt(hif_drv, 1, 0);
PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);
@@ -169,7 +122,7 @@
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
- host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
+ wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
break;
@@ -179,13 +132,13 @@
PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
hif_drv->IFC_UP = 0;
- g_obtainingIP = false;
+ wilc_optaining_ip = false;
}
if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
- host_int_set_power_mgmt(hif_drv, 0, 0);
+ wilc_set_power_mgmt(hif_drv, 0, 0);
- resolve_disconnect_aberration(hif_drv);
+ wilc_resolve_disconnect_aberration(hif_drv);
PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);
@@ -194,7 +147,7 @@
ip_addr_buf[0], ip_addr_buf[1],
ip_addr_buf[2], ip_addr_buf[3]);
- host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
+ wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
break;
@@ -208,7 +161,6 @@
return NOTIFY_DONE;
}
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
static irqreturn_t isr_uh_routine(int irq, void *user_data)
{
perInterface_wlan_t *nic;
@@ -225,9 +177,8 @@
}
return IRQ_WAKE_THREAD;
}
-#endif
-irqreturn_t isr_bh_routine(int irq, void *userdata)
+static irqreturn_t isr_bh_routine(int irq, void *userdata)
{
perInterface_wlan_t *nic;
struct wilc *wilc;
@@ -246,7 +197,6 @@
return IRQ_HANDLED;
}
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
static int init_irq(struct net_device *dev)
{
int ret = 0;
@@ -256,9 +206,9 @@
nic = netdev_priv(dev);
wl = nic->wilc;
- if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
- (gpio_direction_input(GPIO_NUM) == 0)) {
- wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
+ (gpio_direction_input(wl->gpio) == 0)) {
+ wl->dev_irq_num = gpio_to_irq(wl->gpio);
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
@@ -269,16 +219,16 @@
isr_bh_routine,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"WILC_IRQ", dev) < 0) {
- PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+ PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio);
+ gpio_free(wl->gpio);
ret = -1;
} else {
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
- wl->dev_irq_num, GPIO_NUM);
+ wl->dev_irq_num, wl->gpio);
}
return ret;
}
-#endif
static void deinit_irq(struct net_device *dev)
{
@@ -288,22 +238,21 @@
nic = netdev_priv(dev);
wilc = nic->wilc;
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
- if (&wilc->dev_irq_num != 0) {
+ /* Deintialize IRQ */
+ if (wilc->dev_irq_num) {
free_irq(wilc->dev_irq_num, wilc);
-
- gpio_free(GPIO_NUM);
+ gpio_free(wilc->gpio);
}
-#endif
}
-void linux_wlan_dbg(u8 *buff)
+void wilc_dbg(struct wilc *wilc, u8 *buff)
{
PRINT_D(INIT_DBG, "%d\n", *buff);
}
-int linux_wlan_lock_timeout(void *vp, u32 timeout)
+int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout)
{
+ /* FIXME: replace with mutex_lock or wait_for_completion */
int error = -1;
PRINT_D(LOCK_DBG, "Locking %p\n", vp);
@@ -315,7 +264,7 @@
return error;
}
-void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
+void wilc_mac_indicate(struct wilc *wilc, int flag)
{
int status;
@@ -333,7 +282,7 @@
}
}
-struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
+static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header)
{
u8 *bssid, *bssid1;
int i = 0;
@@ -360,7 +309,7 @@
return NULL;
}
-int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid)
+int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid)
{
int i = 0;
int ret = -1;
@@ -380,14 +329,14 @@
return ret;
}
-int linux_wlan_get_num_conn_ifcs(void)
+int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
{
u8 i = 0;
u8 null_bssid[6] = {0};
u8 ret_val = 0;
- for (i = 0; i < g_linux_wlan->vif_num; i++)
- if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
+ for (i = 0; i < wilc->vif_num; i++)
+ if (memcmp(wilc->vif[i].bssid, null_bssid, 6))
ret_val++;
return ret_val;
@@ -463,12 +412,12 @@
return 0;
}
-void linux_wlan_rx_complete(void)
+void wilc_rx_complete(struct wilc *nic)
{
PRINT_D(RX_DBG, "RX completed\n");
}
-int linux_wlan_get_firmware(struct net_device *dev)
+int wilc_wlan_get_firmware(struct net_device *dev)
{
perInterface_wlan_t *nic;
struct wilc *wilc;
@@ -498,19 +447,11 @@
goto _fail_;
}
-#ifdef WILC_SDIO
- if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) {
+ if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) {
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
-#else
- if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_spidev->dev) != 0) {
- PRINT_ER("%s - firmare not available\n", firmware);
- ret = -1;
- goto _fail_;
- }
-#endif
wilc->firmware = wilc_firmware;
_fail_:
@@ -528,14 +469,14 @@
wilc = nic->wilc;
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
- ret = wilc_wlan_start();
+ ret = wilc_wlan_start(wilc);
if (ret < 0) {
PRINT_ER("Failed to start Firmware\n");
return ret;
}
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
- ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000);
+ ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000);
if (ret) {
PRINT_D(INIT_DBG, "Firmware start timed out");
return ret;
@@ -545,7 +486,7 @@
return 0;
}
-static int linux_wlan_firmware_download(struct net_device *dev)
+static int wilc1000_firmware_download(struct net_device *dev)
{
perInterface_wlan_t *nic;
struct wilc *wilc;
@@ -559,7 +500,7 @@
return -ENOBUFS;
}
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
- ret = wilc_wlan_firmware_download(wilc->firmware->data,
+ ret = wilc_wlan_firmware_download(wilc, wilc->firmware->data,
wilc->firmware->size);
if (ret < 0)
return ret;
@@ -654,7 +595,7 @@
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;
- c_val[0] = NO_ENCRYPT;
+ c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;
@@ -799,11 +740,12 @@
#endif
PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
- mutex_lock(&wl->hif_cs);
- disable_sdio_interrupt();
- mutex_unlock(&wl->hif_cs);
-#endif
+ if (!wl->dev_irq_num &&
+ wl->ops->disable_interrupt) {
+ mutex_lock(&wl->hif_cs);
+ wl->ops->disable_interrupt(wl);
+ mutex_unlock(&wl->hif_cs);
+ }
if (&wl->txq_event)
up(&wl->txq_event);
@@ -813,18 +755,20 @@
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);
- wilc_wlan_stop();
+ wilc_wlan_stop(wl);
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
- PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
+#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
+ if (!wl->dev_irq_num &&
+ wl->ops->disable_interrupt) {
- mutex_lock(&wl->hif_cs);
- disable_sdio_interrupt();
- mutex_unlock(&wl->hif_cs);
- #endif
+ PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
+
+ mutex_lock(&wl->hif_cs);
+ wl->ops->disable_interrupt(wl);
+ mutex_unlock(&wl->hif_cs);
+ }
#endif
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
@@ -839,7 +783,7 @@
}
}
-int wlan_init_locks(struct net_device *dev)
+static int wlan_init_locks(struct net_device *dev)
{
perInterface_wlan_t *nic;
struct wilc *wl;
@@ -884,18 +828,7 @@
return 0;
}
-void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
- PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
-#ifdef WILC_SDIO
- nwi->io_func.io_type = HIF_SDIO;
-#else
- nwi->io_func.io_type = HIF_SPI;
-#endif
-}
-
-int wlan_initialize_threads(struct net_device *dev)
+static int wlan_initialize_threads(struct net_device *dev)
{
perInterface_wlan_t *nic;
struct wilc *wilc;
@@ -921,7 +854,6 @@
{
perInterface_wlan_t *nic;
struct wilc *wl;
-
nic = netdev_priv(dev);
wl = nic->wilc;
@@ -939,7 +871,6 @@
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{
- wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
struct wilc *wl = nic->wilc;
@@ -950,22 +881,18 @@
wlan_init_locks(dev);
- linux_to_wlan(&nwi, wl);
-
- ret = wilc_wlan_init(dev, &nwi);
+ ret = wilc_wlan_init(dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO;
goto _fail_locks_;
}
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- if (init_irq(dev)) {
+ if (wl->gpio >= 0 && init_irq(dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
}
-#endif
ret = wlan_initialize_threads(dev);
if (ret < 0) {
@@ -974,21 +901,21 @@
goto _fail_wilc_wlan_;
}
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- if (enable_sdio_interrupt()) {
+ if (!wl->dev_irq_num &&
+ wl->ops->enable_interrupt &&
+ wl->ops->enable_interrupt(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
}
-#endif
- if (linux_wlan_get_firmware(dev)) {
+ if (wilc_wlan_get_firmware(dev)) {
PRINT_ER("Can't get firmware\n");
ret = -EIO;
goto _fail_irq_enable_;
}
- ret = linux_wlan_firmware_download(dev);
+ ret = wilc1000_firmware_download(dev);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1026,17 +953,16 @@
return 0;
_fail_fw_start_:
- wilc_wlan_stop();
+ wilc_wlan_stop(wl);
_fail_irq_enable_:
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
- disable_sdio_interrupt();
+ if (!wl->dev_irq_num &&
+ wl->ops->disable_interrupt)
+ wl->ops->disable_interrupt(wl);
_fail_irq_init_:
-#endif
-#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- deinit_irq(dev);
+ if (wl->dev_irq_num)
+ deinit_irq(dev);
-#endif
wlan_deinitialize_threads(dev);
_fail_wilc_wlan_:
wilc_wlan_cleanup(dev);
@@ -1049,7 +975,7 @@
return ret;
}
-int mac_init_fn(struct net_device *ndev)
+static int mac_init_fn(struct net_device *ndev)
{
netif_start_queue(ndev);
netif_stop_queue(ndev);
@@ -1057,9 +983,10 @@
return 0;
}
-int mac_open(struct net_device *ndev)
+int wilc_mac_open(struct net_device *ndev)
{
perInterface_wlan_t *nic;
+ struct wilc *wilc;
unsigned char mac_add[ETH_ALEN] = {0};
int ret = 0;
@@ -1070,13 +997,13 @@
nic = netdev_priv(ndev);
wl = nic->wilc;
-#ifdef WILC_SPI
- if (!wl || !wl->wilc_spidev) {
+ if (!wl|| !wl->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
-#endif
+
nic = netdev_priv(ndev);
+ wilc = nic->wilc;
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1095,9 +1022,9 @@
return ret;
}
- set_machw_change_vir_if(ndev, false);
+ wilc_set_machw_change_vir_if(ndev, false);
- hif_get_mac_address(priv->hWILCWFIDrv, mac_add);
+ wilc_get_mac_address(priv->hWILCWFIDrv, mac_add);
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
for (i = 0; i < wl->vif_num; i++) {
@@ -1131,7 +1058,7 @@
return 0;
}
-struct net_device_stats *mac_stats(struct net_device *dev)
+static struct net_device_stats *mac_stats(struct net_device *dev)
{
perInterface_wlan_t *nic = netdev_priv(dev);
@@ -1162,29 +1089,29 @@
if ((dev->flags & IFF_ALLMULTI) ||
(dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
- host_int_setup_multicast_filter(hif_drv, false, 0);
+ wilc_setup_multicast_filter(hif_drv, false, 0);
return;
}
if ((dev->mc.count) == 0) {
PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
- host_int_setup_multicast_filter(hif_drv, true, 0);
+ wilc_setup_multicast_filter(hif_drv, true, 0);
return;
}
netdev_for_each_mc_addr(ha, dev) {
- memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN);
+ memcpy(wilc_multicast_mac_addr_list[i], ha->addr, ETH_ALEN);
PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i,
- multicast_mac_addr_list[i][0],
- multicast_mac_addr_list[i][1],
- multicast_mac_addr_list[i][2],
- multicast_mac_addr_list[i][3],
- multicast_mac_addr_list[i][4],
- multicast_mac_addr_list[i][5]);
+ wilc_multicast_mac_addr_list[i][0],
+ wilc_multicast_mac_addr_list[i][1],
+ wilc_multicast_mac_addr_list[i][2],
+ wilc_multicast_mac_addr_list[i][3],
+ wilc_multicast_mac_addr_list[i][4],
+ wilc_multicast_mac_addr_list[i][5]);
i++;
}
- host_int_setup_multicast_filter(hif_drv, true, (dev->mc.count));
+ wilc_setup_multicast_filter(hif_drv, true, (dev->mc.count));
return;
}
@@ -1201,7 +1128,7 @@
kfree(pv_data);
}
-int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
+int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
{
perInterface_wlan_t *nic;
struct tx_complete_data *tx_data = NULL;
@@ -1262,7 +1189,7 @@
return 0;
}
-int mac_close(struct net_device *ndev)
+int wilc_mac_close(struct net_device *ndev)
{
struct wilc_priv *priv;
perInterface_wlan_t *nic;
@@ -1325,7 +1252,7 @@
return 0;
}
-int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
+static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
{
u8 *buff = NULL;
s8 rssi;
@@ -1356,8 +1283,7 @@
if (strncasecmp(buff, "RSSI", length) == 0) {
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
- ret = host_int_get_rssi(priv->hWILCWFIDrv,
- &rssi);
+ ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi);
if (ret)
PRINT_ER("Failed to send get rssi param's message queue ");
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
@@ -1391,7 +1317,7 @@
return ret;
}
-void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
+void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
{
unsigned int frame_len = 0;
int stats;
@@ -1454,7 +1380,7 @@
WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}
-void wl_wlan_cleanup(struct wilc *wilc)
+void wilc_netdev_cleanup(struct wilc *wilc)
{
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
@@ -1470,12 +1396,12 @@
release_firmware(wilc->firmware);
if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) {
- linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000);
+ wilc_lock_timeout(wilc, &close_exit_sync, 12 * 1000);
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
if (wilc->vif[i].ndev)
if (nic[i]->mac_opened)
- mac_close(wilc->vif[i].ndev);
+ wilc_mac_close(wilc->vif[i].ndev);
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
unregister_netdev(wilc->vif[i].ndev);
@@ -1485,27 +1411,27 @@
}
kfree(wilc);
-
-#if defined(WILC_DEBUGFS)
- wilc_debugfs_remove();
-#endif
- linux_wlan_device_detection(0);
- linux_wlan_device_power(0);
}
+EXPORT_SYMBOL_GPL(wilc_netdev_cleanup);
-int wilc_netdev_init(struct wilc **wilc)
+int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
+ int gpio, const struct wilc_hif_func *ops)
{
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
+ struct wilc *wl;
sema_init(&close_exit_sync, 0);
- g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
- if (!g_linux_wlan)
+ wl = kzalloc(sizeof(*wilc_dev), GFP_KERNEL);
+ if (!wl)
return -ENOMEM;
- *wilc = g_linux_wlan;
+ *wilc = wl;
+ wl->io_type = io_type;
+ wl->gpio = gpio;
+ wl->ops = ops;
register_inetaddr_notifier(&g_dev_notifier);
@@ -1524,20 +1450,19 @@
else
strcpy(ndev->name, "p2p%d");
- nic->u8IfIdx = g_linux_wlan->vif_num;
+ nic->u8IfIdx = wl->vif_num;
nic->wilc_netdev = ndev;
nic->wilc = *wilc;
- g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
- g_linux_wlan->vif_num++;
+ wl->vif[wl->vif_num].ndev = ndev;
+ wl->vif_num++;
ndev->netdev_ops = &wilc_netdev_ops;
{
struct wireless_dev *wdev;
- wdev = wilc_create_wiphy(ndev);
+ wdev = wilc_create_wiphy(ndev, dev);
- #ifdef WILC_SDIO
- SET_NETDEV_DEV(ndev, &local_sdio_func->dev);
- #endif
+ if (dev)
+ SET_NETDEV_DEV(ndev, dev);
if (!wdev) {
PRINT_ER("Can't register WILC Wiphy\n");
@@ -1562,69 +1487,10 @@
nic->iftype = STATION_MODE;
nic->mac_opened = 0;
}
-
- #ifndef WILC_SDIO
- if (!linux_spi_init()) {
- PRINT_ER("Can't initialize SPI\n");
- return -1;
- }
- g_linux_wlan->wilc_spidev = wilc_spi_dev;
- #else
- g_linux_wlan->wilc_sdio_func = local_sdio_func;
- #endif
+ wilc_dev = *wilc = wl;
return 0;
}
-
-static int __init init_wilc_driver(void)
-{
-#ifdef WILC_SPI
- struct wilc *wilc;
-#endif
-
-#if defined(WILC_DEBUGFS)
- if (wilc_debugfs_init() < 0) {
- PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n");
- return -1;
- }
-#endif
-
- printk("IN INIT FUNCTION\n");
- printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-
- linux_wlan_device_power(1);
- msleep(100);
- linux_wlan_device_detection(1);
-
-#ifdef WILC_SDIO
- {
- int ret;
-
- ret = sdio_register_driver(&wilc_bus);
- if (ret < 0)
- PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n");
-
- return ret;
- }
-#else
- PRINT_D(INIT_DBG, "Initializing netdev\n");
- if (wilc_netdev_init(&wilc))
- PRINT_ER("Couldn't initialize netdev\n");
- return 0;
-#endif
-}
-late_initcall(init_wilc_driver);
-
-static void __exit exit_wilc_driver(void)
-{
-#ifndef WILC_SDIO
- PRINT_D(INIT_DBG, "SPI unregister...\n");
- spi_unregister_driver(&wilc_bus);
-#else
- PRINT_D(INIT_DBG, "SDIO unregister...\n");
- sdio_unregister_driver(&wilc_bus);
-#endif
-}
-module_exit(exit_wilc_driver);
+EXPORT_SYMBOL_GPL(wilc_netdev_init);
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h
index 2b76e41..72b524a 100644
--- a/drivers/staging/wilc1000/linux_wlan_common.h
+++ b/drivers/staging/wilc1000/linux_wlan_common.h
@@ -38,11 +38,8 @@
#define FIRM_DBG (1 << Firmware_debug)
#if defined (WILC_DEBUGFS)
-int wilc_debugfs_init(void);
-void wilc_debugfs_remove(void);
-
-extern atomic_t REGION;
-extern atomic_t DEBUG_LEVEL;
+extern atomic_t WILC_REGION;
+extern atomic_t WILC_DEBUG_LEVEL;
#define DEBUG BIT(0)
#define INFO BIT(1)
@@ -51,8 +48,8 @@
#define PRINT_D(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & DEBUG) && \
- ((atomic_read(®ION)) & (region))) { \
+ if ((atomic_read(&WILC_DEBUG_LEVEL) & DEBUG) && \
+ ((atomic_read(&WILC_REGION)) & (region))) { \
printk("DBG [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
@@ -60,8 +57,8 @@
#define PRINT_INFO(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & INFO) && \
- ((atomic_read(®ION)) & (region))) { \
+ if ((atomic_read(&WILC_DEBUG_LEVEL) & INFO) && \
+ ((atomic_read(&WILC_REGION)) & (region))) { \
printk("INFO [%s]", __func__); \
printk(__VA_ARGS__); \
} \
@@ -69,8 +66,8 @@
#define PRINT_WRN(region, ...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & WRN) && \
- ((atomic_read(®ION)) & (region))) { \
+ if ((atomic_read(&WILC_DEBUG_LEVEL) & WRN) && \
+ ((atomic_read(&WILC_REGION)) & (region))) { \
printk("WRN [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
@@ -78,7 +75,7 @@
#define PRINT_ER(...) \
do { \
- if ((atomic_read(&DEBUG_LEVEL) & ERR)) { \
+ if ((atomic_read(&WILC_DEBUG_LEVEL) & ERR)) { \
printk("ERR [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} \
@@ -121,6 +118,7 @@
printk("ERR [%s: %d]", __func__, __LINE__); \
printk(__VA_ARGS__); \
} while (0)
+
#endif
#define FN_IN /* PRINT_D(">>> \n") */
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c
index e854d37..1f366b5 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -5,8 +5,9 @@
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/host.h>
+#include <linux/of_gpio.h>
-
+#include "linux_wlan_sdio.h"
#define SDIO_MODALIAS "wilc1000_sdio"
@@ -21,13 +22,7 @@
#define MAX_SPEED (6 * 1000000) /* Max 50M */
#endif
-struct wilc_sdio {
- struct sdio_func *func;
- struct wilc *wilc;
-};
-
-struct sdio_func *local_sdio_func;
-
+static struct sdio_func *wilc_sdio_func;
static unsigned int sdio_default_speed;
#define SDIO_VENDOR_ID_WILC 0x0296
@@ -41,21 +36,14 @@
static void wilc_sdio_interrupt(struct sdio_func *func)
{
- struct wilc_sdio *wl_sdio;
-
- wl_sdio = sdio_get_drvdata(func);
-
-#ifndef WILC_SDIO_IRQ_GPIO
sdio_release_host(func);
- wilc_handle_isr(wl_sdio->wilc);
+ wilc_handle_isr(sdio_get_drvdata(func));
sdio_claim_host(func);
-#endif
}
-
-int linux_sdio_cmd52(sdio_cmd52_t *cmd)
+int wilc_sdio_cmd52(sdio_cmd52_t *cmd)
{
- struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
+ struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
int ret;
u8 data;
@@ -85,9 +73,9 @@
}
-int linux_sdio_cmd53(sdio_cmd53_t *cmd)
+int wilc_sdio_cmd53(sdio_cmd53_t *cmd)
{
- struct sdio_func *func = g_linux_wlan->wilc_sdio_func;
+ struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
int size, ret;
sdio_claim_host(func);
@@ -118,24 +106,25 @@
static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
- struct wilc_sdio *wl_sdio;
struct wilc *wilc;
+ int gpio;
- PRINT_D(INIT_DBG, "probe function\n");
- wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL);
- if (!wl_sdio)
- return -ENOMEM;
+ gpio = -1;
+ if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
+ gpio = of_get_gpio(func->dev.of_node, 0);
+ if (gpio < 0)
+ gpio = GPIO_NUM;
+ }
PRINT_D(INIT_DBG, "Initializing netdev\n");
- local_sdio_func = func;
- if (wilc_netdev_init(&wilc)) {
+ wilc_sdio_func = func;
+ if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio,
+ &wilc_hif_sdio)) {
PRINT_ER("Couldn't initialize netdev\n");
- kfree(wl_sdio);
return -1;
}
- wl_sdio->func = func;
- wl_sdio->wilc = wilc;
- sdio_set_drvdata(func, wl_sdio);
+ sdio_set_drvdata(func, wilc);
+ wilc->dev = &func->dev;
printk("Driver Initializing success\n");
return 0;
@@ -143,67 +132,63 @@
static void linux_sdio_remove(struct sdio_func *func)
{
- struct wilc_sdio *wl_sdio;
-
- wl_sdio = sdio_get_drvdata(func);
- wl_wlan_cleanup(wl_sdio->wilc);
- kfree(wl_sdio);
+ wilc_netdev_cleanup(sdio_get_drvdata(func));
}
-struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc1000_sdio_driver = {
.name = SDIO_MODALIAS,
.id_table = wilc_sdio_ids,
.probe = linux_sdio_probe,
.remove = linux_sdio_remove,
};
+module_driver(wilc1000_sdio_driver, sdio_register_driver, sdio_unregister_driver);
+MODULE_LICENSE("GPL");
-int enable_sdio_interrupt(void)
+int wilc_sdio_enable_interrupt(struct wilc *dev)
{
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret = 0;
-#ifndef WILC_SDIO_IRQ_GPIO
- sdio_claim_host(local_sdio_func);
- ret = sdio_claim_irq(local_sdio_func, wilc_sdio_interrupt);
- sdio_release_host(local_sdio_func);
+ sdio_claim_host(func);
+ ret = sdio_claim_irq(func, wilc_sdio_interrupt);
+ sdio_release_host(func);
if (ret < 0) {
PRINT_ER("can't claim sdio_irq, err(%d)\n", ret);
ret = -EIO;
}
-#endif
return ret;
}
-void disable_sdio_interrupt(void)
+void wilc_sdio_disable_interrupt(struct wilc *dev)
{
-
-#ifndef WILC_SDIO_IRQ_GPIO
+ struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret;
- PRINT_D(INIT_DBG, "disable_sdio_interrupt IN\n");
+ PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n");
- sdio_claim_host(local_sdio_func);
- ret = sdio_release_irq(local_sdio_func);
+ sdio_claim_host(func);
+ ret = sdio_release_irq(func);
if (ret < 0) {
PRINT_ER("can't release sdio_irq, err(%d)\n", ret);
}
- sdio_release_host(local_sdio_func);
+ sdio_release_host(func);
- PRINT_D(INIT_DBG, "disable_sdio_interrupt OUT\n");
-#endif
+ PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n");
}
static int linux_sdio_set_speed(int speed)
{
struct mmc_ios ios;
+ struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
- sdio_claim_host(local_sdio_func);
+ sdio_claim_host(func);
- memcpy((void *)&ios, (void *)&local_sdio_func->card->host->ios, sizeof(struct mmc_ios));
- local_sdio_func->card->host->ios.clock = speed;
+ memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios));
+ func->card->host->ios.clock = speed;
ios.clock = speed;
- local_sdio_func->card->host->ops->set_ios(local_sdio_func->card->host, &ios);
- sdio_release_host(local_sdio_func);
+ func->card->host->ops->set_ios(func->card->host, &ios);
+ sdio_release_host(func);
PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed);
return 1;
@@ -211,10 +196,11 @@
static int linux_sdio_get_speed(void)
{
- return local_sdio_func->card->host->ios.clock;
+ struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev);
+ return func->card->host->ios.clock;
}
-int linux_sdio_init(void)
+int wilc_sdio_init(void)
{
/**
@@ -226,26 +212,14 @@
return 1;
}
-void linux_sdio_deinit(void *pv)
-{
-
- /**
- * TODO :
- **/
-
-
- sdio_unregister_driver(&wilc_bus);
-}
-
-int linux_sdio_set_max_speed(void)
+int wilc_sdio_set_max_speed(void)
{
return linux_sdio_set_speed(MAX_SPEED);
}
-int linux_sdio_set_default_speed(void)
+int wilc_sdio_set_default_speed(void)
{
return linux_sdio_set_speed(sdio_default_speed);
}
-
-
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h
index 6f42bc7..d7b213a 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.h
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.h
@@ -1,14 +1,11 @@
-extern struct sdio_func *local_sdio_func;
-extern struct sdio_driver wilc_bus;
-
#include <linux/mmc/sdio_func.h>
-int linux_sdio_init(void);
-void linux_sdio_deinit(void *);
-int linux_sdio_cmd52(sdio_cmd52_t *cmd);
-int linux_sdio_cmd53(sdio_cmd53_t *cmd);
-int enable_sdio_interrupt(void);
-void disable_sdio_interrupt(void);
-int linux_sdio_set_max_speed(void);
-int linux_sdio_set_default_speed(void);
+int wilc_sdio_init(void);
+int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
+int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
+
+int wilc_sdio_enable_interrupt(struct wilc *);
+void wilc_sdio_disable_interrupt(struct wilc *);
+int wilc_sdio_set_max_speed(void);
+int wilc_sdio_set_default_speed(void);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c
index 73c788f..1d8922d 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -8,9 +8,12 @@
#include <linux/uaccess.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
-#include "linux_wlan_common.h"
#include "linux_wlan_spi.h"
+#include "wilc_wfi_netdevice.h"
+#include "linux_wlan_common.h"
+#include "wilc_wlan_if.h"
#define USE_SPI_DMA 0 /* johnny add */
@@ -41,73 +44,53 @@
static u32 SPEED = MIN_SPEED;
-struct spi_device *wilc_spi_dev;
-void linux_spi_deinit(void *vp);
+static const struct wilc1000_ops wilc1000_spi_ops;
-static int __init wilc_bus_probe(struct spi_device *spi)
+static int wilc_bus_probe(struct spi_device *spi)
{
+ int ret, gpio;
+ struct wilc *wilc;
- PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias);
- PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz);
- wilc_spi_dev = spi;
+ gpio = of_get_gpio(spi->dev.of_node, 0);
+ if (gpio < 0)
+ gpio = GPIO_NUM;
- printk("Driver Initializing success\n");
- return 0;
-}
+ ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi);
+ if (ret)
+ return ret;
-static int __exit wilc_bus_remove(struct spi_device *spi)
-{
+ spi_set_drvdata(spi, wilc);
+ wilc->dev = &spi->dev;
return 0;
}
-#ifdef CONFIG_OF
+static int wilc_bus_remove(struct spi_device *spi)
+{
+ wilc_netdev_cleanup(spi_get_drvdata(spi));
+ return 0;
+}
+
static const struct of_device_id wilc1000_of_match[] = {
{ .compatible = "atmel,wilc_spi", },
{}
};
MODULE_DEVICE_TABLE(of, wilc1000_of_match);
-#endif
-struct spi_driver wilc_bus __refdata = {
+struct spi_driver wilc1000_spi_driver = {
.driver = {
.name = MODALIAS,
-#ifdef CONFIG_OF
.of_match_table = wilc1000_of_match,
-#endif
},
.probe = wilc_bus_probe,
- .remove = __exit_p(wilc_bus_remove),
+ .remove = wilc_bus_remove,
};
+module_spi_driver(wilc1000_spi_driver);
+MODULE_LICENSE("GPL");
-
-void linux_spi_deinit(void *vp)
+int wilc_spi_init(void)
{
-
- spi_unregister_driver(&wilc_bus);
-
- SPEED = MIN_SPEED;
- PRINT_ER("@@@@@@@@@@@@ restore SPI speed to %d @@@@@@@@@\n", SPEED);
-
-}
-
-
-
-int linux_spi_init(void)
-{
- int ret = 1;
- static int called;
-
-
- if (called == 0) {
- called++;
- ret = spi_register_driver(&wilc_bus);
- }
-
- /* change return value to match WILC interface */
- (ret < 0) ? (ret = 0) : (ret = 1);
-
- return ret;
+ return 1;
}
#if defined(PLAT_WMS8304)
@@ -116,8 +99,9 @@
#if defined(TXRX_PHASE_SIZE)
-int linux_spi_write(u8 *b, u32 len)
+int wilc_spi_write(u8 *b, u32 len)
{
+ struct spi_device *spi = to_spi_device(wilc_dev->dev);
int ret;
if (len > 0 && b != NULL) {
@@ -144,11 +128,11 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -169,11 +153,11 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA; /* rachel */
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -193,9 +177,9 @@
}
#else
-int linux_spi_write(u8 *b, u32 len)
+int wilc_spi_write(u8 *b, u32 len)
{
-
+ struct spi_device *spi = to_spi_device(wilc_dev->dev);
int ret;
struct spi_message msg;
@@ -216,12 +200,12 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
/* [[johnny add */
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
/* ]] */
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -244,8 +228,9 @@
#if defined(TXRX_PHASE_SIZE)
-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc_spi_read(u8 *rb, u32 rlen)
{
+ struct spi_device *spi = to_spi_device(wilc_dev->dev);
int ret;
if (rlen > 0) {
@@ -272,11 +257,11 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -296,11 +281,11 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA; /* rachel */
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -318,9 +303,9 @@
}
#else
-int linux_spi_read(u8 *rb, u32 rlen)
+int wilc_spi_read(u8 *rb, u32 rlen)
{
-
+ struct spi_device *spi = to_spi_device(wilc_dev->dev);
int ret;
if (rlen > 0) {
@@ -341,12 +326,12 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
/* [[ johnny add */
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
/* ]] */
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -363,9 +348,9 @@
#endif
-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
+int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
{
-
+ struct spi_device *spi = to_spi_device(wilc_dev->dev);
int ret;
if (rlen > 0) {
@@ -382,11 +367,11 @@
memset(&msg, 0, sizeof(msg));
spi_message_init(&msg);
- msg.spi = wilc_spi_dev;
+ msg.spi = spi;
msg.is_dma_mapped = USE_SPI_DMA;
spi_message_add_tail(&tr, &msg);
- ret = spi_sync(wilc_spi_dev, &msg);
+ ret = spi_sync(spi, &msg);
if (ret < 0) {
PRINT_ER("SPI transaction failed\n");
}
@@ -400,7 +385,7 @@
return ret;
}
-int linux_spi_set_max_speed(void)
+int wilc_spi_set_max_speed(void)
{
SPEED = MAX_SPEED;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h
index b956100..f434f79 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.h
+++ b/drivers/staging/wilc1000/linux_wlan_spi.h
@@ -2,13 +2,11 @@
#define LINUX_WLAN_SPI_H
#include <linux/spi/spi.h>
-extern struct spi_device *wilc_spi_dev;
-extern struct spi_driver wilc_bus;
-int linux_spi_init(void);
-void linux_spi_deinit(void *vp);
-int linux_spi_write(u8 *b, u32 len);
-int linux_spi_read(u8 *rb, u32 rlen);
-int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
-int linux_spi_set_max_speed(void);
+int wilc_spi_init(void);
+int wilc_spi_write(u8 *b, u32 len);
+int wilc_spi_read(u8 *rb, u32 rlen);
+int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
+int wilc_spi_set_max_speed(void);
+
#endif
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index ae11186..27c653a 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -26,8 +26,10 @@
#define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG)
#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR)
-atomic_t REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
-atomic_t DEBUG_LEVEL = ATOMIC_INIT(ERR);
+atomic_t WILC_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG);
+EXPORT_SYMBOL_GPL(WILC_REGION);
+atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR);
+EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL);
/*
* --------------------------------------------------------------------------------
@@ -43,7 +45,7 @@
if (*ppos > 0)
return 0;
- res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&DEBUG_LEVEL));
+ res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC_DEBUG_LEVEL));
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
}
@@ -59,11 +61,11 @@
return ret;
if (flag > DBG_LEVEL_ALL) {
- printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));
+ printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_DEBUG_LEVEL));
return -EINVAL;
}
- atomic_set(&DEBUG_LEVEL, (int)flag);
+ atomic_set(&WILC_DEBUG_LEVEL, (int)flag);
if (flag == 0)
printk("Debug-level disabled\n");
@@ -82,7 +84,7 @@
if (*ppos > 0)
return 0;
- res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(®ION));
+ res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&WILC_REGION));
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
}
@@ -102,12 +104,12 @@
flag = buffer[0] - '0';
if (flag > DBG_REGION_ALL) {
- printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(®ION));
+ printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_REGION));
return -EFAULT;
}
- atomic_set(®ION, (int)flag);
- printk("new debug-region is %x\n", atomic_read(®ION));
+ atomic_set(&WILC_REGION, (int)flag);
+ printk("new debug-region is %x\n", atomic_read(&WILC_REGION));
return count;
}
@@ -136,7 +138,7 @@
{ "wilc_debug_region", 0666, (INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), },
};
-int wilc_debugfs_init(void)
+static int __init wilc_debugfs_init(void)
{
int i;
@@ -171,11 +173,13 @@
}
return 0;
}
+module_init(wilc_debugfs_init);
-void wilc_debugfs_remove(void)
+static void __exit wilc_debugfs_remove(void)
{
debugfs_remove_recursive(wilc_dir);
}
+module_exit(wilc_debugfs_remove);
#endif
diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 8aacf55..f550ce0 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -16,6 +16,7 @@
#define WILC_SDIO_BLOCK_SIZE 512
typedef struct {
+ bool irq_gpio;
u32 block_size;
wilc_debug_func dPrint;
int nint;
@@ -25,10 +26,8 @@
static wilc_sdio_t g_sdio;
-#ifdef WILC_SDIO_IRQ_GPIO
static int sdio_write_reg(u32 addr, u32 data);
static int sdio_read_reg(u32 addr, u32 *data);
-#endif
/********************************************
*
@@ -48,21 +47,21 @@
cmd.raw = 0;
cmd.address = 0x10c;
cmd.data = (u8)adr;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n");
goto _fail_;
}
cmd.address = 0x10d;
cmd.data = (u8)(adr >> 8);
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n");
goto _fail_;
}
cmd.address = 0x10e;
cmd.data = (u8)(adr >> 16);
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n");
goto _fail_;
}
@@ -81,14 +80,14 @@
cmd.raw = 0;
cmd.address = 0x10;
cmd.data = (u8)block_size;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n");
goto _fail_;
}
cmd.address = 0x11;
cmd.data = (u8)(block_size >> 8);
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n");
goto _fail_;
}
@@ -113,13 +112,13 @@
cmd.raw = 0;
cmd.address = 0x110;
cmd.data = (u8)block_size;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n");
goto _fail_;
}
cmd.address = 0x111;
cmd.data = (u8)(block_size >> 8);
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n");
goto _fail_;
}
@@ -131,93 +130,37 @@
static int sdio_clear_int(void)
{
-#ifndef WILC_SDIO_IRQ_GPIO
- /* u32 sts; */
- sdio_cmd52_t cmd;
+ if (!g_sdio.irq_gpio) {
+ /* u32 sts; */
+ sdio_cmd52_t cmd;
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x4;
- cmd.data = 0;
- linux_sdio_cmd52(&cmd);
+ cmd.read_write = 0;
+ cmd.function = 1;
+ cmd.raw = 0;
+ cmd.address = 0x4;
+ cmd.data = 0;
+ wilc_sdio_cmd52(&cmd);
- return cmd.data;
-#else
- u32 reg;
+ return cmd.data;
+ } else {
+ u32 reg;
- if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
- g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
- return 0;
+ if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
+ g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0);
+ return 0;
+ }
+ reg &= ~0x1;
+ sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
+ return 1;
}
- reg &= ~0x1;
- sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
- return 1;
-#endif
}
-u32 sdio_xfer_cnt(void)
-{
- u32 cnt = 0;
- sdio_cmd52_t cmd;
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1C;
- cmd.data = 0;
- linux_sdio_cmd52(&cmd);
- cnt = cmd.data;
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1D;
- cmd.data = 0;
- linux_sdio_cmd52(&cmd);
- cnt |= (cmd.data << 8);
-
- cmd.read_write = 0;
- cmd.function = 1;
- cmd.raw = 0;
- cmd.address = 0x1E;
- cmd.data = 0;
- linux_sdio_cmd52(&cmd);
- cnt |= (cmd.data << 16);
-
- return cnt;
-}
-
/********************************************
*
* Sdio interfaces
*
********************************************/
-int sdio_check_bs(void)
-{
- sdio_cmd52_t cmd;
-
- /**
- * poll until BS is 0
- **/
- cmd.read_write = 0;
- cmd.function = 0;
- cmd.raw = 0;
- cmd.address = 0xc;
- cmd.data = 0;
- if (!linux_sdio_cmd52(&cmd)) {
- g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n");
- goto _fail_;
- }
-
- return 1;
-
-_fail_:
-
- return 0;
-}
-
static int sdio_write_reg(u32 addr, u32 data)
{
#ifdef BIG_ENDIAN
@@ -232,7 +175,7 @@
cmd.raw = 0;
cmd.address = addr;
cmd.data = data;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -254,7 +197,7 @@
cmd.buffer = (u8 *)&data;
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr);
goto _fail_;
}
@@ -317,7 +260,7 @@
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr);
goto _fail_;
}
@@ -338,7 +281,7 @@
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr);
goto _fail_;
}
@@ -360,7 +303,7 @@
cmd.function = 0;
cmd.raw = 0;
cmd.address = addr;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr);
goto _fail_;
}
@@ -381,7 +324,7 @@
cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr);
goto _fail_;
}
@@ -448,7 +391,7 @@
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr);
goto _fail_;
}
@@ -469,7 +412,7 @@
if (!sdio_set_func0_csa_address(addr))
goto _fail_;
}
- if (!linux_sdio_cmd53(&cmd)) {
+ if (!wilc_sdio_cmd53(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr);
goto _fail_;
}
@@ -511,8 +454,7 @@
return 0;
}
-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 reg;
int ret;
@@ -546,7 +488,6 @@
return 0;
}
}
-#endif
return 1;
}
@@ -560,8 +501,9 @@
memset(&g_sdio, 0, sizeof(wilc_sdio_t));
g_sdio.dPrint = func;
+ g_sdio.irq_gpio = (wilc->dev_irq_num);
- if (!linux_sdio_init()) {
+ if (!wilc_sdio_init()) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n");
return 0;
} else {
@@ -576,7 +518,7 @@
cmd.raw = 1;
cmd.address = 0x100;
cmd.data = 0x80;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n");
goto _fail_;
}
@@ -598,7 +540,7 @@
cmd.raw = 1;
cmd.address = 0x2;
cmd.data = 0x2;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n");
goto _fail_;
}
@@ -613,7 +555,7 @@
loop = 3;
do {
cmd.data = 0;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n");
goto _fail_;
}
@@ -642,7 +584,7 @@
cmd.raw = 1;
cmd.address = 0x4;
cmd.data = 0x3;
- if (!linux_sdio_cmd52(&cmd)) {
+ if (!wilc_sdio_cmd52(&cmd)) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n");
goto _fail_;
}
@@ -670,12 +612,12 @@
static void sdio_set_max_speed(void)
{
- linux_sdio_set_max_speed();
+ wilc_sdio_set_max_speed();
}
static void sdio_set_default_speed(void)
{
- linux_sdio_set_default_speed();
+ wilc_sdio_set_default_speed();
}
static int sdio_read_size(u32 *size)
@@ -692,7 +634,7 @@
cmd.raw = 0;
cmd.address = 0xf2;
cmd.data = 0;
- linux_sdio_cmd52(&cmd);
+ wilc_sdio_cmd52(&cmd);
tmp = cmd.data;
/* cmd.read_write = 0; */
@@ -700,7 +642,7 @@
/* cmd.raw = 0; */
cmd.address = 0xf3;
cmd.data = 0;
- linux_sdio_cmd52(&cmd);
+ wilc_sdio_cmd52(&cmd);
tmp |= (cmd.data << 8);
*size = tmp;
@@ -718,36 +660,33 @@
/**
* Read IRQ flags
**/
-#ifndef WILC_SDIO_IRQ_GPIO
- cmd.function = 1;
- cmd.address = 0x04;
- cmd.data = 0;
- linux_sdio_cmd52(&cmd);
-
- if (cmd.data & BIT(0))
- tmp |= INT_0;
- if (cmd.data & BIT(2))
- tmp |= INT_1;
- if (cmd.data & BIT(3))
- tmp |= INT_2;
- if (cmd.data & BIT(4))
- tmp |= INT_3;
- if (cmd.data & BIT(5))
- tmp |= INT_4;
- if (cmd.data & BIT(6))
- tmp |= INT_5;
- {
+ if (!g_sdio.irq_gpio) {
int i;
+ cmd.function = 1;
+ cmd.address = 0x04;
+ cmd.data = 0;
+ wilc_sdio_cmd52(&cmd);
+
+ if (cmd.data & BIT(0))
+ tmp |= INT_0;
+ if (cmd.data & BIT(2))
+ tmp |= INT_1;
+ if (cmd.data & BIT(3))
+ tmp |= INT_2;
+ if (cmd.data & BIT(4))
+ tmp |= INT_3;
+ if (cmd.data & BIT(5))
+ tmp |= INT_4;
+ if (cmd.data & BIT(6))
+ tmp |= INT_5;
for (i = g_sdio.nint; i < MAX_NUM_INT; i++) {
if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data);
break;
}
}
- }
-#else
- {
+ } else {
u32 irq_flags;
cmd.read_write = 0;
@@ -755,13 +694,11 @@
cmd.raw = 0;
cmd.address = 0xf7;
cmd.data = 0;
- linux_sdio_cmd52(&cmd);
+ wilc_sdio_cmd52(&cmd);
irq_flags = cmd.data & 0x1f;
tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET);
}
-#endif
-
*int_status = tmp;
return 1;
@@ -774,16 +711,14 @@
if (g_sdio.has_thrpt_enh3) {
u32 reg;
-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 flags;
flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1);
reg = flags;
+ } else {
+ reg = 0;
}
-#else
- reg = 0;
-#endif
/* select VMM table 0 */
if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0)
reg |= BIT(5);
@@ -802,7 +737,7 @@
cmd.address = 0xf8;
cmd.data = reg;
- ret = linux_sdio_cmd52(&cmd);
+ ret = wilc_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -810,8 +745,7 @@
}
} else {
-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
/* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */
/* Cannot clear multiple interrupts. Must clear each interrupt individually */
u32 flags;
@@ -831,7 +765,7 @@
cmd.address = 0xf8;
cmd.data = BIT(i);
- ret = linux_sdio_cmd52(&cmd);
+ ret = wilc_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -851,7 +785,6 @@
}
}
}
-#endif /* WILC_SDIO_IRQ_GPIO */
{
u32 vmm_ctl;
@@ -875,7 +808,7 @@
cmd.raw = 0;
cmd.address = 0xf6;
cmd.data = vmm_ctl;
- ret = linux_sdio_cmd52(&cmd);
+ ret = wilc_sdio_cmd52(&cmd);
if (!ret) {
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__);
goto _fail_;
@@ -918,8 +851,7 @@
return 0;
}
-#ifdef WILC_SDIO_IRQ_GPIO
- {
+ if (g_sdio.irq_gpio) {
u32 reg;
int ret, i;
@@ -971,7 +903,6 @@
}
}
}
-#endif /* WILC_SDIO_IRQ_GPIO */
return 1;
}
@@ -981,23 +912,24 @@
*
********************************************/
-struct wilc_hif_func hif_sdio = {
- sdio_init,
- sdio_deinit,
- sdio_read_reg,
- sdio_write_reg,
- sdio_read,
- sdio_write,
- sdio_sync,
- sdio_clear_int,
- sdio_read_int,
- sdio_clear_int_ext,
- sdio_read_size,
- sdio_write,
- sdio_read,
- sdio_sync_ext,
-
- sdio_set_max_speed,
- sdio_set_default_speed,
+const struct wilc_hif_func wilc_hif_sdio = {
+ .hif_init = sdio_init,
+ .hif_deinit = sdio_deinit,
+ .hif_read_reg = sdio_read_reg,
+ .hif_write_reg = sdio_write_reg,
+ .hif_block_rx = sdio_read,
+ .hif_block_tx = sdio_write,
+ .hif_sync = sdio_sync,
+ .hif_clear_int = sdio_clear_int,
+ .hif_read_int = sdio_read_int,
+ .hif_clear_int_ext = sdio_clear_int_ext,
+ .hif_read_size = sdio_read_size,
+ .hif_block_tx_ext = sdio_write,
+ .hif_block_rx_ext = sdio_read,
+ .hif_sync_ext = sdio_sync_ext,
+ .hif_set_max_bus_speed = sdio_set_max_speed,
+ .hif_set_default_bus_speed = sdio_set_default_speed,
+ .enable_interrupt = wilc_sdio_enable_interrupt,
+ .disable_interrupt = wilc_sdio_disable_interrupt,
};
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 3741836..39dd756 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -22,8 +22,8 @@
static wilc_spi_t g_spi;
-static int wilc_spi_read(u32, u8 *, u32);
-static int wilc_spi_write(u32, u8 *, u32);
+static int _wilc_spi_read(u32, u8 *, u32);
+static int _wilc_spi_write(u32, u8 *, u32);
/********************************************
*
@@ -108,163 +108,6 @@
#define DATA_PKT_SZ_8K (8 * 1024)
#define DATA_PKT_SZ DATA_PKT_SZ_8K
-static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless)
-{
- u8 bc[9];
- int len = 5;
- int result = N_OK;
-
- bc[0] = cmd;
- switch (cmd) {
- case CMD_SINGLE_READ: /* single word (4 bytes) read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- len = 5;
- break;
-
- case CMD_INTERNAL_READ: /* internal register read */
- bc[1] = (u8)(adr >> 8);
- if (clockless)
- bc[1] |= BIT(7);
- bc[2] = (u8)adr;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_TERMINATE: /* termination */
- bc[1] = 0x00;
- bc[2] = 0x00;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_REPEAT: /* repeat */
- bc[1] = 0x00;
- bc[2] = 0x00;
- bc[3] = 0x00;
- len = 5;
- break;
-
- case CMD_RESET: /* reset */
- bc[1] = 0xff;
- bc[2] = 0xff;
- bc[3] = 0xff;
- len = 5;
- break;
-
- case CMD_DMA_WRITE: /* dma write */
- case CMD_DMA_READ: /* dma read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- bc[4] = (u8)(sz >> 8);
- bc[5] = (u8)(sz);
- len = 7;
- break;
-
- case CMD_DMA_EXT_WRITE: /* dma extended write */
- case CMD_DMA_EXT_READ: /* dma extended read */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)adr;
- bc[4] = (u8)(sz >> 16);
- bc[5] = (u8)(sz >> 8);
- bc[6] = (u8)(sz);
- len = 8;
- break;
-
- case CMD_INTERNAL_WRITE: /* internal register write */
- bc[1] = (u8)(adr >> 8);
- if (clockless)
- bc[1] |= BIT(7);
- bc[2] = (u8)(adr);
- bc[3] = (u8)(data >> 24);
- bc[4] = (u8)(data >> 16);
- bc[5] = (u8)(data >> 8);
- bc[6] = (u8)(data);
- len = 8;
- break;
-
- case CMD_SINGLE_WRITE: /* single word write */
- bc[1] = (u8)(adr >> 16);
- bc[2] = (u8)(adr >> 8);
- bc[3] = (u8)(adr);
- bc[4] = (u8)(data >> 24);
- bc[5] = (u8)(data >> 16);
- bc[6] = (u8)(data >> 8);
- bc[7] = (u8)(data);
- len = 9;
- break;
-
- default:
- result = N_FAIL;
- break;
- }
-
- if (result) {
- if (!g_spi.crc_off)
- bc[len - 1] = (crc7(0x7f, (const u8 *)&bc[0], len - 1)) << 1;
- else
- len -= 1;
-
- if (!linux_spi_write(bc, len)) {
- PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
- result = N_FAIL;
- }
- }
-
- return result;
-}
-
-static int spi_cmd_rsp(u8 cmd)
-{
- u8 rsp;
- int result = N_OK;
-
- /**
- * Command/Control response
- **/
- if ((cmd == CMD_RESET) ||
- (cmd == CMD_TERMINATE) ||
- (cmd == CMD_REPEAT)) {
- if (!linux_spi_read(&rsp, 1)) {
- result = N_FAIL;
- goto _fail_;
- }
- }
-
- if (!linux_spi_read(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n");
- result = N_FAIL;
- goto _fail_;
- }
-
- if (rsp != cmd) {
- PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp);
- result = N_FAIL;
- goto _fail_;
- }
-
- /**
- * State response
- **/
- if (!linux_spi_read(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n");
- result = N_FAIL;
- goto _fail_;
- }
-
- if (rsp != 0x00) {
- PRINT_ER("[wilc spi]: Failed cmd state response state (%02x)\n", rsp);
- result = N_FAIL;
- }
-
-_fail_:
-
- return result;
-}
-
static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless)
{
u8 wb[32], rb[32];
@@ -406,7 +249,7 @@
}
rix = len;
- if (!linux_spi_write_read(wb, rb, len2)) {
+ if (!wilc_spi_write_read(wb, rb, len2)) {
PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n");
result = N_FAIL;
return result;
@@ -521,7 +364,7 @@
/**
* Read bytes
**/
- if (!linux_spi_read(&b[ix], nbytes)) {
+ if (!wilc_spi_read(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -531,7 +374,7 @@
* Read Crc
**/
if (!g_spi.crc_off) {
- if (!linux_spi_read(crc, 2)) {
+ if (!wilc_spi_read(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
result = N_FAIL;
goto _error_;
@@ -562,7 +405,7 @@
**/
retry = 10;
do {
- if (!linux_spi_read(&rsp, 1)) {
+ if (!wilc_spi_read(&rsp, 1)) {
PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
result = N_FAIL;
break;
@@ -578,7 +421,7 @@
/**
* Read bytes
**/
- if (!linux_spi_read(&b[ix], nbytes)) {
+ if (!wilc_spi_read(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
result = N_FAIL;
break;
@@ -588,7 +431,7 @@
* Read Crc
**/
if (!g_spi.crc_off) {
- if (!linux_spi_read(crc, 2)) {
+ if (!wilc_spi_read(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
result = N_FAIL;
break;
@@ -604,74 +447,6 @@
return result;
}
-static int spi_data_read(u8 *b, u32 sz)
-{
- int retry, ix, nbytes;
- int result = N_OK;
- u8 crc[2];
- u8 rsp;
-
- /**
- * Data
- **/
- ix = 0;
- do {
- if (sz <= DATA_PKT_SZ)
- nbytes = sz;
- else
- nbytes = DATA_PKT_SZ;
-
- /**
- * Data Respnose header
- **/
- retry = 10;
- do {
- if (!linux_spi_read(&rsp, 1)) {
- PRINT_ER("[wilc spi]: Failed data response read, bus error...\n");
- result = N_FAIL;
- break;
- }
- if (((rsp >> 4) & 0xf) == 0xf)
- break;
- } while (retry--);
-
- if (result == N_FAIL)
- break;
-
- if (retry <= 0) {
- PRINT_ER("[wilc spi]: Failed data response read...(%02x)\n", rsp);
- result = N_FAIL;
- break;
- }
-
- /**
- * Read bytes
- **/
- if (!linux_spi_read(&b[ix], nbytes)) {
- PRINT_ER("[wilc spi]: Failed data block read, bus error...\n");
- result = N_FAIL;
- break;
- }
-
- /**
- * Read Crc
- **/
- if (!g_spi.crc_off) {
- if (!linux_spi_read(crc, 2)) {
- PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n");
- result = N_FAIL;
- break;
- }
- }
-
- ix += nbytes;
- sz -= nbytes;
-
- } while (sz);
-
- return result;
-}
-
static int spi_data_write(u8 *b, u32 sz)
{
int ix, nbytes;
@@ -706,7 +481,7 @@
order = 0x2;
}
cmd |= order;
- if (!linux_spi_write(&cmd, 1)) {
+ if (!wilc_spi_write(&cmd, 1)) {
PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n");
result = N_FAIL;
break;
@@ -715,7 +490,7 @@
/**
* Write data
**/
- if (!linux_spi_write(&b[ix], nbytes)) {
+ if (!wilc_spi_write(&b[ix], nbytes)) {
PRINT_ER("[wilc spi]: Failed data block write, bus error...\n");
result = N_FAIL;
break;
@@ -725,7 +500,7 @@
* Write Crc
**/
if (!g_spi.crc_off) {
- if (!linux_spi_write(crc, 2)) {
+ if (!wilc_spi_write(crc, 2)) {
PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n");
result = N_FAIL;
break;
@@ -810,7 +585,7 @@
return result;
}
-static int wilc_spi_write(u32 addr, u8 *buf, u32 size)
+static int _wilc_spi_write(u32 addr, u8 *buf, u32 size)
{
int result;
u8 cmd = CMD_DMA_EXT_WRITE;
@@ -864,7 +639,7 @@
return 1;
}
-static int wilc_spi_read(u32 addr, u8 *buf, u32 size)
+static int _wilc_spi_read(u32 addr, u8 *buf, u32 size)
{
u8 cmd = CMD_DMA_EXT_READ;
int result;
@@ -900,7 +675,7 @@
return 1;
}
-static int wilc_spi_deinit(void *pv)
+static int _wilc_spi_deinit(void *pv)
{
/**
* TODO:
@@ -946,7 +721,7 @@
return 1;
}
-static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func)
+static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func)
{
u32 reg;
u32 chipid;
@@ -965,7 +740,7 @@
memset(&g_spi, 0, sizeof(wilc_spi_t));
g_spi.dPrint = func;
- if (!linux_spi_init()) {
+ if (!wilc_spi_init()) {
PRINT_ER("[wilc spi]: Failed io init bus...\n");
return 0;
} else {
@@ -1020,7 +795,7 @@
static void wilc_spi_max_bus_speed(void)
{
- linux_spi_set_max_speed();
+ wilc_spi_set_max_speed();
}
static void wilc_spi_default_bus_speed(void)
@@ -1246,21 +1021,21 @@
* Global spi HIF function table
*
********************************************/
-struct wilc_hif_func hif_spi = {
- wilc_spi_init,
- wilc_spi_deinit,
- wilc_spi_read_reg,
- wilc_spi_write_reg,
- wilc_spi_read,
- wilc_spi_write,
- wilc_spi_sync,
- wilc_spi_clear_int,
- wilc_spi_read_int,
- wilc_spi_clear_int_ext,
- wilc_spi_read_size,
- wilc_spi_write,
- wilc_spi_read,
- wilc_spi_sync_ext,
- wilc_spi_max_bus_speed,
- wilc_spi_default_bus_speed,
+const struct wilc_hif_func wilc_hif_spi = {
+ .hif_init = _wilc_spi_init,
+ .hif_deinit = _wilc_spi_deinit,
+ .hif_read_reg = wilc_spi_read_reg,
+ .hif_write_reg = wilc_spi_write_reg,
+ .hif_block_rx = _wilc_spi_read,
+ .hif_block_tx = _wilc_spi_write,
+ .hif_sync = wilc_spi_sync,
+ .hif_clear_int = wilc_spi_clear_int,
+ .hif_read_int = wilc_spi_read_int,
+ .hif_clear_int_ext = wilc_spi_clear_int_ext,
+ .hif_read_size = wilc_spi_read_size,
+ .hif_block_tx_ext = _wilc_spi_write,
+ .hif_block_rx_ext = _wilc_spi_read,
+ .hif_sync_ext = wilc_spi_sync_ext,
+ .hif_set_max_bus_speed = wilc_spi_max_bus_speed,
+ .hif_set_default_bus_speed = wilc_spi_default_bus_speed,
};
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6f40522..cc279c6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,28 +11,108 @@
*/
#include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
+#include "host_interface.h"
#include <linux/errno.h>
+/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
+#define NO_ENCRYPT 0
+#define ENCRYPT_ENABLED BIT(0)
+#define WEP BIT(1)
+#define WEP_EXTENDED BIT(2)
+#define WPA BIT(3)
+#define WPA2 BIT(4)
+#define AES BIT(5)
+#define TKIP BIT(6)
+
+/*Public action frame index IDs*/
+#define FRAME_TYPE_ID 0
+#define ACTION_CAT_ID 24
+#define ACTION_SUBTYPE_ID 25
+#define P2P_PUB_ACTION_SUBTYPE 30
+
+/*Public action frame Attribute IDs*/
+#define ACTION_FRAME 0xd0
+#define GO_INTENT_ATTR_ID 0x04
+#define CHANLIST_ATTR_ID 0x0b
+#define OPERCHAN_ATTR_ID 0x11
+#define PUB_ACTION_ATTR_ID 0x04
+#define P2PELEM_ATTR_ID 0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF 0x02
+#define P2P_INV_REQ 0x03
+#define P2P_INV_RSP 0x04
+#define PUBLIC_ACT_VENDORSPEC 0x09
+#define GAS_INTIAL_REQ 0x0a
+#define GAS_INTIAL_RSP 0x0b
+
+#define INVALID_CHANNEL 0
+
+#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
+#define SCAN_RESULT_EXPIRE (40 * HZ)
+
+static const u32 cipher_suites[] = {
+ WLAN_CIPHER_SUITE_WEP40,
+ WLAN_CIPHER_SUITE_WEP104,
+ WLAN_CIPHER_SUITE_TKIP,
+ WLAN_CIPHER_SUITE_CCMP,
+ WLAN_CIPHER_SUITE_AES_CMAC,
+};
+
+static const struct ieee80211_txrx_stypes
+ wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+ [NL80211_IFTYPE_STATION] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+ },
+ [NL80211_IFTYPE_AP] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4)
+ },
+ [NL80211_IFTYPE_P2P_CLIENT] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4)
+ }
+};
+
+/* Time to stay on the channel */
+#define WILC_WFI_DWELL_PASSIVE 100
+#define WILC_WFI_DWELL_ACTIVE 40
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
+#define DEFAULT_LINK_SPEED 72
+
+
#define IS_MANAGMEMENT 0x100
#define IS_MANAGMEMENT_CALLBACK 0x080
#define IS_MGMT_STATUS_SUCCES 0x040
#define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
-extern int mac_open(struct net_device *ndev);
-extern int mac_close(struct net_device *ndev);
+extern int wilc_mac_open(struct net_device *ndev);
+extern int wilc_mac_close(struct net_device *ndev);
-tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
-u32 u32LastScannedNtwrksCountShadow;
-struct timer_list hDuringIpTimer;
-struct timer_list hAgingTimer;
+static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
+static u32 u32LastScannedNtwrksCountShadow;
+struct timer_list wilc_during_ip_timer;
+static struct timer_list hAgingTimer;
static u8 op_ifcs;
-extern u8 u8ConnectedSSID[6];
-u8 g_wilc_initialized = 1;
-extern bool g_obtainingIP;
+u8 wilc_initialized = 1;
#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
@@ -90,15 +170,15 @@
};
/*Global variable used to state the current connected STA channel*/
-u8 u8WLANChannel = INVALID_CHANNEL;
+static u8 u8WLANChannel = INVALID_CHANNEL;
-u8 curr_channel;
+static u8 curr_channel;
-u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
-u8 u8P2Plocalrandom = 0x01;
-u8 u8P2Precvrandom = 0x00;
-u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
-bool bWilc_ie;
+static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09};
+static u8 u8P2Plocalrandom = 0x01;
+static u8 u8P2Precvrandom = 0x00;
+static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03};
+static bool bWilc_ie;
static struct ieee80211_supported_band WILC_WFI_band_2ghz = {
.channels = WILC_WFI_2ghz_channels,
@@ -113,19 +193,19 @@
bool pairwise;
u8 *mac_addr;
};
-struct add_key_params g_add_gtk_key_params;
-struct wilc_wfi_key g_key_gtk_params;
-struct add_key_params g_add_ptk_key_params;
-struct wilc_wfi_key g_key_ptk_params;
-struct wilc_wfi_wep_key g_key_wep_params;
-bool g_ptk_keys_saved;
-bool g_gtk_keys_saved;
-bool g_wep_keys_saved;
+static struct add_key_params g_add_gtk_key_params;
+static struct wilc_wfi_key g_key_gtk_params;
+static struct add_key_params g_add_ptk_key_params;
+static struct wilc_wfi_key g_key_ptk_params;
+static struct wilc_wfi_wep_key g_key_wep_params;
+static bool g_ptk_keys_saved;
+static bool g_gtk_keys_saved;
+static bool g_wep_keys_saved;
#define AGING_TIME (9 * 1000)
#define duringIP_TIME 15000
-void clear_shadow_scan(void *pUserVoid)
+static void clear_shadow_scan(void *pUserVoid)
{
int i;
@@ -139,7 +219,7 @@
astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL;
}
- host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams);
+ wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
astrLastScannedNtwrksShadow[i].pJoinParams = NULL;
}
u32LastScannedNtwrksCountShadow = 0;
@@ -147,7 +227,7 @@
}
-u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
+static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo)
{
u8 i;
int rssi_v = 0;
@@ -160,7 +240,7 @@
return rssi_v;
}
-void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
+static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan)
{
struct wilc_priv *priv;
struct wiphy *wiphy;
@@ -200,7 +280,7 @@
}
-void reset_shadow_found(void *pUserVoid)
+static void reset_shadow_found(void *pUserVoid)
{
int i;
@@ -210,7 +290,7 @@
}
}
-void update_scan_time(void *pUserVoid)
+static void update_scan_time(void *pUserVoid)
{
int i;
@@ -232,7 +312,7 @@
kfree(astrLastScannedNtwrksShadow[i].pu8IEs);
astrLastScannedNtwrksShadow[i].pu8IEs = NULL;
- host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams);
+ wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams);
for (j = i; (j < u32LastScannedNtwrksCountShadow - 1); j++) {
astrLastScannedNtwrksShadow[j] = astrLastScannedNtwrksShadow[j + 1];
@@ -253,10 +333,10 @@
static void clear_duringIP(unsigned long arg)
{
PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n");
- g_obtainingIP = false;
+ wilc_optaining_ip = false;
}
-int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
+static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid)
{
int state = -1;
int i;
@@ -279,7 +359,7 @@
return state;
}
-void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
+static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams)
{
int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid);
u32 ap_index = 0;
@@ -331,7 +411,7 @@
astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScanCached = jiffies;
astrLastScannedNtwrksShadow[ap_index].u8Found = 1;
if (ap_found != -1)
- host_int_freeJoinParams(astrLastScannedNtwrksShadow[ap_index].pJoinParams);
+ wilc_free_join_params(astrLastScannedNtwrksShadow[ap_index].pJoinParams);
astrLastScannedNtwrksShadow[ap_index].pJoinParams = pJoinParams;
}
@@ -471,42 +551,6 @@
/**
- * @brief WILC_WFI_Set_PMKSA
- * @details Check if pmksa is cached and set it.
- * @param[in]
- * @return int : Return 0 on Success
- * @author mdaftedar
- * @date 01 MAR 2012
- * @version 1.0
- */
-int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv)
-{
- u32 i;
- s32 s32Error = 0;
-
-
- for (i = 0; i < priv->pmkid_list.numpmkid; i++) {
-
- if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid,
- ETH_ALEN)) {
- PRINT_D(CFG80211_DBG, "PMKID successful comparison");
-
- /*If bssid is found, set the values*/
- s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
-
- if (s32Error != 0)
- PRINT_ER("Error in pmkid\n");
-
- break;
- }
- }
-
- return s32Error;
-
-
-}
-
-/**
* @brief CfgConnectResult
* @details
* @param[in] tenuConnDisconnEvent enuConnDisconnEvent: Type of connection response either
@@ -520,7 +564,7 @@
* @date 01 MAR 2012
* @version 1.0
*/
-int connecting;
+int wilc_connecting;
static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
tstrConnectInfo *pstrConnectInfo,
@@ -535,7 +579,7 @@
struct wilc *wl;
perInterface_wlan_t *nic;
- connecting = 0;
+ wilc_connecting = 0;
priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
@@ -556,8 +600,8 @@
/* The case here is that our station was waiting for association response frame and has just received it containing status code
* = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */
u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
- linux_wlan_set_bssid(priv->dev, NullBssid);
- eth_zero_addr(u8ConnectedSSID);
+ wilc_wlan_set_bssid(priv->dev, NullBssid);
+ eth_zero_addr(wilc_connected_SSID);
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->p2p_connect)
@@ -608,15 +652,15 @@
u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */
/* be replaced by pstrConnectInfo->u16ConnectStatus */
} else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) {
- g_obtainingIP = false;
+ wilc_optaining_ip = false;
PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n",
pstrDisconnectNotifInfo->u16reason, priv->dev);
u8P2Plocalrandom = 0x01;
u8P2Precvrandom = 0x00;
bWilc_ie = false;
eth_zero_addr(priv->au8AssociatedBss);
- linux_wlan_set_bssid(priv->dev, NullBssid);
- eth_zero_addr(u8ConnectedSSID);
+ wilc_wlan_set_bssid(priv->dev, NullBssid);
+ eth_zero_addr(wilc_connected_SSID);
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
if (!pstrWFIDrv->p2p_connect)
@@ -666,7 +710,7 @@
PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq);
curr_channel = channelnum;
- result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
+ result = wilc_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum);
if (result != 0)
PRINT_ER("Error in setting channel %d\n", channelnum);
@@ -701,7 +745,7 @@
priv->u32RcvdChCount = 0;
- host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
reset_shadow_found(priv);
@@ -738,13 +782,13 @@
}
}
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, &strHiddenNetwork);
} else {
PRINT_D(CFG80211_DBG, "Trigger Scan Request\n");
- s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
+ s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN,
au8ScanChanList, request->n_channels,
(const u8 *)request->ie, request->ie_len,
CfgScanResult, (void *)priv, NULL);
@@ -791,11 +835,11 @@
tstrNetworkInfo *pstrNetworkInfo = NULL;
- connecting = 1;
+ wilc_connecting = 1;
priv = wiphy_priv(wiphy);
pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
- host_int_set_wfi_drv_handler(priv->hWILCWFIDrv);
+ wilc_set_wfi_drv_handler(priv->hWILCWFIDrv);
PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -888,8 +932,8 @@
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;
- host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx);
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
+ wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
pcgroup_encrypt_val = "WEP104";
@@ -905,8 +949,8 @@
g_key_wep_params.key_idx = sme->key_idx;
g_wep_keys_saved = true;
- host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx);
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
+ wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx);
+ wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) {
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
@@ -997,15 +1041,15 @@
if (!pstrWFIDrv->p2p_connect)
u8WLANChannel = pstrNetworkInfo->u8channel;
- linux_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
+ wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid);
- s32Error = host_int_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
+ s32Error = wilc_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
CfgConnectResult, (void *)priv, u8security,
tenuAuth_type, pstrNetworkInfo->u8channel,
pstrNetworkInfo->pJoinParams);
if (s32Error != 0) {
- PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error);
+ PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error);
s32Error = -ENOENT;
goto done;
}
@@ -1032,14 +1076,14 @@
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
- connecting = 0;
+ wilc_connecting = 0;
priv = wiphy_priv(wiphy);
/*Invalidate u8WLANChannel value on wlan0 disconnect*/
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
if (!pstrWFIDrv->p2p_connect)
u8WLANChannel = INVALID_CHANNEL;
- linux_wlan_set_bssid(priv->dev, NullBssid);
+ wilc_wlan_set_bssid(priv->dev, NullBssid);
PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code);
@@ -1048,7 +1092,7 @@
bWilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;
- s32Error = host_int_disconnect(priv->hWILCWFIDrv, reason_code);
+ s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code);
if (s32Error != 0) {
PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error);
s32Error = -EINVAL;
@@ -1119,7 +1163,7 @@
else
u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
- host_int_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
+ wilc_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type);
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) {
@@ -1133,7 +1177,7 @@
for (i = 0; i < params->key_len; i++)
PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]);
}
- host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
+ wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index);
}
break;
@@ -1196,7 +1240,7 @@
}
- host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode);
} else {
@@ -1241,7 +1285,7 @@
priv->wilc_ptk[key_index]->key_len = params->key_len;
priv->wilc_ptk[key_index]->seq_len = params->seq_len;
- host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index);
}
break;
@@ -1283,7 +1327,7 @@
g_gtk_keys_saved = true;
}
- host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
+ wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen,
key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode);
} else {
if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) {
@@ -1319,7 +1363,7 @@
g_ptk_keys_saved = true;
}
- host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
+ wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr,
pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index);
PRINT_D(CFG80211_DBG, "Adding pairwise key\n");
if (INFO) {
@@ -1408,7 +1452,7 @@
g_key_gtk_params.seq = NULL;
/*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/
- set_machw_change_vir_if(netdev, false);
+ wilc_set_machw_change_vir_if(netdev, false);
}
if (key_index >= 0 && key_index <= 3) {
@@ -1416,10 +1460,10 @@
priv->WILC_WFI_wep_key_len[key_index] = 0;
PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index);
- host_int_remove_wep_key(priv->hWILCWFIDrv, key_index);
+ wilc_remove_wep_key(priv->hWILCWFIDrv, key_index);
} else {
PRINT_D(CFG80211_DBG, "Removing all installed keys\n");
- host_int_remove_key(priv->hWILCWFIDrv, mac_addr);
+ wilc_remove_key(priv->hWILCWFIDrv, mac_addr);
}
return 0;
@@ -1497,7 +1541,7 @@
if (key_index != priv->WILC_WFI_wep_default) {
- host_int_set_wep_default_key(priv->hWILCWFIDrv, key_index);
+ wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index);
}
return 0;
@@ -1545,7 +1589,7 @@
sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
- host_int_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
+ wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time));
sinfo->inactive_time = 1000 * inactive_time;
PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time);
@@ -1554,7 +1598,7 @@
if (nic->iftype == STATION_MODE) {
struct rf_info strStatistics;
- host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics);
+ wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics);
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1570,9 +1614,9 @@
if ((strStatistics.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) &&
(strStatistics.link_speed != DEFAULT_LINK_SPEED))
- enable_tcp_ack_filter(true);
+ wilc_enable_tcp_ack_filter(true);
else if (strStatistics.link_speed != DEFAULT_LINK_SPEED)
- enable_tcp_ack_filter(false);
+ wilc_enable_tcp_ack_filter(false);
PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets,
sinfo->tx_failed, sinfo->txrate.legacy);
@@ -1659,7 +1703,7 @@
}
PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n");
- s32Error = hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
+ s32Error = wilc_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal);
if (s32Error)
PRINT_ER("Error in setting WIPHY PARAMS\n");
@@ -1714,7 +1758,7 @@
if (!s32Error) {
PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n");
- s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
+ s32Error = wilc_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list);
}
return s32Error;
}
@@ -1802,7 +1846,7 @@
* @version
*/
-void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
+static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
{
u32 index = 0;
u32 i = 0, j = 0;
@@ -1854,7 +1898,7 @@
* @date 12 DEC 2012
* @version
*/
-void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
+static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype)
{
u32 index = 0;
u32 i = 0, j = 0;
@@ -2137,7 +2181,7 @@
priv->strRemainOnChanParams.u32ListenDuration = duration;
priv->strRemainOnChanParams.u32ListenSessionID++;
- s32Error = host_int_remain_on_channel(priv->hWILCWFIDrv
+ s32Error = wilc_remain_on_channel(priv->hWILCWFIDrv
, priv->strRemainOnChanParams.u32ListenSessionID
, duration
, chan->hw_value
@@ -2172,7 +2216,7 @@
PRINT_D(CFG80211_DBG, "Cancel remain on channel\n");
- s32Error = host_int_ListenStateExpired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
+ s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID);
return s32Error;
}
/**
@@ -2185,7 +2229,6 @@
* @date 01 JUL 2012
* @version
*/
-extern bool bEnablePS;
static int mgmt_tx(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_mgmt_tx_params *params,
@@ -2232,7 +2275,7 @@
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
PRINT_D(GENERIC_DBG, "TX: Probe Response\n");
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
curr_channel = chan->hw_value;
} else if (ieee80211_is_action(mgmt->frame_control)) {
@@ -2247,7 +2290,7 @@
if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC ||
buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) {
PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value);
- host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
+ wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value);
/*Save the current channel after we tune to it*/
curr_channel = chan->hw_value;
}
@@ -2419,7 +2462,7 @@
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
- host_int_frame_register(priv->hWILCWFIDrv, frame_type, reg);
+ wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg);
}
@@ -2470,7 +2513,7 @@
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
- host_int_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
+ wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal));
return 0;
@@ -2502,8 +2545,8 @@
return -EIO;
}
- if (bEnablePS)
- host_int_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
+ if (wilc_enable_ps)
+ wilc_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout);
return 0;
@@ -2520,8 +2563,6 @@
* @date 01 MAR 2012
* @version 1.0
*/
-int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
-
static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
{
@@ -2543,17 +2584,17 @@
bWilc_ie = false;
- g_obtainingIP = false;
- del_timer(&hDuringIpTimer);
+ wilc_optaining_ip = false;
+ del_timer(&wilc_during_ip_timer);
PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n");
/*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
- set_machw_change_vir_if(dev, true);
+ wilc_set_machw_change_vir_if(dev, true);
}
switch (type) {
case NL80211_IFTYPE_STATION:
- connecting = 0;
+ wilc_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n");
/* send delba over wlan interface */
@@ -2570,30 +2611,30 @@
nic->iftype = STATION_MODE;
if (wl->initialized) {
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].bssid, TID);
+ wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
+ wilc_wait_msg_queue_idle();
/*Eliminate host interface blocking state*/
up(&wl->cfg_event);
wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc_initialized = 1;
nic->iftype = interface_type;
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
- host_int_set_MacAddress(wl->vif[0].hif_drv,
+ wilc_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ wilc_set_mac_address(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
- host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_wep_default_key(wl->vif[0].hif_drv,
+ wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
+ wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2601,7 +2642,7 @@
/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(priv->hWILCWFIDrv);
/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2630,25 +2671,25 @@
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
}
- bEnablePS = true;
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
+ wilc_enable_ps = true;
+ wilc_set_power_mgmt(priv->hWILCWFIDrv, 1, 0);
}
break;
case NL80211_IFTYPE_P2P_CLIENT:
- bEnablePS = false;
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
- connecting = 0;
+ wilc_enable_ps = false;
+ wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+ wilc_connecting = 0;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n");
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].bssid, TID);
+ wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2660,30 +2701,30 @@
if (wl->initialized) {
/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
+ wilc_wait_msg_queue_idle();
wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc_initialized = 1;
- host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
- host_int_set_MacAddress(wl->vif[0].hif_drv,
+ wilc_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ wilc_set_mac_address(wl->vif[0].hif_drv,
wl->vif[0].src_addr);
- host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
+ wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_wep_default_key(wl->vif[0].hif_drv,
- g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
- g_key_wep_params.key,
- g_key_wep_params.key_len,
- g_key_wep_params.key_idx);
+ wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
+ g_key_wep_params.key_idx);
+ wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv,
+ g_key_wep_params.key,
+ g_key_wep_params.key_len,
+ g_key_wep_params.key_idx);
}
/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(priv->hWILCWFIDrv);
/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2710,13 +2751,13 @@
/*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/
refresh_scan(priv, 1, true);
- set_machw_change_vir_if(dev, false);
+ wilc_set_machw_change_vir_if(dev, false);
if (wl->initialized) {
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2725,7 +2766,7 @@
break;
case NL80211_IFTYPE_AP:
- bEnablePS = false;
+ wilc_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_AP %d\n", type);
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2733,17 +2774,17 @@
PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);
PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
- linux_wlan_get_firmware(dev);
+ wilc_wlan_get_firmware(dev);
/*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
if (wl->initialized) {
nic->iftype = AP_MODE;
- mac_close(dev);
- mac_open(dev);
+ wilc_mac_close(dev);
+ wilc_mac_open(dev);
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2753,16 +2794,16 @@
case NL80211_IFTYPE_P2P_GO:
PRINT_D(GENERIC_DBG, "start duringIP timer\n");
- g_obtainingIP = true;
- mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME));
- host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
+ wilc_optaining_ip = true;
+ mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(duringIP_TIME));
+ wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0);
/*Delete block ack has to be the latest config packet*/
/*sent before downloading new FW. This is because it blocks on*/
/*hWaitResponse semaphore, which allows previous config*/
/*packets to actually take action on old FW*/
- host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
- wl->vif[0].bssid, TID);
- bEnablePS = false;
+ wilc_del_all_rx_ba_session(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
+ wilc_enable_ps = false;
PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n");
dev->ieee80211_ptr->iftype = type;
priv->wdev->iftype = type;
@@ -2775,23 +2816,23 @@
nic->iftype = GO_MODE;
/* ensure that the message Q is empty */
- host_int_wait_msg_queue_idle();
+ wilc_wait_msg_queue_idle();
wilc1000_wlan_deinit(dev);
wilc1000_wlan_init(dev, nic);
- g_wilc_initialized = 1;
+ wilc_initialized = 1;
/*Setting interface 1 drv handler and mac address in newly downloaded FW*/
- host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
- host_int_set_MacAddress(wl->vif[0].hif_drv,
- wl->vif[0].src_addr);
- host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
+ wilc_set_wfi_drv_handler(wl->vif[0].hif_drv);
+ wilc_set_mac_address(wl->vif[0].hif_drv,
+ wl->vif[0].src_addr);
+ wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE);
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
- host_int_set_wep_default_key(wl->vif[0].hif_drv,
- g_key_wep_params.key_idx);
- host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
+ wilc_set_wep_default_keyid(wl->vif[0].hif_drv,
+ g_key_wep_params.key_idx);
+ wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv,
g_key_wep_params.key,
g_key_wep_params.key_len,
g_key_wep_params.key_idx);
@@ -2799,7 +2840,7 @@
/*No matter the driver handler passed here, it will be overwriiten*/
/*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/
- host_int_flush_join_req(priv->hWILCWFIDrv);
+ wilc_flush_join_req(priv->hWILCWFIDrv);
/*Add saved PTK and GTK keys, if any*/
if (g_ptk_keys_saved && g_gtk_keys_saved) {
@@ -2830,7 +2871,7 @@
for (i = 0; i < num_reg_frame; i++) {
PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
- host_int_frame_register(priv->hWILCWFIDrv,
+ wilc_frame_register(priv->hWILCWFIDrv,
nic->g_struct_frame_reg[i].frame_type,
nic->g_struct_frame_reg[i].reg);
}
@@ -2893,9 +2934,9 @@
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
- linux_wlan_set_bssid(dev, wl->vif[0].src_addr);
+ wilc_wlan_set_bssid(dev, wl->vif[0].src_addr);
- s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
settings->dtim_period,
beacon->head_len, (u8 *)beacon->head,
@@ -2926,7 +2967,7 @@
PRINT_D(HOSTAPD_DBG, "Setting beacon\n");
- s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
+ s32Error = wilc_add_beacon(priv->hWILCWFIDrv,
0,
0,
beacon->head_len, (u8 *)beacon->head,
@@ -2957,9 +2998,9 @@
PRINT_D(HOSTAPD_DBG, "Deleting beacon\n");
- linux_wlan_set_bssid(dev, NullBssid);
+ wilc_wlan_set_bssid(dev, NullBssid);
- s32Error = host_int_del_beacon(priv->hWILCWFIDrv);
+ s32Error = wilc_del_beacon(priv->hWILCWFIDrv);
if (s32Error)
PRINT_ER("Host delete beacon fail\n");
@@ -3039,7 +3080,7 @@
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);
- s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc_add_station(priv->hWILCWFIDrv, &strStaParams);
if (s32Error)
PRINT_ER("Host add station fail\n");
}
@@ -3076,12 +3117,12 @@
if (mac == NULL) {
PRINT_D(HOSTAPD_DBG, "All associated stations\n");
- s32Error = host_int_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
+ s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss);
} else {
PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
- s32Error = host_int_del_station(priv->hWILCWFIDrv, mac);
+ s32Error = wilc_del_station(priv->hWILCWFIDrv, mac);
if (s32Error)
PRINT_ER("Host delete station fail\n");
@@ -3163,7 +3204,7 @@
PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n",
strStaParams.flags_set);
- s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams);
+ s32Error = wilc_edit_station(priv->hWILCWFIDrv, &strStaParams);
if (s32Error)
PRINT_ER("Host edit station fail\n");
}
@@ -3321,7 +3362,7 @@
* @date 01 MAR 2012
* @version 1.0
*/
-struct wireless_dev *WILC_WFI_CfgAlloc(void)
+static struct wireless_dev *WILC_WFI_CfgAlloc(void)
{
struct wireless_dev *wdev;
@@ -3370,7 +3411,7 @@
* @date 01 MAR 2012
* @version 1.0
*/
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
{
struct wilc_priv *priv;
struct wireless_dev *wdev;
@@ -3422,9 +3463,7 @@
wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type,
wdev->wiphy->interface_modes, wdev->iftype);
- #ifdef WILC_SDIO
- set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev);
- #endif
+ set_wiphy_dev(wdev->wiphy, dev);
/*Register wiphy structure*/
s32Error = wiphy_register(wdev->wiphy);
@@ -3460,7 +3499,7 @@
priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) {
setup_timer(&hAgingTimer, remove_network_from_shadow, 0);
- setup_timer(&hDuringIpTimer, clear_duringIP, 0);
+ setup_timer(&wilc_during_ip_timer, clear_duringIP, 0);
}
op_ifcs++;
if (s32Error < 0) {
@@ -3473,7 +3512,7 @@
priv->bInP2PlistenState = false;
sema_init(&(priv->hSemScanReq), 1);
- s32Error = host_int_init(net, &priv->hWILCWFIDrv);
+ s32Error = wilc_init(net, &priv->hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
@@ -3503,13 +3542,13 @@
op_ifcs--;
- s32Error = host_int_deinit(priv->hWILCWFIDrv);
+ s32Error = wilc_deinit(priv->hWILCWFIDrv);
/* Clear the Shadow scan */
clear_shadow_scan(priv);
if (op_ifcs == 0) {
PRINT_D(CORECONFIG_DBG, "destroy during ip\n");
- del_timer_sync(&hDuringIpTimer);
+ del_timer_sync(&wilc_during_ip_timer);
}
if (s32Error)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index d7bdca1..ab53d9d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,88 +10,7 @@
#define NM_WFI_CFGOPERATIONS
#include "wilc_wfi_netdevice.h"
-/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLED BIT(0)
-#define WEP BIT(1)
-#define WEP_EXTENDED BIT(2)
-#define WPA BIT(3)
-#define WPA2 BIT(4)
-#define AES BIT(5)
-#define TKIP BIT(6)
-
-/*Public action frame index IDs*/
-#define FRAME_TYPE_ID 0
-#define ACTION_CAT_ID 24
-#define ACTION_SUBTYPE_ID 25
-#define P2P_PUB_ACTION_SUBTYPE 30
-
-/*Public action frame Attribute IDs*/
-#define ACTION_FRAME 0xd0
-#define GO_INTENT_ATTR_ID 0x04
-#define CHANLIST_ATTR_ID 0x0b
-#define OPERCHAN_ATTR_ID 0x11
-#define PUB_ACTION_ATTR_ID 0x04
-#define P2PELEM_ATTR_ID 0xdd
-
-/*Public action subtype values*/
-#define GO_NEG_REQ 0x00
-#define GO_NEG_RSP 0x01
-#define GO_NEG_CONF 0x02
-#define P2P_INV_REQ 0x03
-#define P2P_INV_RSP 0x04
-#define PUBLIC_ACT_VENDORSPEC 0x09
-#define GAS_INTIAL_REQ 0x0a
-#define GAS_INTIAL_RSP 0x0b
-
-#define INVALID_CHANNEL 0
-
-#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
-#define SCAN_RESULT_EXPIRE (40 * HZ)
-
-static const u32 cipher_suites[] = {
- WLAN_CIPHER_SUITE_WEP40,
- WLAN_CIPHER_SUITE_WEP104,
- WLAN_CIPHER_SUITE_TKIP,
- WLAN_CIPHER_SUITE_CCMP,
- WLAN_CIPHER_SUITE_AES_CMAC,
-};
-
-static const struct ieee80211_txrx_stypes
- wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
- [NL80211_IFTYPE_STATION] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
- },
- [NL80211_IFTYPE_AP] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4) |
- BIT(IEEE80211_STYPE_ACTION >> 4)
- },
- [NL80211_IFTYPE_P2P_CLIENT] = {
- .tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
- BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
- BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
- BIT(IEEE80211_STYPE_DISASSOC >> 4) |
- BIT(IEEE80211_STYPE_AUTH >> 4) |
- BIT(IEEE80211_STYPE_DEAUTH >> 4)
- }
-};
-
-/* Time to stay on the channel */
-#define WILC_WFI_DWELL_PASSIVE 100
-#define WILC_WFI_DWELL_ACTIVE 40
-
-struct wireless_dev *WILC_WFI_CfgAlloc(void);
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
void wilc_free_wiphy(struct net_device *net);
int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
int wilc_deinit_host_int(struct net_device *net);
@@ -102,8 +21,4 @@
void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
u16 frame_type, bool reg);
-#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
-#define DEFAULT_LINK_SPEED 72
-void enable_tcp_ack_filter(bool value);
-
#endif
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 54ed723..6ec6d6a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -156,11 +156,12 @@
};
struct wilc {
+ const struct wilc_hif_func *ops;
+ int io_type;
int mac_status;
+ int gpio;
bool initialized;
- #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
- unsigned short dev_irq_num;
- #endif
+ int dev_irq_num;
int close;
u8 vif_num;
struct wilc_vif vif[NUM_CONCURRENT_IFC];
@@ -184,11 +185,7 @@
const struct firmware *firmware;
-#ifdef WILC_SDIO
- struct sdio_func *wilc_sdio_func;
-#else
- struct spi_device *wilc_spidev;
-#endif
+ struct device *dev;
};
typedef struct {
@@ -206,18 +203,23 @@
struct net_device *real_ndev;
};
-extern struct wilc *g_linux_wlan;
+int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
+
+extern struct wilc *wilc_dev;
extern struct net_device *WILC_WFI_devs[];
-void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
-void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
-void linux_wlan_rx_complete(void);
-void linux_wlan_dbg(u8 *buff);
-int linux_wlan_lock_timeout(void *vp, u32 timeout);
-void wl_wlan_cleanup(struct wilc *wilc);
-int wilc_netdev_init(struct wilc **wilc);
+void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
+void wilc_mac_indicate(struct wilc *wilc, int flag);
+void wilc_rx_complete(struct wilc *wilc);
+void wilc_dbg(struct wilc *, u8 *buff);
+
+int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout);
+void wilc_netdev_cleanup(struct wilc *wilc);
+int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
+ const struct wilc_hif_func *ops);
void wilc1000_wlan_deinit(struct net_device *dev);
void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
-u16 set_machw_change_vir_if(struct net_device *dev, bool value);
-int linux_wlan_get_firmware(struct net_device *dev);
-int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid);
+u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value);
+int wilc_wlan_get_firmware(struct net_device *dev);
+int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid);
+
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 9d257b0..df8503f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1,17 +1,11 @@
#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
#include "wilc_wfi_netdevice.h"
#include "wilc_wlan_cfg.h"
-#ifdef WILC_SDIO
-extern struct wilc_hif_func hif_sdio;
-#else
-extern struct wilc_hif_func hif_spi;
-#endif
-u32 wilc_get_chipid(u8 update);
-
typedef struct {
int quit;
- wilc_wlan_io_func_t io_func;
+ int io_type;
struct wilc_hif_func hif_func;
int cfg_frame_in_use;
struct wilc_cfg_frame cfg_frame;
@@ -40,10 +34,13 @@
static wilc_wlan_dev_t g_wlan;
+#ifdef WILC_OPTIMIZE_SLEEP_INT
static inline void chip_allow_sleep(void);
+#endif
static inline void chip_wakeup(void);
static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
+/* FIXME: replace with dev_debug() */
static void wilc_debug(u32 flag, char *fmt, ...)
{
char buf[256];
@@ -54,15 +51,15 @@
vsprintf(buf, fmt, args);
va_end(args);
- linux_wlan_dbg(buf);
+ wilc_dbg(wilc_dev, buf);
}
}
static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP;
-static inline void acquire_bus(BUS_ACQUIRE_T acquire)
+static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
{
- mutex_lock(&g_linux_wlan->hif_cs);
+ mutex_lock(&wilc->hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (chip_ps_state != CHIP_WAKEDUP)
#endif
@@ -72,15 +69,16 @@
}
}
-static inline void release_bus(BUS_RELEASE_T release)
+static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
{
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
- mutex_unlock(&g_linux_wlan->hif_cs);
+ mutex_unlock(&wilc->hif_cs);
}
+#ifdef TCP_ACK_FILTER
static void wilc_wlan_txq_remove(struct txq_entry_t *tqe)
{
wilc_wlan_dev_t *p = &g_wlan;
@@ -99,6 +97,7 @@
}
p->txq_entries -= 1;
}
+#endif
static struct txq_entry_t *
wilc_wlan_txq_remove_from_head(struct net_device *dev)
@@ -161,15 +160,15 @@
up(&wilc->txq_event);
}
-static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
+static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe)
{
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs,
+ if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT))
return -1;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
if (!p->txq_head) {
tqe->next = NULL;
@@ -185,16 +184,14 @@
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
- up(&g_linux_wlan->txq_add_to_head_cs);
- up(&g_linux_wlan->txq_event);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
+ up(&wilc->txq_add_to_head_cs);
+ up(&wilc->txq_event);
PRINT_D(TX_DBG, "Wake up the txq_handler\n");
return 0;
}
-u32 total_acks = 0, dropped_acks = 0;
-
#ifdef TCP_ACK_FILTER
struct ack_session_info;
struct ack_session_info {
@@ -211,16 +208,17 @@
struct txq_entry_t *txqe;
};
+
#define NOT_TCP_ACK (-1)
#define MAX_TCP_SESSION 25
#define MAX_PENDING_ACKS 256
-struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION];
-struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS];
+static struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION];
+static struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS];
-u32 pending_base;
-u32 tcp_session;
-u32 pending_acks;
+static u32 pending_base;
+static u32 tcp_session;
+static u32 pending_acks;
static inline int init_tcp_tracking(void)
{
@@ -249,7 +247,6 @@
static inline int add_tcp_pending_ack(u32 ack, u32 session_index,
struct txq_entry_t *txqe)
{
- total_acks++;
if (pending_acks < MAX_PENDING_ACKS) {
pending_acks_info[pending_base + pending_acks].ack_num = ack;
pending_acks_info[pending_base + pending_acks].txqe = txqe;
@@ -259,14 +256,14 @@
}
return 0;
}
-static inline int remove_TCP_related(void)
+static inline int remove_TCP_related(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
unsigned long flags;
- spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags);
+ spin_lock_irqsave(&wilc->txq_spinlock, flags);
- spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags);
+ spin_unlock_irqrestore(&wilc->txq_spinlock, flags);
return 0;
}
@@ -285,7 +282,6 @@
nic = netdev_priv(dev);
wilc = nic->wilc;
- spin_lock_irqsave(&wilc->txq_spinlock, flags);
eth_hdr_ptr = &buffer[0];
h_proto = ntohs(*((unsigned short *)ð_hdr_ptr[12]));
@@ -361,7 +357,6 @@
tqe = pending_acks_info[i].txqe;
if (tqe) {
wilc_wlan_txq_remove(tqe);
- dropped_acks++;
tqe->status = 1;
if (tqe->tx_complete_func)
tqe->tx_complete_func(tqe->priv,
@@ -382,7 +377,7 @@
spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags);
while (dropped > 0) {
- linux_wlan_lock_timeout(&wilc->txq_event, 1);
+ wilc_lock_timeout(wilc, &wilc->txq_event, 1);
dropped--;
}
@@ -390,19 +385,21 @@
}
#endif
-bool enabled = false;
+static bool enabled = false;
-void enable_tcp_ack_filter(bool value)
+void wilc_enable_tcp_ack_filter(bool value)
{
enabled = value;
}
-bool is_tcp_ack_filter_enabled(void)
+#ifdef TCP_ACK_FILTER
+static bool is_tcp_ack_filter_enabled(void)
{
return enabled;
}
+#endif
-static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size)
{
wilc_wlan_dev_t *p = &g_wlan;
struct txq_entry_t *tqe;
@@ -410,7 +407,7 @@
PRINT_D(TX_DBG, "Adding config packet ...\n");
if (p->quit) {
PRINT_D(TX_DBG, "Return due to clear function\n");
- up(&g_linux_wlan->cfg_event);
+ up(&wilc->cfg_event);
return 0;
}
@@ -430,7 +427,7 @@
#endif
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
- if (wilc_wlan_txq_add_to_head(tqe))
+ if (wilc_wlan_txq_add_to_head(wilc, tqe))
return 0;
return 1;
}
@@ -579,7 +576,7 @@
u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;
- if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+ if ((g_wlan.io_type & 0x1) == HIF_SPI) {
do {
g_wlan.hif_func.hif_read_reg(1, ®);
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
@@ -593,7 +590,7 @@
} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
} while (wilc_get_chipid(true) == 0);
- } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) {
+ } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(0xf0, ®);
do {
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
@@ -639,12 +636,12 @@
u32 reg, trials = 0;
do {
- if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) {
+ if ((g_wlan.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, ®);
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
- } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) {
+ } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(0xf0, ®);
g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
@@ -681,11 +678,11 @@
chip_ps_state = CHIP_WAKEDUP;
}
#endif
-void chip_sleep_manually(void)
+void wilc_chip_sleep_manually(void)
{
if (chip_ps_state != CHIP_WAKEDUP)
return;
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc_dev, ACQUIRE_ONLY);
#ifdef WILC_OPTIMIZE_SLEEP_INT
chip_allow_sleep();
@@ -693,7 +690,7 @@
g_wlan.hif_func.hif_write_reg(0x10a8, 1);
chip_ps_state = CHIP_SLEEPING_MANUAL;
- release_bus(RELEASE_ONLY);
+ release_bus(wilc_dev, RELEASE_ONLY);
}
int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
@@ -721,7 +718,7 @@
if (p->quit)
break;
- linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs,
+ wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs,
CFG_PKTS_TIMEOUT);
#ifdef TCP_ACK_FILTER
wilc_wlan_txq_filter_dup_tcp_ack(dev);
@@ -778,7 +775,7 @@
PRINT_D(TX_DBG, "Mark the last entry in VMM table - number of previous entries = %d\n", i);
vmm_table[i] = 0x0;
}
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0;
do {
ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®);
@@ -799,9 +796,9 @@
break;
}
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
}
} while (!p->quit);
@@ -832,9 +829,9 @@
entries = ((reg >> 3) & 0x3f);
break;
} else {
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg);
}
} while (--timeout);
@@ -874,7 +871,7 @@
goto _end_;
}
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
offset = 0;
i = 0;
@@ -929,7 +926,7 @@
}
} while (--entries);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM);
if (!ret) {
@@ -945,7 +942,7 @@
_end_:
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
if (ret != 1)
break;
} while (0);
@@ -1019,7 +1016,7 @@
} else {
if (!is_cfg_packet) {
if (pkt_len > 0) {
- frmw_to_linux(wilc,
+ wilc_frmw_to_linux(wilc,
&buffer[offset],
pkt_len,
pkt_offset);
@@ -1034,10 +1031,10 @@
if (p->cfg_seq_no == rsp.seq_no)
up(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
- linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
+ wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS);
} else if (rsp.type == WILC_CFG_RSP_SCAN) {
- linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN);
+ wilc_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN);
}
}
}
@@ -1051,7 +1048,7 @@
kfree(rqe);
if (has_packet)
- linux_wlan_rx_complete();
+ wilc_rx_complete(wilc);
} while (1);
@@ -1070,7 +1067,10 @@
g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
- mdelay(WILC_PLL_TO);
+ if (g_wlan.io_type == HIF_SDIO)
+ mdelay(WILC_PLL_TO_SDIO);
+ else
+ mdelay(WILC_PLL_TO_SPI);
while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
PRINT_D(TX_DBG, "PLL update retrying\n");
@@ -1157,11 +1157,11 @@
wilc_wlan_handle_rxq(wilc);
}
-void wilc_handle_isr(void *wilc)
+void wilc_handle_isr(struct wilc *wilc)
{
u32 int_status;
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
g_wlan.hif_func.hif_read_int(&int_status);
if (int_status & PLL_INT_EXT)
@@ -1177,15 +1177,13 @@
wilc_sleeptimer_isr_ext(int_status);
if (!(int_status & (ALL_INT_EXT))) {
-#ifdef WILC_SDIO
- PRINT_D(TX_DBG, ">> UNKNOWN_INTERRUPT - 0x%08x\n", int_status);
-#endif
wilc_unknown_isr_ext();
}
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
+EXPORT_SYMBOL_GPL(wilc_handle_isr);
-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
+int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 offset;
@@ -1212,7 +1210,7 @@
addr = BYTE_SWAP(addr);
size = BYTE_SWAP(size);
#endif
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);
offset += 8;
while (((int)size) && (offset < buffer_size)) {
if (size <= blksz)
@@ -1229,7 +1227,7 @@
offset += size2;
size -= size2;
}
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
if (!ret) {
ret = -EIO;
@@ -1248,31 +1246,30 @@
return (ret < 0) ? ret : 0;
}
-int wilc_wlan_start(void)
+int wilc_wlan_start(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0;
int ret;
u32 chipid;
- if (p->io_func.io_type == HIF_SDIO) {
+ if (p->io_type == HIF_SDIO) {
reg = 0;
reg |= BIT(3);
- } else if (p->io_func.io_type == HIF_SPI) {
+ } else if (p->io_type == HIF_SPI) {
reg = 1;
}
- acquire_bus(ACQUIRE_ONLY);
+ acquire_bus(wilc, ACQUIRE_ONLY);
ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
}
reg = 0;
-#ifdef WILC_SDIO_IRQ_GPIO
- reg |= WILC_HAVE_SDIO_IRQ_GPIO;
-#endif
+ if (p->io_type == HIF_SDIO && wilc->dev_irq_num)
+ reg |= WILC_HAVE_SDIO_IRQ_GPIO;
#ifdef WILC_DISABLE_PMU
#else
@@ -1300,7 +1297,7 @@
ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
}
@@ -1310,7 +1307,7 @@
ret = p->hif_func.hif_read_reg(0x1000, &chipid);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
ret = -EIO;
return ret;
}
@@ -1325,32 +1322,32 @@
reg |= BIT(10);
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®);
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
return (ret < 0) ? ret : 0;
}
-void wilc_wlan_global_reset(void)
+void wilc_wlan_global_reset(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
}
-int wilc_wlan_stop(void)
+int wilc_wlan_stop(struct wilc *wilc)
{
wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0;
int ret;
u8 timeout = 10;
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1358,7 +1355,7 @@
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
if (!ret) {
PRINT_ER("Error while writing reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1366,7 +1363,7 @@
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n",
@@ -1384,7 +1381,7 @@
ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n",
@@ -1401,7 +1398,7 @@
ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg);
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
return ret;
}
@@ -1445,24 +1442,24 @@
#endif
kfree(p->tx_buffer);
- acquire_bus(ACQUIRE_AND_WAKEUP);
+ acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, ®);
if (!ret) {
PRINT_ER("Error while reading reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
PRINT_ER("Writing ABORT reg\n");
ret = p->hif_func.hif_write_reg(WILC_GP_REG_0, (reg | ABORT_INT));
if (!ret) {
PRINT_ER("Error while writing reg\n");
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
}
- release_bus(RELEASE_ALLOW_SLEEP);
+ release_bus(wilc, RELEASE_ALLOW_SLEEP);
p->hif_func.hif_deinit(NULL);
}
-static int wilc_wlan_cfg_commit(int type, u32 drv_handler)
+static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
{
wilc_wlan_dev_t *p = &g_wlan;
struct wilc_cfg_frame *cfg = &p->cfg_frame;
@@ -1483,7 +1480,7 @@
cfg->wid_header[7] = (u8)(driver_handler >> 24);
p->cfg_seq_no = seq_no;
- if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len))
+ if (!wilc_wlan_txq_add_cfg_pkt(wilc, &cfg->wid_header[0], total_len))
return -1;
return 0;
@@ -1493,6 +1490,7 @@
int commit, u32 drv_handler)
{
wilc_wlan_dev_t *p = &g_wlan;
+ struct wilc *wilc = wilc_dev;
u32 offset;
int ret_size;
@@ -1514,10 +1512,10 @@
PRINT_D(RX_DBG, "Processing cfg_set()\n");
p->cfg_frame_in_use = 1;
- if (wilc_wlan_cfg_commit(WILC_CFG_SET, drv_handler))
+ if (wilc_wlan_cfg_commit(wilc, WILC_CFG_SET, drv_handler))
ret_size = 0;
- if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ if (wilc_lock_timeout(wilc, &wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Set Timed Out\n");
ret_size = 0;
@@ -1533,6 +1531,7 @@
int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler)
{
wilc_wlan_dev_t *p = &g_wlan;
+ struct wilc *wilc = wilc_dev;
u32 offset;
int ret_size;
@@ -1550,10 +1549,10 @@
if (commit) {
p->cfg_frame_in_use = 1;
- if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drv_handler))
+ if (wilc_wlan_cfg_commit(wilc, WILC_CFG_QUERY, drv_handler))
ret_size = 0;
- if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event,
+ if (wilc_lock_timeout(wilc, &wilc->cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Get Timed Out\n");
ret_size = 0;
@@ -1586,12 +1585,17 @@
g_wlan.hif_func.hif_set_default_bus_speed();
}
-u32 init_chip(struct net_device *dev)
+static u32 init_chip(struct net_device *dev)
{
u32 chipid;
u32 reg, ret = 0;
+ perInterface_wlan_t *nic;
+ struct wilc *wilc;
- acquire_bus(ACQUIRE_ONLY);
+ nic = netdev_priv(dev);
+ wilc = nic->wilc;
+
+ acquire_bus(wilc, ACQUIRE_ONLY);
chipid = wilc_get_chipid(true);
@@ -1614,7 +1618,7 @@
}
}
- release_bus(RELEASE_ONLY);
+ release_bus(wilc, RELEASE_ONLY);
return ret;
}
@@ -1652,7 +1656,7 @@
return chipid;
}
-int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
+int wilc_wlan_init(struct net_device *dev)
{
int ret = 0;
perInterface_wlan_t *nic = netdev_priv(dev);
@@ -1663,24 +1667,12 @@
PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
- memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func,
- sizeof(wilc_wlan_io_func_t));
-
-#ifdef WILC_SDIO
- if (!hif_sdio.hif_init(wilc, wilc_debug)) {
+ g_wlan.io_type = wilc->io_type;
+ g_wlan.hif_func = *wilc->ops;
+ if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
ret = -EIO;
goto _fail_;
}
- memcpy((void *)&g_wlan.hif_func, &hif_sdio,
- sizeof(struct wilc_hif_func));
-#else
- if (!hif_spi.hif_init(wilc, wilc_debug)) {
- ret = -EIO;
- goto _fail_;
- }
- memcpy((void *)&g_wlan.hif_func, &hif_spi,
- sizeof(struct wilc_hif_func));
-#endif
if (!wilc_wlan_cfg_init(wilc_debug)) {
ret = -ENOBUFS;
@@ -1730,7 +1722,7 @@
return ret;
}
-u16 set_machw_change_vir_if(struct net_device *dev, bool value)
+u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
{
u16 ret;
u32 reg;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h
index 64fd019..20bca44 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -1,7 +1,10 @@
#ifndef WILC_WLAN_H
#define WILC_WLAN_H
+#include <linux/types.h>
+
#define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0)
+
/********************************************
*
* Mac eth header length
@@ -131,11 +134,8 @@
#define WILC_CFG_RSP_STATUS 2
#define WILC_CFG_RSP_SCAN 3
-#ifdef WILC_SDIO
-#define WILC_PLL_TO 4
-#else
-#define WILC_PLL_TO 2
-#endif
+#define WILC_PLL_TO_SDIO 4
+#define WILC_PLL_TO_SPI 2
#define ABORT_INT BIT(31)
/*******************************************/
@@ -253,8 +253,13 @@
int (*hif_sync_ext)(int);
void (*hif_set_max_bus_speed)(void);
void (*hif_set_default_bus_speed)(void);
+ int (*enable_interrupt)(struct wilc *nic);
+ void (*disable_interrupt)(struct wilc *nic);
};
+extern const struct wilc_hif_func wilc_hif_spi;
+extern const struct wilc_hif_func wilc_hif_sdio;
+
/********************************************
*
* Configuration Structure
@@ -276,13 +281,15 @@
u32 seq_no;
};
-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
-int wilc_wlan_start(void);
-int wilc_wlan_stop(void);
+struct wilc;
+
+int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size);
+int wilc_wlan_start(struct wilc *);
+int wilc_wlan_stop(struct wilc *);
int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count);
-void wilc_handle_isr(void *wilc);
+void wilc_handle_isr(struct wilc *wilc);
void wilc_wlan_cleanup(struct net_device *dev);
int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
int commit, u32 drv_handler);
@@ -290,5 +297,18 @@
int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
u32 buffer_size, wilc_tx_complete_func_t func);
-void chip_sleep_manually(void);
+void wilc_chip_sleep_manually(void);
+
+void wilc_enable_tcp_ack_filter(bool value);
+int wilc_wlan_get_num_conn_ifcs(struct wilc *);
+int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
+
+int wilc_mac_open(struct net_device *ndev);
+int wilc_mac_close(struct net_device *ndev);
+
+int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID);
+void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
+
+extern bool wilc_enable_ps;
+
#endif
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index e237963..274052f 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -532,17 +532,17 @@
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
PRINT_INFO(RX_DBG, "Info message received\n");
- GnrlAsyncInfoReceived(frame - 4, size + 4);
+ wilc_gnrl_async_info_received(frame - 4, size + 4);
break;
case 'N':
- NetworkInfoReceived(frame - 4, size + 4);
+ wilc_network_info_received(frame - 4, size + 4);
rsp->type = 0;
break;
case 'S':
PRINT_INFO(RX_DBG, "Scan Notification Received\n");
- host_int_ScanCompleteReceived(frame - 4, size + 4);
+ wilc_scan_complete_received(frame - 4, size + 4);
break;
default:
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h
index 5980ece..2f465f4 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -72,10 +72,6 @@
u32 block_size;
} sdio_cmd53_t;
-typedef struct {
- int io_type;
-} wilc_wlan_io_func_t;
-
#define WILC_MAC_INDICATE_STATUS 0x1
#define WILC_MAC_STATUS_INIT -1
#define WILC_MAC_STATUS_READY 0
@@ -83,10 +79,6 @@
#define WILC_MAC_INDICATE_SCAN 0x2
-typedef struct {
- wilc_wlan_io_func_t io_func;
-} wilc_wlan_inp_t;
-
struct tx_complete_data {
int size;
void *buff;
@@ -917,8 +909,7 @@
WID_MAX = 0xFFFF
} WID_T;
-int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
-
+int wilc_wlan_init(struct net_device *dev);
void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void);
u32 wilc_get_chipid(u8 update);