rtl8xxxu: Match 8723bu power down sequence to vendor driver
authorJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 14 Apr 2016 20:37:12 +0000 (16:37 -0400)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 15 Apr 2016 18:38:08 +0000 (21:38 +0300)
In particular set APS_FSMCO_WLON_RESET in the right register, and do
not overwrite too much of REG_CR.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c

index 8bf9a74bec6356622615440b0991f83b95b8dfa9..5685fd744fbc87bdcd914bb1aeadad34ad27bb3e 100644 (file)
@@ -6510,9 +6510,9 @@ static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write16(priv, REG_GPIO_INTM, val16);
 
        /* Release WLON reset 0x04[16]= 1*/
-       val32 = rtl8xxxu_read32(priv, REG_GPIO_INTM);
+       val32 = rtl8xxxu_read32(priv, REG_APS_FSMCO);
        val32 |= APS_FSMCO_WLON_RESET;
-       rtl8xxxu_write32(priv, REG_GPIO_INTM, val32);
+       rtl8xxxu_write32(priv, REG_APS_FSMCO, val32);
 
        /* 0x0005[1] = 1 turn off MAC by HW state machine*/
        val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
@@ -7376,7 +7376,7 @@ static void rtl8723bu_power_off(struct rtl8xxxu_priv *priv)
        val8 &= ~TX_REPORT_CTRL_TIMER_ENABLE;
        rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
 
-       rtl8xxxu_write16(priv, REG_CR, 0x0000);
+       rtl8xxxu_write8(priv, REG_CR, 0x0000);
 
        rtl8xxxu_active_to_lps(priv);
 
@@ -7393,7 +7393,15 @@ static void rtl8723bu_power_off(struct rtl8xxxu_priv *priv)
        rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00);
 
        rtl8723bu_active_to_emu(priv);
-       rtl8xxxu_emu_to_disabled(priv);
+
+       val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
+       val8 |= BIT(3); /* APS_FSMCO_HW_SUSPEND */
+       rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8);
+
+       /* 0x48[16] = 1 to enable GPIO9 as EXT wakeup */
+       val8 = rtl8xxxu_read8(priv, REG_GPIO_INTM + 2);
+       val8 |= BIT(0);
+       rtl8xxxu_write8(priv, REG_GPIO_INTM + 2, val8);
 }
 
 #ifdef NEED_PS_TDMA