2017-04-07 10:51:58

by Xinming Hu

[permalink] [raw]
Subject: [PATCH v2 1/4] mwifiex: remove unnecessary wakeup interrupt number sanity check

From: Xinming Hu <[email protected]>

If wakeup interrupt handler is called, we know that the wakeup
interrupt number is valid, there is no need to check it.

Signed-off-by: Xinming Hu <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Reviewed-by: Brian Norris <[email protected]>
---
v2: modify description(Dimtry)
---
drivers/net/wireless/marvell/mwifiex/main.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 0dfbac8..98fd491 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -1513,11 +1513,9 @@ static irqreturn_t mwifiex_irq_wakeup_handler(int irq, void *priv)
{
struct mwifiex_adapter *adapter = priv;

- if (adapter->irq_wakeup >= 0) {
- dev_dbg(adapter->dev, "%s: wake by wifi", __func__);
- adapter->wake_by_wifi = true;
- disable_irq_nosync(irq);
- }
+ dev_dbg(adapter->dev, "%s: wake by wifi", __func__);
+ adapter->wake_by_wifi = true;
+ disable_irq_nosync(irq);

/* Notify PM core we are wakeup source */
pm_wakeup_event(adapter->dev, 0);
--
1.8.1.4


2017-04-10 09:08:54

by Xinming Hu

[permalink] [raw]
Subject: RE: Re: [PATCH v2 2/4] mwifiex: fall back mwifiex_dbg to pr_info when adapter->dev not set

SGkgRG1pdHJ5LA0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IERtaXRy
eSBUb3Jva2hvdiBbbWFpbHRvOmR0b3JAZ29vZ2xlLmNvbV0NCj4gU2VudDogMjAxN+W5tDTmnIg4
5pelIDE6MjgNCj4gVG86IFhpbm1pbmcgSHUNCj4gQ2M6IExpbnV4IFdpcmVsZXNzOyBLYWxsZSBW
YWxv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IHByb3Blcmx5IChJ
IGFtIG5vdCBzdXJlIGlmIGl0IGlzIHNldCBvciBub3QpLg0KPiANCg0KWWVzLCB3ZSBoYXZlIHRo
ZSBiZWxvdyBkZWZpbmU6DQojZGVmaW5lIHByX2ZtdChmbXQpIEtCVUlMRF9NT0ROQU1FICI6ICIg
Zm10DQoNClRoYW5rcw0KU2ltb24NCg0KPiBUaGFua3MuDQo+IA0KPiAtLQ0KPiBEbWl0cnkNCg==

2017-04-07 10:52:05

by Xinming Hu

[permalink] [raw]
Subject: [PATCH v2 4/4] mwifiex: pcie: extract wifi part from combo firmware during function level reset

From: Xinming Hu <[email protected]>

A seperate wifi-only firmware was download during pcie function level reset.
It is in fact the tail part of wifi/bt combo firmware. Per Brian's and
Dmitry's suggestion, this patch extract the wifi part from combo firmware.

After that, we can discard the redudant image in linux-firmware repo.

Signed-off-by: Xinming Hu <[email protected]>
Signed-off-by: Ganapathi Bhat <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
v2: extract wifi part from combo firmware(Dimtry and Brain)
add more description(Kalle)
---
drivers/net/wireless/marvell/mwifiex/fw.h | 18 +++++++
drivers/net/wireless/marvell/mwifiex/pcie.c | 83 ++++++++++++++++++++++++++---
drivers/net/wireless/marvell/mwifiex/pcie.h | 2 +
3 files changed, 96 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
index 0b68374..6cf9ab9 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -43,6 +43,24 @@ struct tx_packet_hdr {
struct rfc_1042_hdr rfc1042_hdr;
} __packed;

+struct mwifiex_fw_header {
+ __le32 dnld_cmd;
+ __le32 base_addr;
+ __le32 data_length;
+ __le32 crc;
+} __packed;
+
+struct mwifiex_fw_data {
+ struct mwifiex_fw_header header;
+ __le32 seq_num;
+ u8 data[1];
+} __packed;
+
+#define MWIFIEX_FW_DNLD_CMD_1 0x1
+#define MWIFIEX_FW_DNLD_CMD_5 0x5
+#define MWIFIEX_FW_DNLD_CMD_6 0x6
+#define MWIFIEX_FW_DNLD_CMD_7 0x7
+
#define B_SUPPORTED_RATES 5
#define G_SUPPORTED_RATES 9
#define BG_SUPPORTED_RATES 13
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index a07cb0a..ebf00d9 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -1956,6 +1956,63 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
return ret;
}

