summaryrefslogtreecommitdiff
path: root/package/kernel
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-05-21 17:47:42 +0200
committerFelix Fietkau <nbd@nbd.name>2016-05-21 18:08:29 +0200
commit29ad4d2a0cadbefea1e7d882b44aa2bbfb711aef (patch)
tree5b94ef21230b92a63ac357ce8b770a725d3fd5f9 /package/kernel
parentab5e07f73107834192c4dc5826b7d8775d2aae1b (diff)
downloadmtk-20170518-29ad4d2a0cadbefea1e7d882b44aa2bbfb711aef.zip
mtk-20170518-29ad4d2a0cadbefea1e7d882b44aa2bbfb711aef.tar.gz
mtk-20170518-29ad4d2a0cadbefea1e7d882b44aa2bbfb711aef.tar.bz2
mwlwifi: fix excessive use of busy-waiting that was tripping up the flash driver
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch
new file mode 100644
index 0000000..43523ed
--- /dev/null
+++ b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch
@@ -0,0 +1,73 @@
+--- a/fwcmd.c
++++ b/fwcmd.c
+@@ -132,7 +132,7 @@ static int mwl_fwcmd_wait_complete(struc
+ int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[2]));
+ else
+ int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[0]));
+- mdelay(1);
++ usleep_range(1000, 2000);
+ } while ((int_code != cmd) && (--curr_iteration));
+
+ if (curr_iteration == 0) {
+@@ -142,7 +142,7 @@ static int mwl_fwcmd_wait_complete(struc
+ return -EIO;
+ }
+
+- mdelay(3);
++ usleep_range(3000, 5000);
+
+ return 0;
+ }
+--- a/fwdl.c
++++ b/fwdl.c
+@@ -74,7 +74,7 @@ int mwl_fwdl_download_firmware(struct ie
+ /* FW before jumping to boot rom, it will enable PCIe transaction retry,
+ * wait for boot code to stop it.
+ */
+- mdelay(FW_CHECK_MSECS);
++ usleep_range(FW_CHECK_MSECS * 1000, FW_CHECK_MSECS * 2000);
+
+ writel(MACREG_A2HRIC_BIT_MASK,
+ priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL);
+@@ -95,7 +95,7 @@ int mwl_fwdl_download_firmware(struct ie
+
+ /* make sure SCRATCH2 C40 is clear, in case we are too quick */
+ while (readl(priv->iobase1 + 0xc40) == 0)
+- ;
++ cond_resched();
+
+ while (size_fw_downloaded < fw->size) {
+ len = readl(priv->iobase1 + 0xc40);
+@@ -125,6 +125,7 @@ int mwl_fwdl_download_firmware(struct ie
+ int_code = readl(priv->iobase1 + 0xc1c);
+ if (int_code != 0)
+ break;
++ cond_resched();
+ curr_iteration--;
+ } while (curr_iteration);
+
+@@ -133,6 +134,7 @@ int mwl_fwdl_download_firmware(struct ie
+ if ((int_code & MACREG_H2ARIC_BIT_DOOR_BELL) !=
+ MACREG_H2ARIC_BIT_DOOR_BELL)
+ break;
++ cond_resched();
+ curr_iteration--;
+ } while (curr_iteration);
+
+@@ -167,12 +169,14 @@ int mwl_fwdl_download_firmware(struct ie
+ do {
+ curr_iteration--;
+ if (priv->mfg_mode && priv->chip_type == MWL8897) {
+- mdelay(FW_CHECK_MSECS);
++ usleep_range(FW_CHECK_MSECS * 1000,
++ FW_CHECK_MSECS * 2000);
+ int_code = readl(priv->iobase1 + 0xc44);
+ } else {
+ writel(HOSTCMD_SOFTAP_MODE,
+ priv->iobase1 + MACREG_REG_GEN_PTR);
+- mdelay(FW_CHECK_MSECS);
++ usleep_range(FW_CHECK_MSECS * 1000,
++ FW_CHECK_MSECS * 2000);
+ int_code = readl(priv->iobase1 + MACREG_REG_INT_CODE);
+ }
+ if (!(curr_iteration % 0xff) && (int_code != 0))