[PATCH] ssb: Do not disable PCI host on non-Mips

2018-01-26 Thread Sven Joachim
After upgrading an old laptop to 4.15-rc9, I found that the eth0 and
wlan0 interfaces had disappeared.  It turns out that the b43 and b44
drivers require SSB_PCIHOST_POSSIBLE which depends on
PCI_DRIVERS_LEGACY, a config option that only exists on Mips.

Fixes: 58eae1416b80 ("ssb: Disable PCI host for PCI_DRIVERS_GENERIC")
Cc: sta...@vger.org
Signed-off-by: Sven Joachim 
---
 drivers/ssb/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index 71c73766ee22..65af12c3bdb2 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -32,7 +32,7 @@ config SSB_BLOCKIO
 
 config SSB_PCIHOST_POSSIBLE
bool
-   depends on SSB && (PCI = y || PCI = SSB) && PCI_DRIVERS_LEGACY
+   depends on SSB && (PCI = y || PCI = SSB) && (PCI_DRIVERS_LEGACY || 
!MIPS)
default y
 
 config SSB_PCIHOST
-- 
2.15.1



Re: Patch "rtlwifi: btcoexist: Fix antenna selection code" has been added to the 4.13-stable tree

2017-09-10 Thread Sven Joachim
On 2017-09-10 13:37 +0200, gre...@linuxfoundation.org wrote:

> This is a note to let you know that I've just added the patch titled
>
> rtlwifi: btcoexist: Fix antenna selection code
>
> to the 4.13-stable tree which can be found at:
> 
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
>  rtlwifi-btcoexist-fix-antenna-selection-code.patch
> and it can be found in the queue-4.13 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let  know about it.
>
>
> From 6d622692836950b3c943776f84c4557ff6c02f3b Mon Sep 17 00:00:00 2001
> From: Larry Finger 
> Date: Mon, 4 Sep 2017 12:51:34 -0500
> Subject: rtlwifi: btcoexist: Fix antenna selection code
>
> From: Larry Finger 
>
> commit 6d622692836950b3c943776f84c4557ff6c02f3b upstream.
>
> In commit 87d8a9f35202 ("rtlwifi: btcoex: call bind to setup btcoex"),
> the code turns on a call to exhalbtc_bind_bt_coex_withadapter(). This
> routine contains a bug that causes incorrect antenna selection for those
> HP laptops with only one antenna and an incorrectly programmed EFUSE.
> These boxes are the ones that need the ant_sel module parameter.

I am the unlucky owner of such a laptop.

