653-0052-rtl8xxxu-Correct-power-down-sequence-for-8188eu.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 2764703c3c896d427731391aa978c536aaf4cb91 Mon Sep 17 00:00:00 2001
  2. From: Jes Sorensen <Jes.Sorensen@redhat.com>
  3. Date: Tue, 30 Aug 2016 17:23:35 -0400
  4. Subject: [PATCH] rtl8xxxu: Correct power down sequence for 8188eu
  5. This matches the vendor driver more correctly
  6. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
  7. ---
  8. .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 26 ++++++++++++++++------
  9. 1 file changed, 19 insertions(+), 7 deletions(-)
  10. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  11. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  12. @@ -1083,7 +1083,8 @@ static void rtl8188e_disabled_to_emu(str
  13. u16 val16;
  14. val16 = rtl8xxxu_read16(priv, REG_APS_FSMCO);
  15. - val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN);
  16. + val16 &= ~(APS_FSMCO_PFM_WOWL | APS_FSMCO_ENABLE_POWERDOWN |
  17. + APS_FSMCO_HW_POWERDOWN);
  18. rtl8xxxu_write16(priv, REG_APS_FSMCO, val16);
  19. }
  20. @@ -1196,15 +1197,26 @@ static int rtl8188eu_emu_to_disabled(str
  21. {
  22. u8 val8;
  23. - /* 0x04[12:11] = 01 enable WL suspend */
  24. - val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 2);
  25. - val8 &= ~BIT(0);
  26. - rtl8xxxu_write8(priv, REG_APS_FSMCO + 2, val8);
  27. + val8 = rtl8xxxu_read8(priv, REG_AFE_XTAL_CTRL + 2);
  28. + val8 |= BIT(7);
  29. + rtl8xxxu_write8(priv, REG_AFE_XTAL_CTRL + 2, val8);
  30. val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
  31. - val8 |= BIT(7);
  32. + val8 &= ~(BIT(3) | BIT(4));
  33. + val8 |= BIT(3);
  34. rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8);
  35. + rtl8xxxu_write8(priv, REG_APS_FSMCO + 3, 0x00);
  36. +
  37. + val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG + 1);
  38. + val8 &= ~BIT(4);
  39. + rtl8xxxu_write8(priv, REG_GPIO_MUXCFG + 1, val8);
  40. +
  41. + /* Set USB suspend enable local register 0xfe10[4]=1 */
  42. + val8 = rtl8xxxu_read8(priv, 0xfe10);
  43. + val8 |= BIT(4);
  44. + rtl8xxxu_write8(priv, 0xfe10, val8);
  45. +
  46. return 0;
  47. }
  48. @@ -1339,7 +1351,7 @@ void rtl8188eu_power_off(struct rtl8xxxu
  49. rtl8xxxu_write8(priv, REG_GPIO_PIN_CTRL + 2, 0xff);
  50. val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL);
  51. - rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 << 4);
  52. + rtl8xxxu_write8(priv, REG_GPIO_IO_SEL, val8 << 4);
  53. val8 = rtl8xxxu_read8(priv, REG_GPIO_IO_SEL + 1);
  54. rtl8xxxu_write8(priv, REG_GPIO_IO_SEL + 1, val8 | 0x0f);