2018-07-16 14:03:36

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 0/6] rsi: miscellaneous driver cleanups

From: Siva Rebbagondla <[email protected]>

This patch set consists some miscellaneous driver cleanups for
Redpine wlan driver.

Amol Hanwate (3):
rsi: Correct RSI_NEEDED_HEADROOM in mac80211_attach.
rsi: fill rx_params only once.
rsi: move init_done flag to end of rsi_91x_init().

Siva Rebbagondla (3):
rsi: remove redundant device ids
rsi: remove redundant flash_content variable
rsi: add firmware support for AP+BT dual mode

drivers/net/wireless/rsi/rsi_91x_hal.c | 26 ++++++++++----------------
drivers/net/wireless/rsi/rsi_91x_main.c | 7 +------
drivers/net/wireless/rsi/rsi_91x_sdio.c | 5 +----
drivers/net/wireless/rsi/rsi_91x_usb.c | 6 +-----
drivers/net/wireless/rsi/rsi_mgmt.h | 2 +-
drivers/net/wireless/rsi/rsi_sdio.h | 3 +++
drivers/net/wireless/rsi/rsi_usb.h | 3 +++
7 files changed, 20 insertions(+), 32 deletions(-)

--
2.5.5


2018-07-16 14:03:49

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 4/6] rsi: Correct RSI_NEEDED_HEADROOM in mac80211_attach.

From: Amol Hanwate <[email protected]>

Currently, RSI_NEEDED_HEADROOM is '80' for rsi driver, which is wrong.
As per rsi internal frame format, the RSI_NEEDED_HEADROOM shall be '84',
which is 64(dword_align) + 4(extended_desc) + 16(frame_desc).
Hence, corrected the needed headroom.

Signed-off-by: Amol Hanwate <[email protected]>
Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_mgmt.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h b/drivers/net/wireless/rsi/rsi_mgmt.h
index 1462093..359fbdf 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -22,7 +22,7 @@
#include "rsi_main.h"

#define MAX_MGMT_PKT_SIZE 512
-#define RSI_NEEDED_HEADROOM 80
+#define RSI_NEEDED_HEADROOM 84
#define RSI_RCV_BUFFER_LEN 2000

#define RSI_11B_MODE 0
--
2.5.5

2018-07-16 14:03:39

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 1/6] rsi: remove redundant device ids

From: Siva Rebbagondla <[email protected]>

Removing redundant device id's from both usb and sdio idtables, as rsi
driver currently supporting only one module(RS9113). Also, replaced ids
with specific defines.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_sdio.c | 5 +----
drivers/net/wireless/rsi/rsi_91x_usb.c | 6 +-----
drivers/net/wireless/rsi/rsi_sdio.h | 3 +++
drivers/net/wireless/rsi/rsi_usb.h | 3 +++
4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index 416981d..5733e44 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1394,10 +1394,7 @@ static const struct dev_pm_ops rsi_pm_ops = {
#endif

static const struct sdio_device_id rsi_dev_table[] = {
- { SDIO_DEVICE(0x303, 0x100) },
- { SDIO_DEVICE(0x041B, 0x0301) },
- { SDIO_DEVICE(0x041B, 0x0201) },
- { SDIO_DEVICE(0x041B, 0x9330) },
+ { SDIO_DEVICE(RSI_SDIO_VID_9113, RSI_SDIO_PID_9113) },
{ /* Blank */},
};

diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
index 6ce6b75..c0a163e 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -835,11 +835,7 @@ static int rsi_resume(struct usb_interface *intf)
#endif

static const struct usb_device_id rsi_dev_table[] = {
- { USB_DEVICE(0x0303, 0x0100) },
- { USB_DEVICE(0x041B, 0x0301) },
- { USB_DEVICE(0x041B, 0x0201) },
- { USB_DEVICE(0x041B, 0x9330) },
- { USB_DEVICE(0x1618, 0x9113) },
+ { USB_DEVICE(RSI_USB_VID_9113, RSI_USB_PID_9113) },
{ /* Blank */},
};

diff --git a/drivers/net/wireless/rsi/rsi_sdio.h b/drivers/net/wireless/rsi/rsi_sdio.h
index 353dbdf..66dcd2e 100644
--- a/drivers/net/wireless/rsi/rsi_sdio.h
+++ b/drivers/net/wireless/rsi/rsi_sdio.h
@@ -28,6 +28,9 @@
#include <linux/mmc/sdio_ids.h>
#include "rsi_main.h"

+#define RSI_SDIO_VID_9113 0x041B
+#define RSI_SDIO_PID_9113 0x9330
+
enum sdio_interrupt_type {
BUFFER_FULL = 0x0,
BUFFER_AVAILABLE = 0x2,
diff --git a/drivers/net/wireless/rsi/rsi_usb.h b/drivers/net/wireless/rsi/rsi_usb.h
index b6fe79f..5b2eddd 100644
--- a/drivers/net/wireless/rsi/rsi_usb.h
+++ b/drivers/net/wireless/rsi/rsi_usb.h
@@ -22,6 +22,9 @@
#include "rsi_main.h"
#include "rsi_common.h"

+#define RSI_USB_VID_9113 0x1618
+#define RSI_USB_PID_9113 0x9113
+
#define USB_INTERNAL_REG_1 0x25000
#define RSI_USB_READY_MAGIC_NUM 0xab
#define FW_STATUS_REG 0x41050012
--
2.5.5

2018-07-16 14:03:55

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 6/6] rsi: move init_done flag to end of rsi_91x_init().

From: Amol Hanwate <[email protected]>

common->init_done flag should set after basic initialization. Hence,
moving init_done flag at end of rsi_91x_init().

Signed-off-by: Amol Hanwate <[email protected]>
Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index 34a5d9c..01d99ed 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -331,7 +331,6 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode)
spin_lock_init(&adapter->ps_lock);
timer_setup(&common->roc_timer, rsi_roc_timeout, 0);
init_completion(&common->wlan_init_completion);
- common->init_done = true;
adapter->device_model = RSI_DEV_9113;
common->oper_mode = oper_mode;

