Skip to content

Commit

Permalink
mwifiex: add support for Marvell pcie8766 chipset
Browse files Browse the repository at this point in the history
This patch supports 88W8766P chipset with a PCIe interface.

The corresponding firmware image file is located at:
"mrvl/pcie8766_uapsta.bin"

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Ramesh Radhakrishnan <rramesh@marvell.com>
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Frank Huang <frankh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Amitkumar Karwar authored and linvjw committed Oct 12, 2011
1 parent ec20599 commit d930fae
Show file tree
Hide file tree
Showing 18 changed files with 2,284 additions and 37 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/mwifiex/11n_aggr.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
tx_param.next_pkt_len = 0;

ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA,
skb_aggr->data,
skb_aggr->len, &tx_param);
skb_aggr, &tx_param);
switch (ret) {
case -EBUSY:
spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags);
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/wireless/mwifiex/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ config MWIFIEX_SDIO

If you choose to build it as a module, it will be called
mwifiex_sdio.

config MWIFIEX_PCIE
tristate "Marvell WiFi-Ex Driver for PCIE 8766"
depends on MWIFIEX && PCI
select FW_LOADER
---help---
This adds support for wireless adapters based on Marvell
8766 chipset with PCIe interface.

If you choose to build it as a module, it will be called
mwifiex_pcie.
3 changes: 3 additions & 0 deletions drivers/net/wireless/mwifiex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ obj-$(CONFIG_MWIFIEX) += mwifiex.o

mwifiex_sdio-y += sdio.o
obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o

mwifiex_pcie-y += pcie.o
obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o
11 changes: 4 additions & 7 deletions drivers/net/wireless/mwifiex/cmdevt.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
skb_trim(cmd_node->cmd_skb, 0);

if (cmd_node->resp_skb) {
dev_kfree_skb_any(cmd_node->resp_skb);
adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb);
cmd_node->resp_skb = NULL;
}
}
Expand Down Expand Up @@ -176,8 +176,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN);

ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
cmd_node->cmd_skb->data,
cmd_node->cmd_skb->len, NULL);
cmd_node->cmd_skb, NULL);

skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN);

Expand Down Expand Up @@ -238,8 +237,7 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)

skb_push(adapter->sleep_cfm, INTF_HEADER_LEN);
ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD,
adapter->sleep_cfm->data,
adapter->sleep_cfm->len, NULL);
adapter->sleep_cfm, NULL);
skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN);

if (ret == -1) {
Expand Down Expand Up @@ -402,8 +400,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)

adapter->event_cause = 0;
adapter->event_skb = NULL;

dev_kfree_skb_any(skb);
adapter->if_ops.event_complete(adapter, skb);