> Fixes: 87d8a9f35202 ("rtlwifi: btcoex: call bind to setup btcoex")
> Signed-off-by: Larry Finger 
> Cc: Ping-Ke Shih 
> Cc: Yan-Hsuan Chuang 
> Cc: Birming Chiu 
> Cc: Shaofu 
> Cc: Steven Ting 
> Signed-off-by: Kalle Valo 
> Signed-off-by: Greg Kroah-Hartman 
>
> ---
>  drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c |   23 
> ++
>  1 file changed, 16 insertions(+), 7 deletions(-)
>
> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> @@ -173,6 +173,16 @@ static u8 halbtc_get_wifi_central_chnl(s
>  
>  u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)
>  {
> + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
> +
> + /* override ant_num / ant_path */
> + if (mod_params->ant_sel) {
> + rtlpriv->btcoexist.btc_info.ant_num =
> + (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
> +
> + rtlpriv->btcoexist.btc_info.single_ant_path =
> + (mod_params->ant_sel == 1 ? 0 : 1);
> + }
>   return rtlpriv->btcoexist.btc_info.single_ant_path;
>  }
>  
> @@ -183,6 +193,7 @@ u8 rtl_get_hwpg_bt_type(struct rtl_priv
>  
>  u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
>  {
> + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
>   u8 num;
>  
>   if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2)
> @@ -190,6 +201,10 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv
>   else
>   num = 1;
>  
> + /* override ant_num / ant_path */
> + if (mod_params->ant_sel)
> + num = (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1) + 1;
> +
>   return num;
>  }
>  
> @@ -861,7 +876,7 @@ bool exhalbtc_bind_bt_coex_withadapter(v
>  {
>   struct btc_coexist *btcoexist = &gl_bt_coexist;
>   struct rtl_priv *rtlpriv = adapter;
> - u8 ant_num = 2, chip_type, single_ant_path = 0;
> + u8 ant_num = 2, chip_type;
>  
>   if (btcoexist->binded)
>   return false;
> @@ -896,12 +911,6 @@ bool exhalbtc_bind_bt_coex_withadapter(v
>   ant_num = rtl_get_hwpg_ant_num(rtlpriv);
>   exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num);
>  
> - /* set default antenna position to main  port */
> - btcoexist->board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;
> -
> - single_ant_path = rtl_get_hwpg_single_ant_path(rtlpriv);
> - exhalbtc_set_single_ant_path(single_ant_path);
> -
>   if (rtl_get_hwpg_package_type(rtlpriv) == 0)
>   btcoexist->board_info.tfbga_package = false;
>   else if (rtl_get_hwpg_package_type(rtlpriv) == 1)
>
>
> Patches currently in stable-queue which might be from 
> larry.fin...@lwfinger.net are
>
> queue-4.13/rtlwifi-btcoexist-fix-breakage-of-ant_sel-for-rtl8723be.patch
> queue-4.13/rtlwifi-btcoexist-fix-antenna-selection-code.patch

After applying these patches on top of 4.13.1 the WiFi on my laptop
works again (thanks, Larry!), but now rtl8723be needs the ant_sel=2
parameter which is a bit odd, because previously it had been working
(only) with ant_sel=1.  This looks like it has not been intended?

Cheers,
   Sven


[PATCH v2] rtlwifi: Fix fallback firmware loading

2017-07-31 Thread Sven Joachim
Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of
firmware") added code to load an old firmware file if the new one is
not available.  Unfortunately that code is never reached because
request_firmware_nowait() does not wait for the firmware to show up
and returns 0 even if the file is not there.

Use the existing fallback mechanism introduced by commit 62009b7f1279
("rtlwifi: rtl8192cu: Add new firmware") instead.

Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware")
Cc: sta...@vger.kernel.org
Signed-off-by: Sven Joachim 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 17 +
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 17 +
 2 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
index 56c05c4e1499..f47d839f388d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
@@ -187,18 +187,10 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw)
  rtlpriv->io.dev, GFP_KERNEL, hw,
  rtl_fw_cb);
if (err) {
-   /* Failed to get firmware. Check if old version available */
-   fw_name = "rtlwifi/rtl8723befw.bin";
-   pr_info("Using firmware %s\n", fw_name);
-   err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
- rtlpriv->io.dev, GFP_KERNEL, hw,
- rtl_fw_cb);
-   if (err) {
-   pr_err("Failed to request firmware!\n");
-   vfree(rtlpriv->rtlhal.pfirmware);
-   rtlpriv->rtlhal.pfirmware = NULL;
-   return 1;
-   }
+   pr_err("Failed to request firmware!\n");
+   vfree(rtlpriv->rtlhal.pfirmware);
+   rtlpriv->rtlhal.pfirmware = NULL;
+   return 1;
}
return 0;
 }
@@ -289,6 +281,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl8723be_pci",
+   .alt_fw_name = "rtlwifi/rtl8723befw.bin",
.ops = &rtl8723be_hal_ops,
.mod_params = &rtl8723be_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
index ec2d577ba85b..5925edf7877f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
@@ -216,18 +216,10 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
  rtlpriv->io.dev, GFP_KERNEL, hw,
  rtl_fw_cb);
if (err) {
-   /* Failed to get firmware. Check if old version available */
-   fw_name = "rtlwifi/rtl8821aefw.bin";
-   pr_info("Using firmware %s\n", fw_name);
-   err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
- rtlpriv->io.dev, GFP_KERNEL, hw,
- rtl_fw_cb);
-   if (err) {
-   pr_err("Failed to request normal firmware!\n");
-   vfree(rtlpriv->rtlhal.wowlan_firmware);
-   vfree(rtlpriv->rtlhal.pfirmware);
-   return 1;
-   }
+   pr_err("Failed to request normal firmware!\n");
+   vfree(rtlpriv->rtlhal.wowlan_firmware);
+   vfree(rtlpriv->rtlhal.pfirmware);
+   return 1;
}
/*load wowlan firmware*/
pr_info("Using firmware %s\n", wowlan_fw_name);
@@ -331,6 +323,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl8821ae_pci",
+   .alt_fw_name = "rtlwifi/rtl8821aefw.bin",
.ops = &rtl8821ae_hal_ops,
.mod_params = &rtl8821ae_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
-- 
2.13.3