@@ -369,6 +368,7 @@ struct rsi_hw *rsi_91x_init(u16 oper_mode)
}
#endif

+ common->init_done = true;
return adapter;

err:
--
2.5.5

2018-07-31 08:55:24

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/6] rsi: remove redundant device ids

Siva Rebbagondla <[email protected]> wrote:

> From: Siva Rebbagondla <[email protected]>
>
> Removing redundant device id's from both usb and sdio idtables, as rsi
> driver currently supporting only one module(RS9113). Also, replaced ids
> with specific defines.
>
> Signed-off-by: Siva Rebbagondla <[email protected]>

6 patches applied to wireless-drivers-next.git, thanks.

5850874c28a4 rsi: remove redundant device ids
bae402920424 rsi: remove redundant flash_content variable
f5fbce65abcf rsi: add firmware support for AP+BT dual mode
abbe87d339bd rsi: Correct RSI_NEEDED_HEADROOM in mac80211_attach.
160ee2a11ce0 rsi: fill rx_params only once.
2ddd82eef2ef rsi: move init_done flag to end of rsi_91x_init().

--
https://patchwork.kernel.org/patch/10526805/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2018-07-16 14:03:45

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 3/6] rsi: add firmware support for AP+BT dual mode

From: Siva Rebbagondla <[email protected]>

Currently, AP mode will work on only WLAN alone firmware. To give support
for AP and BT dual mode, adding firmware entry in 'struct ta_metadata'.
The firmware entry is based on what coex_mode is used in driver and coex
mode '4' for all AP+BT related functionalities. Hence, added the same.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_hal.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 150c3e6..27e6baf 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -26,6 +26,9 @@ static struct ta_metadata metadata_flash_content[] = {
{"flash_content", 0x00010000},
{"rsi/rs9113_wlan_qspi.rps", 0x00010000},
{"rsi/rs9113_wlan_bt_dual_mode.rps", 0x00010000},
+ {"flash_content", 0x00010000},
+ {"rsi/rs9113_ap_bt_dual_mode.rps", 0x00010000},
+
};

int rsi_send_pkt_to_bus(struct rsi_common *common, struct sk_buff *skb)
--
2.5.5

2018-07-16 14:03:42

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 2/6] rsi: remove redundant flash_content variable

From: Siva Rebbagondla <[email protected]>

