2015-05-11 07:30:56 +02:00
|
|
|
#include "wilc_wfi_cfgoperations.h"
|
|
|
|
#include "linux_wlan_common.h"
|
|
|
|
#include "wilc_wlan_if.h"
|
|
|
|
#include "wilc_wlan.h"
|
|
|
|
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/irq.h>
|
2015-05-27 22:02:16 +02:00
|
|
|
#include <linux/gpio.h>
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
#include <linux/kthread.h>
|
|
|
|
#include <linux/firmware.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/inetdevice.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
|
|
|
|
#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() {}
|
|
|
|
|
2015-06-12 07:11:44 +02:00
|
|
|
extern bool g_obtainingIP;
|
2015-05-11 07:30:56 +02:00
|
|
|
extern void resolve_disconnect_aberration(void *drvHandler);
|
2015-11-05 06:36:09 +01:00
|
|
|
extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
|
2015-08-15 04:46:06 +02:00
|
|
|
extern struct timer_list hDuringIpTimer;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
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 = {
|
|
|
|
.notifier_call = dev_state_ev_handler
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IRQ_WAIT 1
|
|
|
|
#define IRQ_NO_WAIT 0
|
|
|
|
/*
|
|
|
|
* to sync between mac_close and module exit.
|
|
|
|
* don't initialize or de-initialize from init/deinitlocks
|
|
|
|
* to be initialized from module wilc_netdev_init and
|
|
|
|
* deinitialized from mdoule_exit
|
|
|
|
*/
|
|
|
|
static struct semaphore close_exit_sync;
|
|
|
|
|
2015-10-27 10:27:50 +01:00
|
|
|
static int wlan_deinit_locks(struct net_device *dev);
|
2015-10-27 10:27:52 +01:00
|
|
|
static void wlan_deinitialize_threads(struct net_device *dev);
|
2015-09-15 07:06:16 +02:00
|
|
|
extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
|
|
|
|
extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* for now - in frmw_to_linux there should be private data to be passed to it
|
|
|
|
* and this data should be pointer to net device
|
|
|
|
*/
|
2015-10-14 13:46:30 +02:00
|
|
|
struct wilc *g_linux_wlan;
|
2015-06-12 07:11:44 +02:00
|
|
|
bool bEnablePS = true;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
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_do_ioctl = mac_ioctl,
|
|
|
|
.ndo_get_stats = mac_stats,
|
|
|
|
.ndo_set_rx_mode = wilc_set_multicast_list,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr)
|
|
|
|
{
|
|
|
|
struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr;
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-11-05 06:36:12 +01:00
|
|
|
struct host_if_drv *hif_drv;
|
2015-05-11 07:30:56 +02:00
|
|
|
struct net_device *dev;
|
2015-06-02 07:16:04 +02:00
|
|
|
u8 *pIP_Add_buff;
|
2015-05-11 07:30:56 +02:00
|
|
|
perInterface_wlan_t *nic;
|
2015-06-02 07:16:04 +02:00
|
|
|
u8 null_ip[4] = {0};
|
2015-05-11 07:30:56 +02:00
|
|
|
char wlan_dev_name[5] = "wlan0";
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "dev_iface = NULL\n");
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((memcmp(dev_iface->ifa_label, "wlan0", 5)) && (memcmp(dev_iface->ifa_label, "p2p0", 4))) {
|
|
|
|
PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n");
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev = (struct net_device *)dev_iface->ifa_dev->dev;
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "No Wireless registerd\n");
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!priv) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
2015-11-05 06:36:12 +01:00
|
|
|
hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
|
2015-05-11 07:30:56 +02:00
|
|
|
nic = netdev_priv(dev);
|
2015-11-05 06:36:12 +01:00
|
|
|
if (!nic || !hif_drv) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n"); /* tony */
|
|
|
|
|
|
|
|
switch (event) {
|
|
|
|
case NETDEV_UP:
|
|
|
|
PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP %p\n", dev); /* tony */
|
|
|
|
|
|
|
|
PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n");
|
|
|
|
|
|
|
|
/*If we are in station mode or client mode*/
|
|
|
|
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
|
2015-11-05 06:36:12 +01:00
|
|
|
hif_drv->IFC_UP = 1;
|
2015-06-12 07:11:44 +02:00
|
|
|
g_obtainingIP = false;
|
2015-08-15 05:04:13 +02:00
|
|
|
del_timer(&hDuringIpTimer);
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n");
|
|
|
|
}
|
|
|
|
|
2015-06-16 11:44:06 +02:00
|
|
|
if (bEnablePS)
|
2015-11-05 06:36:12 +01:00
|
|
|
host_int_set_power_mgmt(hif_drv, 1, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label);
|
|
|
|
|
|
|
|
pIP_Add_buff = (char *) (&(dev_iface->ifa_address));
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]);
|
2015-11-05 06:36:12 +01:00
|
|
|
host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NETDEV_DOWN:
|
|
|
|
PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev); /* tony */
|
|
|
|
|
|
|
|
PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
|
|
|
|
if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
|
2015-11-05 06:36:12 +01:00
|
|
|
hif_drv->IFC_UP = 0;
|
2015-06-12 07:11:44 +02:00
|
|
|
g_obtainingIP = false;
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0)
|
2015-11-05 06:36:12 +01:00
|
|
|
host_int_set_power_mgmt(hif_drv, 0, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-11-05 06:36:12 +01:00
|
|
|
resolve_disconnect_aberration(hif_drv);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label);
|
|
|
|
|
|
|
|
pIP_Add_buff = null_ip;
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-11-05 06:36:12 +01:00
|
|
|
host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n"); /* tony */
|
|
|
|
PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", dev_iface->ifa_label, event);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NOTIFY_DONE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
|
|
|
|
static irqreturn_t isr_uh_routine(int irq, void *user_data)
|
|
|
|
{
|
2015-10-27 10:27:37 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
|
|
|
struct net_device *dev = (struct net_device *)user_data;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INT_DBG, "Interrupt received UH\n");
|
|
|
|
|
|
|
|
/*While mac is closing cacncel the handling of any interrupts received*/
|
2015-10-27 10:27:37 +01:00
|
|
|
if (wilc->close) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n");
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
return IRQ_WAKE_THREAD;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
irqreturn_t isr_bh_routine(int irq, void *userdata)
|
|
|
|
{
|
2015-10-27 10:27:38 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
|
|
|
|
|
|
|
nic = netdev_priv(userdata);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
/*While mac is closing cacncel the handling of any interrupts received*/
|
2015-10-27 10:27:38 +01:00
|
|
|
if (wilc->close) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRINT_D(INT_DBG, "Interrupt received BH\n");
|
2015-10-27 10:27:40 +01:00
|
|
|
wilc_handle_isr(wilc);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
|
2015-10-20 10:14:03 +02:00
|
|
|
static int init_irq(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2015-10-20 10:14:03 +02:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wl;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
/*initialize GPIO and register IRQ num*/
|
|
|
|
/*GPIO request*/
|
|
|
|
if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
|
|
|
|
(gpio_direction_input(GPIO_NUM) == 0)) {
|
2015-10-20 10:14:03 +02:00
|
|
|
wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
|
2015-05-11 07:30:56 +02:00
|
|
|
} else {
|
|
|
|
ret = -1;
|
|
|
|
PRINT_ER("could not obtain gpio for WILC_INTR\n");
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:14:03 +02:00
|
|
|
if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine,
|
2015-05-11 07:30:56 +02:00
|
|
|
IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/
|
2015-10-27 10:27:37 +01:00
|
|
|
"WILC_IRQ", dev)) < 0) {
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
|
|
|
|
ret = -1;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n",
|
2015-10-20 10:14:03 +02:00
|
|
|
wl->dev_irq_num, GPIO_NUM);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-27 10:27:39 +01:00
|
|
|
static void deinit_irq(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-27 10:27:39 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
|
|
|
|
/* Deintialize IRQ */
|
2015-10-27 10:27:39 +01:00
|
|
|
if (&wilc->dev_irq_num != 0) {
|
|
|
|
free_irq(wilc->dev_irq_num, wilc);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
gpio_free(GPIO_NUM);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OS functions
|
|
|
|
*/
|
2015-09-24 11:14:55 +02:00
|
|
|
void linux_wlan_dbg(u8 *buff)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
PRINT_D(INIT_DBG, "%d\n", *buff);
|
|
|
|
}
|
|
|
|
|
2015-09-24 11:15:05 +02:00
|
|
|
int linux_wlan_lock_timeout(void *vp, u32 timeout)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
int error = -1;
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(LOCK_DBG, "Locking %p\n", vp);
|
2015-11-05 06:36:10 +01:00
|
|
|
if (vp)
|
2015-05-11 07:30:56 +02:00
|
|
|
error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout));
|
2015-08-08 14:11:36 +02:00
|
|
|
else
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Failed, mutex is NULL\n");
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:43 +01:00
|
|
|
void linux_wlan_mac_indicate(struct wilc *wilc, int flag)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
/*I have to do it that way becuase there is no mean to encapsulate device pointer
|
|
|
|
* as a parameter
|
|
|
|
*/
|
|
|
|
int status;
|
|
|
|
|
|
|
|
if (flag == WILC_MAC_INDICATE_STATUS) {
|
2015-10-01 09:03:42 +02:00
|
|
|
wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
|
2015-10-27 10:27:43 +01:00
|
|
|
if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
|
|
|
|
wilc->mac_status = status;
|
|
|
|
up(&wilc->sync_event);
|
2015-05-11 07:30:56 +02:00
|
|
|
} else {
|
2015-10-27 10:27:43 +01:00
|
|
|
wilc->mac_status = status;
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:43 +01:00
|
|
|
if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if (flag == WILC_MAC_INDICATE_SCAN) {
|
|
|
|
PRINT_D(GENERIC_DBG, "Scanning ...\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:57 +01:00
|
|
|
struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-09-15 07:06:14 +02:00
|
|
|
u8 *Bssid, *Bssid1;
|
2015-05-11 07:30:56 +02:00
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
Bssid = pMacHeader + 10;
|
|
|
|
Bssid1 = pMacHeader + 4;
|
|
|
|
|
2015-10-27 10:27:57 +01:00
|
|
|
for (i = 0; i < wilc->vif_num; i++)
|
|
|
|
if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
|
|
|
|
!memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
|
|
|
|
return wilc->vif[i].ndev;
|
2015-10-20 07:26:47 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_INFO(INIT_DBG, "Invalide handle\n");
|
2015-07-28 10:47:37 +02:00
|
|
|
for (i = 0; i < 25; i++)
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]);
|
|
|
|
Bssid = pMacHeader + 18;
|
|
|
|
Bssid1 = pMacHeader + 12;
|
2015-10-27 10:27:57 +01:00
|
|
|
for (i = 0; i < wilc->vif_num; i++)
|
|
|
|
if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) ||
|
|
|
|
!memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN))
|
|
|
|
return wilc->vif[i].ndev;
|
2015-10-20 07:26:47 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_INFO(INIT_DBG, "\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-15 07:06:14 +02:00
|
|
|
int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
int ret = -1;
|
2015-10-27 10:27:44 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-27 10:27:44 +01:00
|
|
|
nic = netdev_priv(wilc_netdev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
|
|
|
for (i = 0; i < wilc->vif_num; i++)
|
|
|
|
if (wilc->vif[i].ndev == wilc_netdev) {
|
|
|
|
memcpy(wilc->vif[i].bssid, pBSSID, 6);
|
2015-05-11 07:30:56 +02:00
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
2015-10-20 07:26:47 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Function to get number of connected interfaces*/
|
|
|
|
int linux_wlan_get_num_conn_ifcs(void)
|
|
|
|
{
|
2015-09-15 07:06:14 +02:00
|
|
|
u8 i = 0;
|
|
|
|
u8 null_bssid[6] = {0};
|
|
|
|
u8 ret_val = 0;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 07:26:47 +02:00
|
|
|
for (i = 0; i < g_linux_wlan->vif_num; i++)
|
2015-10-20 07:26:49 +02:00
|
|
|
if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
|
2015-05-11 07:30:56 +02:00
|
|
|
ret_val++;
|
2015-10-20 07:26:47 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
|
|
|
|
|
|
|
|
static int linux_wlan_txq_task(void *vp)
|
|
|
|
{
|
|
|
|
int ret, txq_count;
|
2015-10-27 10:27:46 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wl;
|
|
|
|
struct net_device *dev = vp;
|
2015-05-11 07:30:56 +02:00
|
|
|
#if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
|
|
|
|
#define TX_BACKOFF_WEIGHT_INCR_STEP (1)
|
|
|
|
#define TX_BACKOFF_WEIGHT_DECR_STEP (1)
|
|
|
|
#define TX_BACKOFF_WEIGHT_MAX (7)
|
|
|
|
#define TX_BACKOFF_WEIGHT_MIN (0)
|
|
|
|
#define TX_BACKOFF_WEIGHT_UNIT_MS (10)
|
|
|
|
int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
|
|
|
|
#endif
|
|
|
|
|
2015-10-27 10:27:46 +01:00
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wl = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
/* inform wilc1000_wlan_init that TXQ task is started. */
|
2015-10-27 10:27:46 +01:00
|
|
|
up(&wl->txq_thread_started);
|
2015-05-11 07:30:56 +02:00
|
|
|
while (1) {
|
|
|
|
|
|
|
|
PRINT_D(TX_DBG, "txq_task Taking a nap :)\n");
|
2015-10-27 10:27:46 +01:00
|
|
|
down(&wl->txq_event);
|
2015-05-11 07:30:56 +02:00
|
|
|
/* wait_for_completion(&pd->txq_event); */
|
|
|
|
PRINT_D(TX_DBG, "txq_task Who waked me up :$\n");
|
|
|
|
|
2015-10-27 10:27:46 +01:00
|
|
|
if (wl->close) {
|
2015-05-11 07:30:56 +02:00
|
|
|
/*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */
|
2015-10-27 10:27:46 +01:00
|
|
|
up(&wl->txq_thread_started);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
while (!kthread_should_stop())
|
|
|
|
schedule();
|
|
|
|
|
|
|
|
PRINT_D(TX_DBG, "TX thread stopped\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PRINT_D(TX_DBG, "txq_task handle the sending packet and let me go to sleep.\n");
|
|
|
|
#if !defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
|
2015-10-27 10:27:47 +01:00
|
|
|
ret = wilc_wlan_handle_txq(dev, &txq_count);
|
2015-05-11 07:30:56 +02:00
|
|
|
#else
|
|
|
|
do {
|
2015-10-27 10:27:47 +01:00
|
|
|
ret = wilc_wlan_handle_txq(dev, &txq_count);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) {
|
|
|
|
PRINT_D(TX_DBG, "Waking up queue\n");
|
|
|
|
/* netif_wake_queue(pd->wilc_netdev); */
|
2015-10-27 10:27:46 +01:00
|
|
|
if (netif_queue_stopped(wl->vif[0].ndev))
|
|
|
|
netif_wake_queue(wl->vif[0].ndev);
|
|
|
|
if (netif_queue_stopped(wl->vif[1].ndev))
|
|
|
|
netif_wake_queue(wl->vif[1].ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */
|
|
|
|
do {
|
|
|
|
/* Back off from sending packets for some time. */
|
|
|
|
/* schedule_timeout will allow RX task to run and free buffers.*/
|
|
|
|
/* set_current_state(TASK_UNINTERRUPTIBLE); */
|
|
|
|
/* timeout = schedule_timeout(timeout); */
|
|
|
|
msleep(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight);
|
|
|
|
} while (/*timeout*/ 0);
|
|
|
|
backoff_weight += TX_BACKOFF_WEIGHT_INCR_STEP;
|
2015-07-28 10:47:37 +02:00
|
|
|
if (backoff_weight > TX_BACKOFF_WEIGHT_MAX)
|
2015-05-11 07:30:56 +02:00
|
|
|
backoff_weight = TX_BACKOFF_WEIGHT_MAX;
|
|
|
|
} else {
|
|
|
|
if (backoff_weight > TX_BACKOFF_WEIGHT_MIN) {
|
|
|
|
backoff_weight -= TX_BACKOFF_WEIGHT_DECR_STEP;
|
2015-07-28 10:47:37 +02:00
|
|
|
if (backoff_weight < TX_BACKOFF_WEIGHT_MIN)
|
2015-05-11 07:30:56 +02:00
|
|
|
backoff_weight = TX_BACKOFF_WEIGHT_MIN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*TODO: drop packets after a certain time/number of retry count. */
|
2015-10-27 10:27:46 +01:00
|
|
|
} while (ret == WILC_TX_ERR_NO_BUF && !wl->close); /* retry sending packets if no more buffers in chip. */
|
2015-05-11 07:30:56 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-24 11:14:54 +02:00
|
|
|
void linux_wlan_rx_complete(void)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
PRINT_D(RX_DBG, "RX completed\n");
|
|
|
|
}
|
|
|
|
|
2015-10-29 04:18:49 +01:00
|
|
|
int linux_wlan_get_firmware(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-29 04:18:49 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
int ret = 0;
|
|
|
|
const struct firmware *wilc_firmware;
|
|
|
|
char *firmware;
|
|
|
|
|
2015-10-29 04:18:49 +01:00
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
if (nic->iftype == AP_MODE)
|
|
|
|
firmware = AP_FIRMWARE;
|
|
|
|
else if (nic->iftype == STATION_MODE)
|
|
|
|
firmware = STA_FIRMWARE;
|
|
|
|
|
|
|
|
else {
|
|
|
|
PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n");
|
|
|
|
firmware = P2P_CONCURRENCY_FIRMWARE;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!nic) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("NIC is NULL\n");
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!(&nic->wilc_netdev->dev)) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("&nic->wilc_netdev->dev is NULL\n");
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the firmare should be located in /lib/firmware in
|
|
|
|
* root file system with the name specified above */
|
|
|
|
|
|
|
|
#ifdef WILC_SDIO
|
2015-10-29 04:18:49 +01:00
|
|
|
if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("%s - firmare not available\n", firmware);
|
|
|
|
ret = -1;
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
#else
|
2015-10-29 04:18:49 +01:00
|
|
|
if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_spidev->dev) != 0) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("%s - firmare not available\n", firmware);
|
|
|
|
ret = -1;
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
#endif
|
2015-10-29 04:18:49 +01:00
|
|
|
wilc->firmware = wilc_firmware;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
_fail_:
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-29 04:18:46 +01:00
|
|
|
static int linux_wlan_start_firmware(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-29 04:18:46 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
int ret = 0;
|
2015-10-29 04:18:46 +01:00
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
/* start firmware */
|
|
|
|
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
|
2015-10-01 09:03:33 +02:00
|
|
|
ret = wilc_wlan_start();
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to start Firmware\n");
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wait for mac ready */
|
|
|
|
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
|
2015-10-29 04:18:46 +01:00
|
|
|
ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret) {
|
|
|
|
PRINT_D(INIT_DBG, "Firmware start timed out");
|
|
|
|
goto _fail_;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* TODO: Driver shouoldn't wait forever for firmware to get started -
|
|
|
|
* in case of timeout this should be handled properly
|
|
|
|
*/
|
|
|
|
PRINT_D(INIT_DBG, "Firmware successfully started\n");
|
|
|
|
|
|
|
|
_fail_:
|
|
|
|
return ret;
|
|
|
|
}
|
2015-10-29 04:18:42 +01:00
|
|
|
static int linux_wlan_firmware_download(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-29 04:18:42 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
int ret = 0;
|
|
|
|
|
2015-10-29 04:18:42 +01:00
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
|
|
|
if (!wilc->firmware) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Firmware buffer is NULL\n");
|
|
|
|
ret = -ENOBUFS;
|
|
|
|
goto _FAIL_;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* do the firmware download
|
|
|
|
**/
|
|
|
|
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
|
2015-10-29 04:18:42 +01:00
|
|
|
ret = wilc_wlan_firmware_download(wilc->firmware->data,
|
|
|
|
wilc->firmware->size);
|
2015-07-28 10:47:37 +02:00
|
|
|
if (ret < 0)
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _FAIL_;
|
|
|
|
|
|
|
|
/* Freeing FW buffer */
|
|
|
|
PRINT_D(INIT_DBG, "Freeing FW buffer ...\n");
|
|
|
|
PRINT_D(INIT_DBG, "Releasing firmware\n");
|
2015-10-29 04:18:42 +01:00
|
|
|
release_firmware(wilc->firmware);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_D(INIT_DBG, "Download Succeeded\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
_FAIL_:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* startup configuration - could be changed later using iconfig*/
|
2015-10-14 13:46:30 +02:00
|
|
|
static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
unsigned char c_val[64];
|
|
|
|
unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff};
|
|
|
|
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-11-05 06:36:13 +01:00
|
|
|
struct host_if_drv *hif_drv;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(TX_DBG, "Start configuring Firmware\n");
|
|
|
|
get_random_bytes(&mac_add[5], 1);
|
|
|
|
get_random_bytes(&mac_add[4], 1);
|
|
|
|
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
|
2015-11-05 06:36:13 +01:00
|
|
|
hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
|
|
|
|
PRINT_D(INIT_DBG, "Host = %p\n", hif_drv);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]);
|
2015-06-09 13:19:06 +02:00
|
|
|
wilc_get_chipid(0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-08-20 09:32:53 +02:00
|
|
|
*(int *)c_val = 1;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/*to tell fw that we are going to use PC test - WILC specific*/
|
|
|
|
c_val[0] = 0;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = INFRASTRUCTURE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
2015-09-20 08:51:19 +02:00
|
|
|
/* c_val[0] = RATE_AUTO; */
|
2015-05-11 07:30:56 +02:00
|
|
|
c_val[0] = RATE_AUTO;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = G_MIXED_11B_2_MODE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = G_SHORT_PREAMBLE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = AUTO_PROT;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = ACTIVE_SCAN;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = SITE_SURVEY_OFF;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
*((int *)c_val) = 0xffff; /* Never use RTS-CTS */
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
*((int *)c_val) = 2346;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* SSID */
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
/* Configuration : String with length less than 32 bytes */
|
|
|
|
/* Values to set : Any string with length less than 32 bytes */
|
|
|
|
/* ( In BSS Station Set SSID to "" (null string) */
|
|
|
|
/* to enable Broadcast SSID suppport ) */
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
c_val[0] = 0;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = NO_POWERSAVE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = OPEN_SYSTEM;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* WEP/802 11I Configuration */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
/* Configuration : WEP Key */
|
|
|
|
/* Values (0x) : 5 byte for WEP40 and 13 bytes for WEP104 */
|
|
|
|
/* In case more than 5 bytes are passed on for WEP 40 */
|
|
|
|
/* only first 5 bytes will be used as the key */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
strcpy(c_val, "123456790abcdef1234567890");
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* WEP/802 11I Configuration */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
/* Configuration : AES/TKIP WPA/RSNA Pre-Shared Key */
|
|
|
|
/* Values to set : Any string with length greater than equal to 8 bytes */
|
|
|
|
/* and less than 64 bytes */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
strcpy(c_val, "12345678");
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* IEEE802.1X Key Configuration */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
/* Configuration : Radius Server Access Secret Key */
|
|
|
|
/* Values to set : Any string with length greater than equal to 8 bytes */
|
|
|
|
/* and less than 65 bytes */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
strcpy(c_val, "password");
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* IEEE802.1X Server Address Configuration */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
/* Configuration : Radius Server IP Address */
|
|
|
|
/* Values to set : Any valid IP Address */
|
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
c_val[0] = 192;
|
|
|
|
c_val[1] = 168;
|
|
|
|
c_val[2] = 1;
|
|
|
|
c_val[3] = 112;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 3;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 3;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = NORMAL_ACK;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 0;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 48;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 28;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* Beacon Interval */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Configuration : Sets the beacon interval value */
|
|
|
|
/* Values to set : Any 16-bit value */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
*((int *)c_val) = 100;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = REKEY_DISABLE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* Rekey Time (s) (Used only when the Rekey policy is 2 or 4) */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Configuration : Sets the Rekey Time (s) */
|
|
|
|
/* Values to set : 32-bit value */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
*((int *)c_val) = 84600;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/* Rekey Packet Count (in 1000s; used when Rekey Policy is 3) */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Configuration : Sets Rekey Group Packet count */
|
|
|
|
/* Values to set : 32-bit Value */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
*((int *)c_val) = 500;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = G_SELF_CTS_PROT;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1; /* Enable N */
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = HT_MIXED_MODE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1; /* TXOP Prot disable in N mode: No RTS-CTS on TX A-MPDUs to save air-time. */
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
memcpy(c_val, mac_add, 6);
|
|
|
|
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* AP only
|
|
|
|
**/
|
|
|
|
c_val[0] = DETECT_PROTECT_REPORT;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = RTS_CTS_NONHT_PROT;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 0;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = MIMO_MODE;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 7;
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
c_val[0] = 1; /* Enable N with immediate block ack. */
|
2015-10-01 09:03:40 +02:00
|
|
|
if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1))
|
2015-05-11 07:30:56 +02:00
|
|
|
goto _fail_;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
_fail_:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************/
|
2015-10-20 10:13:57 +02:00
|
|
|
void wilc1000_wlan_deinit(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-20 10:13:57 +02:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wl;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:57 +02:00
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wl = nic->wilc;
|
|
|
|
|
|
|
|
if (!wl) {
|
|
|
|
netdev_err(dev, "wl is NULL\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wl->initialized) {
|
|
|
|
netdev_info(dev, "Deinitializing wilc1000...\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
|
|
|
|
/* johnny : remove */
|
|
|
|
PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n");
|
|
|
|
#else
|
|
|
|
wilc_bus_set_default_speed();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Disabling IRQ\n");
|
2015-09-17 10:47:25 +02:00
|
|
|
#ifdef WILC_SDIO
|
2015-10-20 10:13:57 +02:00
|
|
|
mutex_lock(&wl->hif_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
disable_sdio_interrupt();
|
2015-10-20 10:13:57 +02:00
|
|
|
mutex_unlock(&wl->hif_cs);
|
2015-09-17 10:47:25 +02:00
|
|
|
#endif
|
2015-11-05 06:36:10 +01:00
|
|
|
if (&wl->txq_event)
|
2015-10-20 10:13:57 +02:00
|
|
|
up(&wl->txq_event);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
|
2015-10-27 10:27:52 +01:00
|
|
|
wlan_deinitialize_threads(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
|
2015-10-27 10:27:39 +01:00
|
|
|
deinit_irq(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-01 09:03:34 +02:00
|
|
|
wilc_wlan_stop();
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
|
2015-10-27 10:27:54 +01:00
|
|
|
wilc_wlan_cleanup(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
#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");
|
|
|
|
|
2015-10-20 10:13:57 +02:00
|
|
|
mutex_lock(&wl->hif_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
disable_sdio_interrupt();
|
2015-10-20 10:13:57 +02:00
|
|
|
mutex_unlock(&wl->hif_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*De-Initialize locks*/
|
|
|
|
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
|
2015-10-27 10:27:50 +01:00
|
|
|
wlan_deinit_locks(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
/* announce that wilc1000 is not initialized */
|
2015-10-20 10:13:57 +02:00
|
|
|
wl->initialized = false;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
PRINT_D(INIT_DBG, "wilc1000 is not initialized\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
int wlan_init_locks(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-20 10:13:53 +02:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wl;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Initializing Locks ...\n");
|
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
mutex_init(&wl->hif_cs);
|
|
|
|
mutex_init(&wl->rxq_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
spin_lock_init(&wl->txq_spinlock);
|
|
|
|
sema_init(&wl->txq_add_to_head_cs, 1);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
sema_init(&wl->txq_event, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
sema_init(&wl->cfg_event, 0);
|
|
|
|
sema_init(&wl->sync_event, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
sema_init(&wl->txq_thread_started, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:50 +01:00
|
|
|
static int wlan_deinit_locks(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-27 10:27:50 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "De-Initializing Locks\n");
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (&wilc->hif_cs)
|
2015-10-27 10:27:50 +01:00
|
|
|
mutex_destroy(&wilc->hif_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (&wilc->rxq_cs)
|
2015-10-27 10:27:50 +01:00
|
|
|
mutex_destroy(&wilc->rxq_cs);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2015-10-14 13:46:30 +02:00
|
|
|
void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
|
|
|
|
|
|
|
|
nwi->os_context.os_private = (void *)nic;
|
|
|
|
|
|
|
|
#ifdef WILC_SDIO
|
|
|
|
nwi->io_func.io_type = HIF_SDIO;
|
|
|
|
nwi->io_func.io_init = linux_sdio_init;
|
|
|
|
nwi->io_func.io_deinit = linux_sdio_deinit;
|
|
|
|
nwi->io_func.u.sdio.sdio_cmd52 = linux_sdio_cmd52;
|
|
|
|
nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53;
|
|
|
|
nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed;
|
|
|
|
nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed;
|
|
|
|
#else
|
|
|
|
nwi->io_func.io_type = HIF_SPI;
|
|
|
|
nwi->io_func.io_init = linux_spi_init;
|
|
|
|
nwi->io_func.io_deinit = linux_spi_deinit;
|
|
|
|
nwi->io_func.u.spi.spi_tx = linux_spi_write;
|
|
|
|
nwi->io_func.u.spi.spi_rx = linux_spi_read;
|
|
|
|
nwi->io_func.u.spi.spi_trx = linux_spi_write_read;
|
|
|
|
nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:45 +01:00
|
|
|
int wlan_initialize_threads(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-27 10:27:45 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
int ret = 0;
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-10-27 10:27:45 +01:00
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wilc = nic->wilc;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "Initializing Threads ...\n");
|
|
|
|
|
|
|
|
/* create tx task */
|
|
|
|
PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
|
2015-10-27 10:27:46 +01:00
|
|
|
wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
|
2015-10-27 10:27:45 +01:00
|
|
|
"K_TXQ_TASK");
|
|
|
|
if (!wilc->txq_thread) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("couldn't create TXQ thread\n");
|
|
|
|
ret = -ENOBUFS;
|
|
|
|
goto _fail_2;
|
|
|
|
}
|
|
|
|
/* wait for TXQ task to start. */
|
2015-10-27 10:27:45 +01:00
|
|
|
down(&wilc->txq_thread_started);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
_fail_2:
|
|
|
|
/*De-Initialize 2nd thread*/
|
2015-10-27 10:27:45 +01:00
|
|
|
wilc->close = 0;
|
2015-05-11 07:30:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:52 +01:00
|
|
|
static void wlan_deinitialize_threads(struct net_device *dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
2015-10-27 10:27:52 +01:00
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct wilc *wl;
|
|
|
|
|
|
|
|
nic = netdev_priv(dev);
|
|
|
|
wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-27 10:27:52 +01:00
|
|
|
wl->close = 1;
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (&wl->txq_event)
|
2015-10-27 10:27:52 +01:00
|
|
|
up(&wl->txq_event);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (wl->txq_thread) {
|
2015-10-27 10:27:52 +01:00
|
|
|
kthread_stop(wl->txq_thread);
|
|
|
|
wl->txq_thread = NULL;
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2015-10-20 10:13:52 +02:00
|
|
|
struct wilc *wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:52 +02:00
|
|
|
if (!wl->initialized) {
|
|
|
|
wl->mac_status = WILC_MAC_STATUS_INIT;
|
|
|
|
wl->close = 0;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:53 +02:00
|
|
|
wlan_init_locks(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 10:13:52 +02:00
|
|
|
linux_to_wlan(&nwi, wl);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-29 04:18:47 +01:00
|
|
|
ret = wilc_wlan_init(dev, &nwi);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Initializing WILC_Wlan FAILED\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_locks_;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
|
2015-10-20 10:14:03 +02:00
|
|
|
if (init_irq(dev)) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("couldn't initialize IRQ\n");
|
|
|
|
ret = -EIO;
|
2015-10-20 07:26:54 +02:00
|
|
|
goto _fail_locks_;
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-27 10:27:45 +01:00
|
|
|
ret = wlan_initialize_threads(dev);
|
2015-10-20 07:26:54 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Initializing Threads FAILED\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_wilc_wlan_;
|
|
|
|
}
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
|
|
|
|
if (enable_sdio_interrupt()) {
|
|
|
|
PRINT_ER("couldn't initialize IRQ\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_irq_init_;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-29 04:18:49 +01:00
|
|
|
if (linux_wlan_get_firmware(dev)) {
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_ER("Can't get firmware\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_irq_enable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Download firmware*/
|
2015-10-29 04:18:42 +01:00
|
|
|
ret = linux_wlan_firmware_download(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to download firmware\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_irq_enable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start firmware*/
|
2015-10-29 04:18:46 +01:00
|
|
|
ret = linux_wlan_start_firmware(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to start firmware\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_irq_enable_;
|
|
|
|
}
|
|
|
|
|
|
|
|
wilc_bus_set_max_speed();
|
|
|
|
|
2015-10-01 09:03:41 +02:00
|
|
|
if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
|
2015-05-11 07:30:56 +02:00
|
|
|
int size;
|
|
|
|
char Firmware_ver[20];
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-10-01 09:03:42 +02:00
|
|
|
size = wilc_wlan_cfg_get_val(
|
2015-05-11 07:30:56 +02:00
|
|
|
WID_FIRMWARE_VERSION,
|
|
|
|
Firmware_ver, sizeof(Firmware_ver));
|
|
|
|
Firmware_ver[size] = '\0';
|
|
|
|
PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver);
|
|
|
|
}
|
|
|
|
/* Initialize firmware with default configuration */
|
2015-10-20 10:13:52 +02:00
|
|
|
ret = linux_wlan_init_test_config(dev, wl);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to configure firmware\n");
|
|
|
|
ret = -EIO;
|
|
|
|
goto _fail_fw_start_;
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:13:52 +02:00
|
|
|
wl->initialized = true;
|
2015-05-11 07:30:56 +02:00
|
|
|
return 0; /*success*/
|
|
|
|
|
|
|
|
_fail_fw_start_:
|
2015-10-01 09:03:34 +02:00
|
|
|
wilc_wlan_stop();
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
_fail_irq_enable_:
|
|
|
|
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
|
|
|
|
disable_sdio_interrupt();
|
|
|
|
_fail_irq_init_:
|
2015-06-01 21:06:45 +02:00
|
|
|
#endif
|
2015-05-11 07:30:56 +02:00
|
|
|
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
|
2015-10-27 10:27:39 +01:00
|
|
|
deinit_irq(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
#endif
|
2015-10-27 10:27:52 +01:00
|
|
|
wlan_deinitialize_threads(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
_fail_wilc_wlan_:
|
2015-10-27 10:27:54 +01:00
|
|
|
wilc_wlan_cleanup(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
_fail_locks_:
|
2015-10-27 10:27:50 +01:00
|
|
|
wlan_deinit_locks(dev);
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("WLAN Iinitialization FAILED\n");
|
|
|
|
} else {
|
|
|
|
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* - this function will be called automatically by OS when module inserted.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mac_init_fn(struct net_device *ndev)
|
|
|
|
{
|
|
|
|
|
|
|
|
/*Why we do this !!!*/
|
|
|
|
netif_start_queue(ndev); /* ma */
|
|
|
|
netif_stop_queue(ndev); /* ma */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This fn is called, when this device is setup using ifconfig */
|
|
|
|
int mac_open(struct net_device *ndev)
|
|
|
|
{
|
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
|
|
|
|
/*No need for setting mac address here anymore,*/
|
|
|
|
/*Just set it in init_test_config()*/
|
|
|
|
unsigned char mac_add[ETH_ALEN] = {0};
|
|
|
|
int ret = 0;
|
|
|
|
int i = 0;
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-10-20 10:13:54 +02:00
|
|
|
struct wilc *wl;
|
|
|
|
|
|
|
|
nic = netdev_priv(ndev);
|
|
|
|
wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-09-15 14:39:51 +02:00
|
|
|
#ifdef WILC_SPI
|
2015-10-20 10:13:54 +02:00
|
|
|
if (!wl|| !wl->wilc_spidev) {
|
2015-09-15 14:39:51 +02:00
|
|
|
netdev_err(ndev, "wilc1000: SPI device not ready\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
#endif
|
2015-05-11 07:30:56 +02:00
|
|
|
nic = netdev_priv(ndev);
|
|
|
|
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
|
|
|
|
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
|
|
|
|
|
2015-09-20 08:51:25 +02:00
|
|
|
ret = wilc_init_host_int(ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to initialize host interface\n");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*initialize platform*/
|
|
|
|
PRINT_D(INIT_DBG, "*** re-init ***\n");
|
|
|
|
ret = wilc1000_wlan_init(ndev, nic);
|
|
|
|
if (ret < 0) {
|
|
|
|
PRINT_ER("Failed to initialize wilc1000\n");
|
2015-09-20 08:51:24 +02:00
|
|
|
wilc_deinit_host_int(ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:58 +01:00
|
|
|
Set_machw_change_vir_if(ndev, false);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-06-09 13:19:06 +02:00
|
|
|
host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add);
|
2015-09-03 20:48:14 +02:00
|
|
|
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
/* loop through the NUM of supported devices and set the MAC address */
|
2015-10-20 10:13:54 +02:00
|
|
|
for (i = 0; i < wl->vif_num; i++) {
|
|
|
|
if (ndev == wl->vif[i].ndev) {
|
|
|
|
memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN);
|
|
|
|
wl->vif[i].hif_drv = priv->hWILCWFIDrv;
|
2015-05-11 07:30:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/
|
2015-10-20 10:13:54 +02:00
|
|
|
memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (!is_valid_ether_addr(ndev->dev_addr)) {
|
|
|
|
PRINT_ER("Error: Wrong MAC address\n");
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto _err_;
|
|
|
|
}
|
|
|
|
|
2015-09-20 08:51:16 +02:00
|
|
|
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
|
|
|
|
nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg);
|
|
|
|
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr,
|
|
|
|
nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg);
|
2015-05-11 07:30:56 +02:00
|
|
|
netif_wake_queue(ndev);
|
2015-10-20 10:13:54 +02:00
|
|
|
wl->open_ifcs++;
|
2015-05-11 07:30:56 +02:00
|
|
|
nic->mac_opened = 1;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
_err_:
|
2015-09-20 08:51:24 +02:00
|
|
|
wilc_deinit_host_int(ndev);
|
2015-10-20 10:13:57 +02:00
|
|
|
wilc1000_wlan_deinit(ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct net_device_stats *mac_stats(struct net_device *dev)
|
|
|
|
{
|
|
|
|
perInterface_wlan_t *nic = netdev_priv(dev);
|
|
|
|
|
|
|
|
return &nic->netstats;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the multicast filter */
|
|
|
|
static void wilc_set_multicast_list(struct net_device *dev)
|
|
|
|
{
|
|
|
|
|
|
|
|
struct netdev_hw_addr *ha;
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-11-05 06:36:14 +01:00
|
|
|
struct host_if_drv *hif_drv;
|
2015-05-11 07:30:56 +02:00
|
|
|
int i = 0;
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
|
2015-11-05 06:36:14 +01:00
|
|
|
hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", dev->mc.count);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (dev->flags & IFF_PROMISC) {
|
|
|
|
/* Normally, we should configure the chip to retrive all packets
|
|
|
|
* but we don't wanna support this right now */
|
|
|
|
/* TODO: add promiscuous mode support */
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If there's more addresses than we handle, get all multicast
|
|
|
|
* packets and sort them out in software. */
|
|
|
|
if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) {
|
|
|
|
PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n");
|
|
|
|
/* get all multicast packets */
|
2015-11-05 06:36:14 +01:00
|
|
|
host_int_setup_multicast_filter(hif_drv, false, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No multicast? Just get our own stuff */
|
|
|
|
if ((dev->mc.count) == 0) {
|
|
|
|
PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n");
|
2015-11-05 06:36:14 +01:00
|
|
|
host_int_setup_multicast_filter(hif_drv, true, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Store all of the multicast addresses in the hardware filter */
|
|
|
|
netdev_for_each_mc_addr(ha, dev)
|
|
|
|
{
|
2015-11-05 06:36:09 +01:00
|
|
|
memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN);
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i,
|
2015-11-05 06:36:09 +01:00
|
|
|
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]);
|
2015-05-11 07:30:56 +02:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:14 +01:00
|
|
|
host_int_setup_multicast_filter(hif_drv, true, (dev->mc.count));
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void linux_wlan_tx_complete(void *priv, int status)
|
|
|
|
{
|
|
|
|
|
|
|
|
struct tx_complete_data *pv_data = (struct tx_complete_data *)priv;
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-08-08 14:11:36 +02:00
|
|
|
if (status == 1)
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(TX_DBG, "Packet sent successfully - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb);
|
2015-08-08 14:11:36 +02:00
|
|
|
else
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb);
|
|
|
|
/* Free the SK Buffer, its work is done */
|
|
|
|
dev_kfree_skb(pv_data->skb);
|
2015-09-04 04:04:19 +02:00
|
|
|
kfree(pv_data);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int mac_xmit(struct sk_buff *skb, struct net_device *ndev)
|
|
|
|
{
|
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct tx_complete_data *tx_data = NULL;
|
|
|
|
int QueueCount;
|
|
|
|
char *pu8UdpBuffer;
|
|
|
|
struct iphdr *ih;
|
|
|
|
struct ethhdr *eth_h;
|
2015-10-27 10:28:01 +01:00
|
|
|
struct wilc *wilc;
|
2015-08-18 16:18:11 +02:00
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
nic = netdev_priv(ndev);
|
2015-10-27 10:28:01 +01:00
|
|
|
wilc = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
|
|
|
|
|
|
|
|
/* Stop the network interface queue */
|
|
|
|
if (skb->dev != ndev) {
|
|
|
|
PRINT_ER("Packet not destined to this device\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-04 03:59:07 +02:00
|
|
|
tx_data = kmalloc(sizeof(struct tx_complete_data), GFP_ATOMIC);
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!tx_data) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Failed to allocate memory for tx_data structure\n");
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
netif_wake_queue(ndev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tx_data->buff = skb->data;
|
|
|
|
tx_data->size = skb->len;
|
|
|
|
tx_data->skb = skb;
|
|
|
|
|
|
|
|
eth_h = (struct ethhdr *)(skb->data);
|
2015-07-28 10:47:37 +02:00
|
|
|
if (eth_h->h_proto == 0x8e88)
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "EAPOL transmitted\n");
|
|
|
|
|
|
|
|
/*get source and dest ip addresses*/
|
|
|
|
ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr));
|
|
|
|
|
|
|
|
pu8UdpBuffer = (char *)ih + sizeof(struct iphdr);
|
2015-07-28 10:47:37 +02:00
|
|
|
if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68))
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]);
|
|
|
|
|
|
|
|
PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb);
|
|
|
|
|
|
|
|
/* Send packet to MAC HW - for now the tx_complete function will be just status
|
|
|
|
* indicator. still not sure if I need to suspend host transmission till the tx_complete
|
|
|
|
* function called or not?
|
|
|
|
* allocated buffer will be freed in tx_complete function.
|
|
|
|
*/
|
|
|
|
PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
|
|
|
|
nic->netstats.tx_packets++;
|
|
|
|
nic->netstats.tx_bytes += tx_data->size;
|
2015-10-27 10:28:01 +01:00
|
|
|
tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid;
|
2015-10-27 10:28:02 +01:00
|
|
|
QueueCount = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
|
|
|
|
tx_data->buff, tx_data->size,
|
2015-10-01 09:03:35 +02:00
|
|
|
linux_wlan_tx_complete);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) {
|
2015-10-27 10:28:01 +01:00
|
|
|
netif_stop_queue(wilc->vif[0].ndev);
|
|
|
|
netif_stop_queue(wilc->vif[1].ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mac_close(struct net_device *ndev)
|
|
|
|
{
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-05-11 07:30:56 +02:00
|
|
|
perInterface_wlan_t *nic;
|
2015-10-12 09:55:35 +02:00
|
|
|
struct host_if_drv *pstrWFIDrv;
|
2015-10-20 10:13:55 +02:00
|
|
|
struct wilc *wl;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
nic = netdev_priv(ndev);
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!nic || !nic->wilc_netdev || !nic->wilc_netdev->ieee80211_ptr ||
|
|
|
|
!nic->wilc_netdev->ieee80211_ptr->wiphy) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("nic = NULL\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
|
2015-10-20 10:13:55 +02:00
|
|
|
wl = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!priv) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("priv = NULL\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-12 09:55:35 +02:00
|
|
|
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
PRINT_D(GENERIC_DBG, "Mac close\n");
|
|
|
|
|
2015-10-20 10:13:55 +02:00
|
|
|
if (!wl) {
|
|
|
|
PRINT_ER("wl = NULL\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!pstrWFIDrv) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("pstrWFIDrv = NULL\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-20 10:13:55 +02:00
|
|
|
if ((wl->open_ifcs) > 0) {
|
|
|
|
wl->open_ifcs--;
|
2015-05-11 07:30:56 +02:00
|
|
|
} else {
|
|
|
|
PRINT_ER("ERROR: MAC close called while number of opened interfaces is zero\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (nic->wilc_netdev) {
|
2015-05-11 07:30:56 +02:00
|
|
|
/* Stop the network interface queue */
|
|
|
|
netif_stop_queue(nic->wilc_netdev);
|
|
|
|
|
2015-09-20 08:51:24 +02:00
|
|
|
wilc_deinit_host_int(nic->wilc_netdev);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
2015-10-20 10:13:55 +02:00
|
|
|
if (wl->open_ifcs == 0) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
|
2015-10-20 10:13:55 +02:00
|
|
|
wl->close = 1;
|
2015-10-20 10:13:57 +02:00
|
|
|
wilc1000_wlan_deinit(ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
WILC_WFI_deinit_mon_interface();
|
|
|
|
}
|
|
|
|
|
2015-09-04 05:07:58 +02:00
|
|
|
up(&close_exit_sync);
|
2015-05-11 07:30:56 +02:00
|
|
|
nic->mac_opened = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
|
|
|
|
{
|
|
|
|
|
2015-06-02 07:16:04 +02:00
|
|
|
u8 *buff = NULL;
|
2015-06-11 07:35:57 +02:00
|
|
|
s8 rssi;
|
2015-06-11 07:35:55 +02:00
|
|
|
u32 size = 0, length = 0;
|
2015-05-11 07:30:56 +02:00
|
|
|
perInterface_wlan_t *nic;
|
2015-09-15 07:06:13 +02:00
|
|
|
struct wilc_priv *priv;
|
2015-09-16 11:36:03 +02:00
|
|
|
s32 s32Error = 0;
|
2015-10-27 10:27:53 +01:00
|
|
|
struct wilc *wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
/* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */
|
|
|
|
nic = netdev_priv(ndev);
|
2015-10-27 10:27:53 +01:00
|
|
|
wilc = nic->wilc;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-27 10:27:53 +01:00
|
|
|
if (!wilc->initialized)
|
2015-05-11 07:30:56 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
|
|
|
/* ]] 2013-06-24 */
|
|
|
|
case SIOCSIWPRIV:
|
|
|
|
{
|
|
|
|
struct iwreq *wrq = (struct iwreq *) req; /* added by tony */
|
|
|
|
|
|
|
|
size = wrq->u.data.length;
|
|
|
|
|
|
|
|
if (size && wrq->u.data.pointer) {
|
|
|
|
|
2015-06-11 09:48:13 +02:00
|
|
|
buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length);
|
2015-09-04 12:04:15 +02:00
|
|
|
if (IS_ERR(buff))
|
|
|
|
return PTR_ERR(buff);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
if (strncasecmp(buff, "RSSI", length) == 0) {
|
|
|
|
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
|
|
|
|
s32Error = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi));
|
|
|
|
if (s32Error)
|
|
|
|
PRINT_ER("Failed to send get rssi param's message queue ");
|
|
|
|
PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi);
|
|
|
|
|
|
|
|
/*Rounding up the rssi negative value*/
|
|
|
|
rssi += 5;
|
|
|
|
|
|
|
|
snprintf(buff, size, "rssi %d", rssi);
|
|
|
|
|
|
|
|
if (copy_to_user(wrq->u.data.pointer, buff, size)) {
|
2015-06-19 02:06:28 +02:00
|
|
|
PRINT_ER("%s: failed to copy data to user buffer\n", __func__);
|
2015-05-11 07:30:56 +02:00
|
|
|
s32Error = -EFAULT;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
PRINT_INFO(GENERIC_DBG, "Command - %d - has been received\n", cmd);
|
|
|
|
s32Error = -EOPNOTSUPP;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
2015-08-10 10:00:33 +02:00
|
|
|
kfree(buff);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
return s32Error;
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:56 +01:00
|
|
|
void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
unsigned int frame_len = 0;
|
|
|
|
int stats;
|
|
|
|
unsigned char *buff_to_send = NULL;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
struct net_device *wilc_netdev;
|
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
|
2015-10-27 10:27:57 +01:00
|
|
|
wilc_netdev = GetIfHandler(wilc, buff);
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!wilc_netdev)
|
2015-05-11 07:30:56 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
buff += pkt_offset;
|
|
|
|
nic = netdev_priv(wilc_netdev);
|
|
|
|
|
|
|
|
if (size > 0) {
|
|
|
|
|
|
|
|
frame_len = size;
|
|
|
|
buff_to_send = buff;
|
|
|
|
|
|
|
|
/* Need to send the packet up to the host, allocate a skb buffer */
|
|
|
|
skb = dev_alloc_skb(frame_len);
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!skb) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Low memory - packet droped\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!wilc || !wilc_netdev)
|
2015-10-27 10:27:56 +01:00
|
|
|
PRINT_ER("wilc_netdev in wilc is NULL");
|
2015-05-11 07:30:56 +02:00
|
|
|
skb->dev = wilc_netdev;
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!skb->dev)
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("skb->dev is NULL\n");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* for(i=0;i<40;i++)
|
|
|
|
* {
|
|
|
|
* if(i<frame_len)
|
|
|
|
* WILC_PRINTF("buff_to_send[%d]=%2x\n",i,buff_to_send[i]);
|
|
|
|
*
|
|
|
|
* }*/
|
|
|
|
|
|
|
|
/* skb_put(skb, frame_len); */
|
|
|
|
memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);
|
|
|
|
|
|
|
|
/* WILC_PRINTF("After MEM_CPY\n"); */
|
|
|
|
|
|
|
|
/* nic = netdev_priv(wilc_netdev); */
|
|
|
|
|
|
|
|
skb->protocol = eth_type_trans(skb, wilc_netdev);
|
|
|
|
/* Send the packet to the stack by giving it to the bridge */
|
|
|
|
nic->netstats.rx_packets++;
|
|
|
|
nic->netstats.rx_bytes += frame_len;
|
|
|
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
|
|
|
stats = netif_rx(skb);
|
|
|
|
PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:51 +01:00
|
|
|
void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
|
|
|
|
/*Pass the frame on the monitor interface, if any.*/
|
|
|
|
/*Otherwise, pass it on p2p0 netdev, if registered on it*/
|
2015-10-27 10:27:51 +01:00
|
|
|
for (i = 0; i < wilc->vif_num; i++) {
|
|
|
|
nic = netdev_priv(wilc->vif[i].ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
if (nic->monitor_flag) {
|
|
|
|
WILC_WFI_monitor_rx(buff, size);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-27 10:27:51 +01:00
|
|
|
nic = netdev_priv(wilc->vif[1].ndev); /* p2p0 */
|
2015-05-11 07:30:56 +02:00
|
|
|
if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
|
2015-07-28 10:47:37 +02:00
|
|
|
(buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
|
2015-10-27 10:27:51 +01:00
|
|
|
WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
|
2015-10-29 04:18:50 +01:00
|
|
|
void wl_wlan_cleanup(struct wilc *wilc)
|
2015-10-20 07:26:52 +02:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
|
|
|
|
|
2015-10-29 04:18:50 +01:00
|
|
|
if (wilc &&
|
|
|
|
(wilc->vif[0].ndev || wilc->vif[1].ndev)) {
|
2015-10-20 07:26:52 +02:00
|
|
|
unregister_inetaddr_notifier(&g_dev_notifier);
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
|
2015-10-29 04:18:50 +01:00
|
|
|
nic[i] = netdev_priv(wilc->vif[i].ndev);
|
2015-10-20 07:26:52 +02:00
|
|
|
}
|
|
|
|
|
2015-10-29 04:18:50 +01:00
|
|
|
if (wilc && wilc->firmware)
|
|
|
|
release_firmware(wilc->firmware);
|
2015-10-20 07:26:52 +02:00
|
|
|
|
2015-10-29 04:18:50 +01:00
|
|
|
if (wilc&&
|
|
|
|
(wilc->vif[0].ndev || wilc->vif[1].ndev)) {
|
2015-10-20 07:26:52 +02:00
|
|
|
linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000);
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
|
2015-10-29 04:18:50 +01:00
|
|
|
if (wilc->vif[i].ndev)
|
2015-10-20 07:26:52 +02:00
|
|
|
if (nic[i]->mac_opened)
|
2015-10-29 04:18:50 +01:00
|
|
|
mac_close(wilc->vif[i].ndev);
|
2015-10-20 07:26:52 +02:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
|
2015-10-29 04:18:50 +01:00
|
|
|
unregister_netdev(wilc->vif[i].ndev);
|
|
|
|
wilc_free_wiphy(wilc->vif[i].ndev);
|
|
|
|
free_netdev(wilc->vif[i].ndev);
|
2015-10-20 07:26:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 04:18:50 +01:00
|
|
|
kfree(wilc);
|
2015-10-20 07:26:52 +02:00
|
|
|
|
|
|
|
#if defined(WILC_DEBUGFS)
|
|
|
|
wilc_debugfs_remove();
|
|
|
|
#endif
|
|
|
|
linux_wlan_device_detection(0);
|
|
|
|
linux_wlan_device_power(0);
|
|
|
|
}
|
|
|
|
|
2015-10-20 07:26:56 +02:00
|
|
|
int wilc_netdev_init(struct wilc **wilc)
|
2015-05-11 07:30:56 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
perInterface_wlan_t *nic;
|
|
|
|
struct net_device *ndev;
|
|
|
|
|
2015-09-04 04:56:21 +02:00
|
|
|
sema_init(&close_exit_sync, 0);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
/*create the common structure*/
|
2015-10-14 13:46:30 +02:00
|
|
|
g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
|
2015-09-07 17:36:36 +02:00
|
|
|
if (!g_linux_wlan)
|
|
|
|
return -ENOMEM;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
2015-10-20 07:26:56 +02:00
|
|
|
*wilc = g_linux_wlan;
|
|
|
|
|
2015-05-11 07:30:56 +02:00
|
|
|
register_inetaddr_notifier(&g_dev_notifier);
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
|
|
|
|
/*allocate first ethernet device with perinterface_wlan_t as its private data*/
|
|
|
|
ndev = alloc_etherdev(sizeof(perInterface_wlan_t));
|
|
|
|
if (!ndev) {
|
|
|
|
PRINT_ER("Failed to allocate ethernet dev\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
nic = netdev_priv(ndev);
|
|
|
|
memset(nic, 0, sizeof(perInterface_wlan_t));
|
|
|
|
|
|
|
|
/*Name the Devices*/
|
|
|
|
if (i == 0) {
|
|
|
|
#if defined(NM73131) /* tony, 2012-09-20 */
|
|
|
|
strcpy(ndev->name, "wilc_eth%d");
|
|
|
|
#elif defined(PLAT_CLM9722) /* rachel */
|
|
|
|
strcpy(ndev->name, "eth%d");
|
|
|
|
#else /* PANDA_BOARD, PLAT_ALLWINNER_A10, PLAT_ALLWINNER_A20, PLAT_ALLWINNER_A31, PLAT_AML8726_M3 or PLAT_WMS8304 */
|
|
|
|
strcpy(ndev->name, "wlan%d");
|
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
strcpy(ndev->name, "p2p%d");
|
|
|
|
|
2015-10-20 07:26:46 +02:00
|
|
|
nic->u8IfIdx = g_linux_wlan->vif_num;
|
2015-05-11 07:30:56 +02:00
|
|
|
nic->wilc_netdev = ndev;
|
2015-10-20 10:13:51 +02:00
|
|
|
nic->wilc = *wilc;
|
2015-10-20 07:26:51 +02:00
|
|
|
g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
|
2015-10-20 07:26:46 +02:00
|
|
|
g_linux_wlan->vif_num++;
|
2015-05-29 22:52:12 +02:00
|
|
|
ndev->netdev_ops = &wilc_netdev_ops;
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
struct wireless_dev *wdev;
|
|
|
|
/*Register WiFi*/
|
2015-09-20 08:51:09 +02:00
|
|
|
wdev = wilc_create_wiphy(ndev);
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
#ifdef WILC_SDIO
|
|
|
|
/* set netdev, tony */
|
|
|
|
SET_NETDEV_DEV(ndev, &local_sdio_func->dev);
|
|
|
|
#endif
|
|
|
|
|
2015-11-05 06:36:10 +01:00
|
|
|
if (!wdev) {
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Can't register WILC Wiphy\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*linking the wireless_dev structure with the netdevice*/
|
|
|
|
nic->wilc_netdev->ieee80211_ptr = wdev;
|
|
|
|
nic->wilc_netdev->ml_priv = nic;
|
|
|
|
wdev->netdev = nic->wilc_netdev;
|
|
|
|
nic->netstats.rx_packets = 0;
|
|
|
|
nic->netstats.tx_packets = 0;
|
|
|
|
nic->netstats.rx_bytes = 0;
|
|
|
|
nic->netstats.tx_bytes = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (register_netdev(ndev)) {
|
|
|
|
PRINT_ER("Device couldn't be registered - %s\n", ndev->name);
|
|
|
|
return -1; /* ERROR */
|
|
|
|
}
|
|
|
|
|
|
|
|
nic->iftype = STATION_MODE;
|
|
|
|
nic->mac_opened = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef WILC_SDIO
|
|
|
|
if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) {
|
2015-08-08 14:11:35 +02:00
|
|
|
PRINT_ER("Can't initialize SPI\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
return -1; /* ERROR */
|
|
|
|
}
|
|
|
|
g_linux_wlan->wilc_spidev = wilc_spi_dev;
|
|
|
|
#else
|
|
|
|
g_linux_wlan->wilc_sdio_func = local_sdio_func;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*The 1st function called after module inserted*/
|
|
|
|
static int __init init_wilc_driver(void)
|
|
|
|
{
|
2015-10-27 10:20:14 +01:00
|
|
|
#ifdef WILC_SPI
|
|
|
|
struct wilc *wilc;
|
|
|
|
#endif
|
|
|
|
|
2015-07-28 10:47:39 +02:00
|
|
|
#if defined(WILC_DEBUGFS)
|
2015-05-11 07:30:56 +02:00
|
|
|
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");
|
2015-05-29 22:52:15 +02:00
|
|
|
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
|
2015-05-11 07:30:56 +02:00
|
|
|
|
|
|
|
linux_wlan_device_power(1);
|
|
|
|
msleep(100);
|
|
|
|
linux_wlan_device_detection(1);
|
|
|
|
|
|
|
|
#ifdef WILC_SDIO
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = sdio_register_driver(&wilc_bus);
|
2015-07-28 10:47:37 +02:00
|
|
|
if (ret < 0)
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
PRINT_D(INIT_DBG, "Initializing netdev\n");
|
2015-10-27 10:20:14 +01:00
|
|
|
if (wilc_netdev_init(&wilc))
|
2015-05-11 07:30:56 +02:00
|
|
|
PRINT_ER("Couldn't initialize netdev\n");
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
late_initcall(init_wilc_driver);
|
|
|
|
|
|
|
|
static void __exit exit_wilc_driver(void)
|
|
|
|
{
|
2015-10-02 09:41:13 +02:00
|
|
|
#ifndef WILC_SDIO
|
2015-10-18 17:31:11 +02:00
|
|
|
PRINT_D(INIT_DBG, "SPI unregister...\n");
|
2015-10-02 09:41:13 +02:00
|
|
|
spi_unregister_driver(&wilc_bus);
|
|
|
|
#else
|
2015-10-18 17:31:11 +02:00
|
|
|
PRINT_D(INIT_DBG, "SDIO unregister...\n");
|
2015-10-02 09:41:13 +02:00
|
|
|
sdio_unregister_driver(&wilc_bus);
|
|
|
|
#endif
|
2015-05-11 07:30:56 +02:00
|
|
|
}
|
|
|
|
module_exit(exit_wilc_driver);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|