+/* Extract wifi part from wifi-bt combo firmware image.
+ */
+
+static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
+ u8 *firmware, u32 firmware_len) {
+ struct mwifiex_fw_data fwdata;
+ u32 offset = 0, data_len, dnld_cmd;
+ int ret = 0;
+ bool cmd7_before = false;
+
+ while (1) {
+ if (offset + sizeof(fwdata.header) >= firmware_len) {
+ mwifiex_dbg(adapter, ERROR,
+ "extract wifi-only firmware failure!");
+ ret = -1;
+ goto done;
+ }
+
+ memcpy(&fwdata.header, firmware + offset,
+ sizeof(fwdata.header));
+ dnld_cmd = le32_to_cpu(fwdata.header.dnld_cmd);
+ data_len = le32_to_cpu(fwdata.header.data_length);
+
+ switch (dnld_cmd) {
+ case MWIFIEX_FW_DNLD_CMD_1:
+ if (!cmd7_before) {
+ mwifiex_dbg(adapter, ERROR,
+ "no cmd7 before cmd1!");
+ ret = -1;
+ goto done;
+ }
+ offset += data_len + sizeof(fwdata.header);
+ break;
+ case MWIFIEX_FW_DNLD_CMD_5:
+ offset += data_len + sizeof(fwdata.header);
+ break;
+ case MWIFIEX_FW_DNLD_CMD_6:
+ offset += data_len + sizeof(fwdata.header);
+ ret = offset;
+ goto done;
+ case MWIFIEX_FW_DNLD_CMD_7:
+ if (!cmd7_before)
+ cmd7_before = true;
+ offset += sizeof(fwdata.header);
+ break;
+ default:
+ mwifiex_dbg(adapter, ERROR, "unknown dnld_cmd %d\n",
+ dnld_cmd);
+ ret = -1;
+ goto done;
+ }
+ }
+
+done:
+ return ret;
+}
+
/*
* This function downloads the firmware to the card.
*
@@ -1971,7 +2028,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
u32 firmware_len = fw->fw_len;
u32 offset = 0;
struct sk_buff *skb;
- u32 txlen, tx_blocks = 0, tries, len;
+ u32 txlen, tx_blocks = 0, tries, len, val;
u32 block_retry_cnt = 0;
struct pcie_service_card *card = adapter->card;
const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
@@ -1998,6 +2055,24 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
goto done;
}

+ ret = mwifiex_read_reg(adapter, PCIE_SCRATCH_13_REG, &val);
+ if (ret) {
+ mwifiex_dbg(adapter, FATAL, "Failed to read scratch register 13\n");
+ goto done;
+ }
+
+ /* PCIE FLR case: extract wifi part from combo firmware*/
+ if (val == MWIFIEX_PCIE_FLR_HAPPENS) {
+ ret = mwifiex_extract_wifi_fw(adapter, firmware, firmware_len);
+ if (ret < 0) {
+ mwifiex_dbg(adapter, ERROR, "Failed to extract wifi fw\n");
+ goto done;
+ }
+ offset = ret;
+ mwifiex_dbg(adapter, MSG,
+ "info: dnld wifi firmware from %d bytes\n", offset);
+ }
+
/* Perform firmware data transfer */
do {
u32 ireg_intr = 0;
@@ -3060,12 +3135,6 @@ static void mwifiex_pcie_up_dev(struct mwifiex_adapter *adapter)
struct pci_dev *pdev = card->dev;
const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;

- /* Bluetooth is not on pcie interface. Download Wifi only firmware
- * during pcie FLR, so that bluetooth part of firmware which is
- * already running doesn't get affected.
- */
- strcpy(adapter->fw_name, PCIE8997_DEFAULT_WIFIFW_NAME);
-
/* tx_buf_size might be changed to 3584 by firmware during
* data transfer, we should reset it to default size.
*/
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.h b/drivers/net/wireless/marvell/mwifiex/pcie.h
index 6ac7dcb..5bbadf7 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.h
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.h
@@ -120,6 +120,8 @@
#define MWIFIEX_SLEEP_COOKIE_SIZE 4
#define MWIFIEX_MAX_DELAY_COUNT 100

+#define MWIFIEX_PCIE_FLR_HAPPENS 0xFEDCBABA
+
struct mwifiex_pcie_card_reg {
u16 cmd_addr_lo;
u16 cmd_addr_hi;
--
1.8.1.4

2017-04-07 10:52:03

by Xinming Hu

[permalink] [raw]
Subject: [PATCH v2 3/4] mwifiex: pcie: correct scratch register name

From: Xinming Hu <[email protected]>

This patch correct pcie scratch register name, to keep the same with
chipset side definition.

Signed-off-by: Xinming Hu <[email protected]>
---
v2: code clean and prepare for next patch 4/4
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 4 ++--
drivers/net/wireless/marvell/mwifiex/pcie.h | 13 +++++++------
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index f45ab12..a07cb0a 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2494,8 +2494,8 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type,
struct pcie_service_card *card = adapter->card;
const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
int pcie_scratch_reg[] = {PCIE_SCRATCH_12_REG,
- PCIE_SCRATCH_13_REG,
- PCIE_SCRATCH_14_REG};
+ PCIE_SCRATCH_14_REG,
+ PCIE_SCRATCH_15_REG};

if (!p)
return 0;
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.h b/drivers/net/wireless/marvell/mwifiex/pcie.h
index 00e8ee5..7e2450c 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.h
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.h
@@ -77,8 +77,9 @@
#define PCIE_SCRATCH_10_REG 0xCE8
#define PCIE_SCRATCH_11_REG 0xCEC
#define PCIE_SCRATCH_12_REG 0xCF0
-#define PCIE_SCRATCH_13_REG 0xCF8
-#define PCIE_SCRATCH_14_REG 0xCFC
+#define PCIE_SCRATCH_13_REG 0xCF4
+#define PCIE_SCRATCH_14_REG 0xCF8
+#define PCIE_SCRATCH_15_REG 0xCFC
#define PCIE_RD_DATA_PTR_Q0_Q1 0xC08C
#define PCIE_WR_DATA_PTR_Q0_Q1 0xC05C

@@ -217,8 +218,8 @@ struct mwifiex_pcie_card_reg {
.ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
.pfu_enabled = 1,
.sleep_cookie = 0,
- .fw_dump_ctrl = 0xcf4,
- .fw_dump_start = 0xcf8,
+ .fw_dump_ctrl = PCIE_SCRATCH_13_REG,
+ .fw_dump_start = PCIE_SCRATCH_14_REG,
.fw_dump_end = 0xcff,
.fw_dump_host_ready = 0xee,
.fw_dump_read_done = 0xfe,
@@ -254,8 +255,8 @@ struct mwifiex_pcie_card_reg {
.ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
.pfu_enabled = 1,
.sleep_cookie = 0,
- .fw_dump_ctrl = 0xcf4,
- .fw_dump_start = 0xcf8,
+ .fw_dump_ctrl = PCIE_SCRATCH_13_REG,
+ .fw_dump_start = PCIE_SCRATCH_14_REG,
.fw_dump_end = 0xcff,
.fw_dump_host_ready = 0xcc,
.fw_dump_read_done = 0xdd,
--
1.8.1.4

2017-04-07 10:52:01

by Xinming Hu

[permalink] [raw]
Subject: [PATCH v2 2/4] mwifiex: fall back mwifiex_dbg to pr_info when adapter->dev not set

From: Xinming Hu <[email protected]>

mwifiex_dbg will do nothing before adapter->dev get assigned. several logs
lost in this case. it can be avoided by fall back to pr_info.

Signed-off-by: Xinming Hu <[email protected]>
---
v2: enhance adapter->dev null case.(Brain)
---
drivers/net/wireless/marvell/mwifiex/main.c | 17 ++++++++++++-----
drivers/net/wireless/marvell/mwifiex/main.h | 2 ++
2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 98fd491..f3e772f 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -1749,18 +1749,25 @@ void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask,
{
struct va_format vaf;
va_list args;
+ char msg[MWIFIEX_LOG_LEN];

- if (!adapter->dev || !(adapter->debug_mask & mask))
+ if (!(adapter->debug_mask & mask))
return;

va_start(args, fmt);

- vaf.fmt = fmt;
- vaf.va = &args;
-
- dev_info(adapter->dev, "%pV", &vaf);
+ if (!adapter->dev) {
+ vsnprintf(msg, MWIFIEX_LOG_LEN, fmt, args);
+ } else {
+ vaf.fmt = fmt;
+ vaf.va = &args;
+ dev_info(adapter->dev, "%pV", &vaf);
+ }

va_end(args);
+
+ if (!adapter->dev)
+ pr_info("%s", msg);
}
EXPORT_SYMBOL_GPL(_mwifiex_dbg);

diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index f1cb875..d4289a9 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -164,6 +164,8 @@ enum {
/* Address alignment */
#define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))

+#define MWIFIEX_LOG_LEN 120
+
/**
*enum mwifiex_debug_level - marvell wifi debug level
*/
--
1.8.1.4

2017-04-07 17:28:20

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] mwifiex: fall back mwifiex_dbg to pr_info when adapter->dev not set

Hi Xinming,

On Fri, Apr 7, 2017 at 3:51 AM, Xinming Hu <[email protected]> wrote:
> From: Xinming Hu <[email protected]>
>
> mwifiex_dbg will do nothing before adapter->dev get assigned. several logs
> lost in this case. it can be avoided by fall back to pr_info.
>
> Signed-off-by: Xinming Hu <[email protected]>
> ---
> v2: enhance adapter->dev null case.(Brain)
> ---
> drivers/net/wireless/marvell/mwifiex/main.c | 17 ++++++++++++-----
> drivers/net/wireless/marvell/mwifiex/main.h | 2 ++
> 2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
> index 98fd491..f3e772f 100644
> --- a/drivers/net/wireless/marvell/mwifiex/main.c
> +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> @@ -1749,18 +1749,25 @@ void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask,
> {
> struct va_format vaf;
> va_list args;
> + char msg[MWIFIEX_LOG_LEN];
>
> - if (!adapter->dev || !(adapter->debug_mask & mask))
> + if (!(adapter->debug_mask & mask))
> return;
>
> va_start(args, fmt);
>
> - vaf.fmt = fmt;
> - vaf.va = &args;
> -
> - dev_info(adapter->dev, "%pV", &vaf);
> + if (!adapter->dev) {
> + vsnprintf(msg, MWIFIEX_LOG_LEN, fmt, args);
> + } else {
> + vaf.fmt = fmt;
> + vaf.va = &args;
> + dev_info(adapter->dev, "%pV", &vaf);
> + }
>
> va_end(args);
> +
> + if (!adapter->dev)
> + pr_info("%s", msg);

Why not:

vaf.fmt = fmt;
vaf.va = &args;

if (adapter->dev)
dev_info(adapter->dev, "%pV", &vaf);
else
pr_info("mwifiex: %pV", &vaf);

va_end(args);

Also, instead of static "mwifiex" prefix maybe make sure you have
pr_fmt() set properly (I am not sure if it is set or not).

Thanks.

--
Dmitry