while cleaning up the driver, observed that flash_content pointer is not
necessary in rsi_load_firmware(). Instead of this, driver can use
'fw_entry->data' directly.Hence, removed redundant flash_content pointer.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_hal.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 533d9e9..150c3e6 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -842,7 +842,6 @@ static int rsi_load_firmware(struct rsi_hw *adapter)
const struct firmware *fw_entry = NULL;
u32 regout_val = 0, content_size;
u16 tmp_regout_val = 0;
- u8 *flash_content = NULL;
struct ta_metadata *metadata_p;
int status;

@@ -904,28 +903,22 @@ static int rsi_load_firmware(struct rsi_hw *adapter)
__func__, metadata_p->name);
return status;
}
- flash_content = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
- if (!flash_content) {
- rsi_dbg(ERR_ZONE, "%s: Failed to copy firmware\n", __func__);
- status = -EIO;
- goto fail;
- }
content_size = fw_entry->size;
rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", content_size);

/* Get the firmware version */
common->lmac_ver.ver.info.fw_ver[0] =
- flash_content[LMAC_VER_OFFSET] & 0xFF;
+ fw_entry->data[LMAC_VER_OFFSET] & 0xFF;
common->lmac_ver.ver.info.fw_ver[1] =
- flash_content[LMAC_VER_OFFSET + 1] & 0xFF;
- common->lmac_ver.major = flash_content[LMAC_VER_OFFSET + 2] & 0xFF;
+ fw_entry->data[LMAC_VER_OFFSET + 1] & 0xFF;
+ common->lmac_ver.major = fw_entry->data[LMAC_VER_OFFSET + 2] & 0xFF;
common->lmac_ver.release_num =
- flash_content[LMAC_VER_OFFSET + 3] & 0xFF;
- common->lmac_ver.minor = flash_content[LMAC_VER_OFFSET + 4] & 0xFF;
+ fw_entry->data[LMAC_VER_OFFSET + 3] & 0xFF;
+ common->lmac_ver.minor = fw_entry->data[LMAC_VER_OFFSET + 4] & 0xFF;
common->lmac_ver.patch_num = 0;
rsi_print_version(common);

- status = bl_write_header(adapter, flash_content, content_size);
+ status = bl_write_header(adapter, (u8 *)fw_entry->data, content_size);
if (status) {
rsi_dbg(ERR_ZONE,
"%s: RPS Image header loading failed\n",
@@ -967,7 +960,7 @@ static int rsi_load_firmware(struct rsi_hw *adapter)

rsi_dbg(INFO_ZONE, "Burn Command Pass.. Upgrading the firmware\n");

- status = auto_fw_upgrade(adapter, flash_content, content_size);
+ status = auto_fw_upgrade(adapter, (u8 *)fw_entry->data, content_size);
if (status == 0) {
rsi_dbg(ERR_ZONE, "Firmware upgradation Done\n");
goto load_image_cmd;
@@ -981,13 +974,11 @@ static int rsi_load_firmware(struct rsi_hw *adapter)

success:
rsi_dbg(ERR_ZONE, "***** Firmware Loading successful *****\n");
- kfree(flash_content);
release_firmware(fw_entry);
return 0;

fail:
rsi_dbg(ERR_ZONE, "##### Firmware loading failed #####\n");
- kfree(flash_content);
release_firmware(fw_entry);
return status;
}
--
2.5.5

2018-07-16 14:03:51

by Siva Rebbagondla

[permalink] [raw]
Subject: [PATCH 5/6] rsi: fill rx_params only once.

From: Amol Hanwate <[email protected]>

rx_params are getting updated two times in driver, which is not required.
Hence, removing duplicate updation of rx_params from rsi_prepare_skb().

Signed-off-by: Amol Hanwate <[email protected]>
Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_main.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index 1485a0c..34a5d9c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -122,7 +122,6 @@ static struct sk_buff *rsi_prepare_skb(struct rsi_common *common,
u8 extended_desc)
{
struct ieee80211_tx_info *info;
- struct skb_info *rx_params;
struct sk_buff *skb = NULL;
u8 payload_offset;
struct ieee80211_vif *vif;
@@ -149,10 +148,6 @@ static struct sk_buff *rsi_prepare_skb(struct rsi_common *common,
vif = rsi_get_vif(common->priv, wh->addr1);

info = IEEE80211_SKB_CB(skb);
- rx_params = (struct skb_info *)info->driver_data;
- rx_params->rssi = rsi_get_rssi(buffer);
- rx_params->channel = rsi_get_connected_channel(vif);
-
return skb;
}

--
2.5.5