653-0055-rtl8xxxu-Fix-reloading-of-driver-for-8188eu-devices.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From 7b4161933d0a409023f5ef70cdc9296ab1cf5430 Mon Sep 17 00:00:00 2001
  2. From: Jes Sorensen <Jes.Sorensen@redhat.com>
  3. Date: Wed, 14 Sep 2016 14:10:42 -0400
  4. Subject: [PATCH] rtl8xxxu: Fix reloading of driver for 8188eu devices
  5. For 8188eu, once the MAC is asked to power down by setting
  6. APS_FSMCO_MAC_OFF, there seems to be no way to bring it back to life.
  7. In addition, only disable RF_ENABLE in RF_CTRL rather than all bits.
  8. This was spotted by Andrea Merello who noticed that if we dropped the
  9. call to rtl8188eu_active_to_emu() reloading started working.
  10. Reported-by: Andrea Merello <andrea.merello@gmail.com>
  11. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
  12. ---
  13. .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 29 +++++-----------------
  14. 1 file changed, 6 insertions(+), 23 deletions(-)
  15. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  16. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  17. @@ -1160,37 +1160,18 @@ exit:
  18. static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv)
  19. {
  20. u8 val8;
  21. - int count, ret = 0;
  22. /* Turn off RF */
  23. - rtl8xxxu_write8(priv, REG_RF_CTRL, 0);
  24. + val8 = rtl8xxxu_read8(priv, REG_RF_CTRL);
  25. + val8 &= ~RF_ENABLE;
  26. + rtl8xxxu_write8(priv, REG_RF_CTRL, val8);
  27. /* LDO Sleep mode */
  28. val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL);
  29. val8 |= BIT(4);
  30. rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8);
  31. - /* 0x0005[1] = 1 turn off MAC by HW state machine*/
  32. - val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
  33. - val8 |= BIT(1);
  34. - rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8);
  35. -
  36. - for (count = RTL8XXXU_MAX_REG_POLL; count; count--) {
  37. - val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
  38. - if ((val8 & BIT(1)) == 0)
  39. - break;
  40. - udelay(10);
  41. - }
  42. -
  43. - if (!count) {
  44. - dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
  45. - __func__);
  46. - ret = -EBUSY;
  47. - goto exit;
  48. - }
  49. -
  50. -exit:
  51. - return ret;
  52. + return 0;
  53. }
  54. static int rtl8188eu_emu_to_disabled(struct rtl8xxxu_priv *priv)
  55. @@ -1372,6 +1353,8 @@ void rtl8188eu_power_off(struct rtl8xxxu
  56. static void rtl8188e_enable_rf(struct rtl8xxxu_priv *priv)
  57. {
  58. + rtl8xxxu_write8(priv, REG_RF_CTRL, RF_ENABLE | RF_RSTB | RF_SDMRSTB);
  59. +
  60. rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00);
  61. }