[PATCH] rtlwifi: Fix fallback firmware loading

2017-07-29 Thread Sven Joachim
Commit f70e4df2 ("rtlwifi: Add code to read new versions of firmware")
added code to load an old firmware file if the new one is not
available.  Unfortunately that code is never reached because
request_firmware_nowait() does not wait for the firmware to show up
and returns 0 even if the file is not there.

Use the existing fallback mechanism introduced by commit
62009b7f ("rtlwifi: rtl8192cu: Add new firmware") instead.

Fixes: f70e4df2b384d21e36a7c30a591639592692e0ec
Cc: sta...@vger.kernel.org
Signed-off-by: Sven Joachim 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 13 +++--
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 13 +++--
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
index f9d10f1e7cf8..1c2d5f6dd3ff 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
@@ -187,16 +187,8 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw)
  rtlpriv->io.dev, GFP_KERNEL, hw,
  rtl_fw_cb);
if (err) {
-   /* Failed to get firmware. Check if old version available */
-   fw_name = "rtlwifi/rtl8723befw.bin";
-   pr_info("Using firmware %s\n", fw_name);
-   err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
- rtlpriv->io.dev, GFP_KERNEL, hw,
- rtl_fw_cb);
-   if (err) {
-   pr_err("Failed to request firmware!\n");
-   return 1;
-   }
+   pr_err("Failed to request firmware!\n");
+   return 1;
}
return 0;
 }
@@ -287,6 +279,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl8723be_pci",
+   .alt_fw_name = "rtlwifi/rtl8723befw.bin",
.ops = &rtl8723be_hal_ops,
.mod_params = &rtl8723be_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
index d71d2776ca03..0801576bfa89 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
@@ -214,16 +214,8 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
  rtlpriv->io.dev, GFP_KERNEL, hw,
  rtl_fw_cb);
if (err) {
-   /* Failed to get firmware. Check if old version available */
-   fw_name = "rtlwifi/rtl8821aefw.bin";
-   pr_info("Using firmware %s\n", fw_name);
-   err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
- rtlpriv->io.dev, GFP_KERNEL, hw,
- rtl_fw_cb);
-   if (err) {
-   pr_err("Failed to request normal firmware!\n");
-   return 1;
-   }
+   pr_err("Failed to request normal firmware!\n");
+   return 1;
}
/*load wowlan firmware*/
pr_info("Using firmware %s\n", wowlan_fw_name);
@@ -325,6 +317,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl8821ae_pci",
+   .alt_fw_name = "rtlwifi/rtl8821aefw.bin",
.ops = &rtl8821ae_hal_ops,
.mod_params = &rtl8821ae_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
-- 
2.13.3



Loading fallback firmware in rtl8723be and rtl8821ae fails

2017-07-28 Thread Sven Joachim
After upgrading my laptop to kernel 4.12 I found that the firmware for
my WiFi card was no longer loaded, rendering the WiFi non-functional.
In the dmesg are (only) these related lines:

[6.854609] rtl8723be: Using firmware rtlwifi/rtl8723befw_36.bin
[6.854990] rtl8723be :02:00.0: Direct firmware load for 
rtlwifi/rtl8723befw_36.bin failed with error -2
[6.854993] rtlwifi: Selected firmware is not available

Now, by commit f70e4df2b384d21e36a7c30a591639592692e0ec ("Add code to
read new versions of firmware"), supposedly rtlwifi/rtl8723befw.bin
should be loaded if rtlwifi/rtl8723befw_36.bin is not available, but
that does not actually work.

AFAICS the problem is that request_firmware_nowait() does not wait for
the firmware to show up and returns 0 even if the file is not there, so
the code to load the fallback file will never be reached.

Cheers,
   Sven