return ret;
}
Expand Down
30 changes: 28 additions & 2 deletions drivers/net/wireless/mwifiex/fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ enum KEY_TYPE_ID {

#define MAX_FIRMWARE_POLL_TRIES 100

#define FIRMWARE_READY 0xfedc
#define FIRMWARE_READY_SDIO 0xfedc
#define FIRMWARE_READY_PCIE 0xfedcba00

enum MWIFIEX_802_11_PRIVACY_FILTER {
MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL,
Expand Down Expand Up @@ -221,7 +222,7 @@ enum MWIFIEX_802_11_WEP_STATUS {
#define HostCmd_CMD_802_11_HS_CFG_ENH 0x00e5
#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
#define HostCmd_CMD_SET_BSS_MODE 0x00f7

#define HostCmd_CMD_PCIE_DESC_DETAILS 0x00fa

enum ENH_PS_MODES {
EN_PS = 1,
Expand Down Expand Up @@ -1137,6 +1138,30 @@ struct host_cmd_ds_set_bss_mode {
u8 con_type;
} __packed;

struct host_cmd_ds_pcie_details {
/* TX buffer descriptor ring address */
u32 txbd_addr_lo;
u32 txbd_addr_hi;
/* TX buffer descriptor ring count */
u32 txbd_count;

/* RX buffer descriptor ring address */
u32 rxbd_addr_lo;
u32 rxbd_addr_hi;
/* RX buffer descriptor ring count */
u32 rxbd_count;

/* Event buffer descriptor ring address */
u32 evtbd_addr_lo;
u32 evtbd_addr_hi;
/* Event buffer descriptor ring count */
u32 evtbd_count;

/* Sleep cookie buffer physical address */
u32 sleep_cookie_addr_lo;
u32 sleep_cookie_addr_hi;
} __packed;

struct host_cmd_ds_command {
__le16 command;
__le16 size;
Expand Down Expand Up @@ -1184,6 +1209,7 @@ struct host_cmd_ds_command {
struct host_cmd_ds_rf_reg_access rf_reg;
struct host_cmd_ds_pmic_reg_access pmic_reg;
struct host_cmd_ds_set_bss_mode bss_mode;
struct host_cmd_ds_pcie_details pcie_host_spec;
struct host_cmd_ds_802_11_eeprom_access eeprom;
} params;
} __packed;
Expand Down
17 changes: 12 additions & 5 deletions drivers/net/wireless/mwifiex/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
(adapter->sleep_cfm->data);

adapter->cmd_sent = false;
adapter->data_sent = true;

if (adapter->iface_type == MWIFIEX_PCIE)
adapter->data_sent = false;
else
adapter->data_sent = true;

adapter->cmd_resp_received = false;
adapter->event_received = false;
adapter->data_received = false;
Expand Down Expand Up @@ -581,11 +586,13 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
struct mwifiex_fw_image *pmfw)
{
int ret, winner;
int ret;
u32 poll_num = 1;

adapter->winner = 0;

/* Check if firmware is already running */
ret = adapter->if_ops.check_fw_status(adapter, poll_num, &winner);
ret = adapter->if_ops.check_fw_status(adapter, poll_num);
if (!ret) {
dev_notice(adapter->dev,
"WLAN FW already running! Skip FW download\n");
Expand All @@ -594,7 +601,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
poll_num = MAX_FIRMWARE_POLL_TRIES;

/* Check if we are the winner for downloading FW */
if (!winner) {
if (!adapter->winner) {
dev_notice(adapter->dev,
"Other interface already running!"
" Skip FW download\n");
Expand All @@ -612,7 +619,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,

poll_fw:
/* Check if the firmware is downloaded successfully or not */
ret = adapter->if_ops.check_fw_status(adapter, poll_num, NULL);
ret = adapter->if_ops.check_fw_status(adapter, poll_num);
if (ret) {
dev_err(adapter->dev, "FW failed to be active in time\n");
return -1;
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/mwifiex/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter)
*/
int
mwifiex_add_card(void *card, struct semaphore *sem,
struct mwifiex_if_ops *if_ops)
struct mwifiex_if_ops *if_ops, u8 iface_type)
{
struct mwifiex_adapter *adapter;
char fmt[64];
Expand All @@ -675,6 +675,8 @@ mwifiex_add_card(void *card, struct semaphore *sem,
goto err_init_sw;
}

adapter->iface_type = iface_type;

adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING;
adapter->surprise_removed = false;
init_waitqueue_head(&adapter->init_wait_q);
Expand Down
20 changes: 16 additions & 4 deletions drivers/net/wireless/mwifiex/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "ioctl.h"
#include "util.h"
#include "fw.h"
#include "pcie.h"

extern const char driver_version[];

Expand Down Expand Up @@ -107,6 +108,8 @@ enum {

#define MAX_FREQUENCY_BAND_BG 2484

#define MWIFIEX_EVENT_HEADER_LEN 4

struct mwifiex_dbg {
u32 num_cmd_host_to_card_failure;
u32 num_cmd_sleep_cfm_host_to_card_failure;
Expand Down Expand Up @@ -156,6 +159,11 @@ enum MWIFIEX_PS_STATE {
PS_STATE_SLEEP
};

enum mwifiex_iface_type {
MWIFIEX_SDIO,
MWIFIEX_PCIE,
};

struct mwifiex_add_ba_param {
u32 tx_win_size;
u32 rx_win_size;
Expand Down Expand Up @@ -517,27 +525,31 @@ struct cmd_ctrl_node {
struct mwifiex_if_ops {
int (*init_if) (struct mwifiex_adapter *);
void (*cleanup_if) (struct mwifiex_adapter *);
int (*check_fw_status) (struct mwifiex_adapter *, u32, int *);
int (*check_fw_status) (struct mwifiex_adapter *, u32);
int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
int (*register_dev) (struct mwifiex_adapter *);
void (*unregister_dev) (struct mwifiex_adapter *);
int (*enable_int) (struct mwifiex_adapter *);
int (*process_int_status) (struct mwifiex_adapter *);
int (*host_to_card) (struct mwifiex_adapter *, u8,
u8 *payload, u32 pkt_len,
int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
struct mwifiex_tx_param *);
int (*wakeup) (struct mwifiex_adapter *);
int (*wakeup_complete) (struct mwifiex_adapter *);

/* Interface specific functions */
void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
};

struct mwifiex_adapter {
u8 iface_type;
struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
u8 priv_num;
const struct firmware *firmware;
char fw_name[32];
int winner;
struct device *dev;
bool surprise_removed;
u32 fw_release_number;
Expand Down Expand Up @@ -872,7 +884,7 @@ struct mwifiex_private *mwifiex_bss_index_to_priv(struct mwifiex_adapter
*adapter, u8 bss_index);
int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
u32 func_init_shutdown);
int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *);
int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *);

void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
Expand Down

0 comments on commit d930fae

Please sign in to comment.