aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Finger2018-02-05 12:38:11 -0600
committerGreg Kroah-Hartman2018-02-22 08:45:00 -0600
commit4f62fb888d96ddc236aa11015f95d0afe4f3ba8b (patch)
treee6dad982b3e9977910657ae18428cd0837bdfbdc
parent7f64e1a80640cd97f4767a57796b033d4f47f4db (diff)
downloadkernel-omap-4f62fb888d96ddc236aa11015f95d0afe4f3ba8b.tar.gz
kernel-omap-4f62fb888d96ddc236aa11015f95d0afe4f3ba8b.tar.xz
kernel-omap-4f62fb888d96ddc236aa11015f95d0afe4f3ba8b.zip
rtlwifi: rtl8821ae: Fix connection lost problem correctly
commit c713fb071edc0efc01a955f65a006b0e1795d2eb upstream. There has been a coding error in rtl8821ae since it was first introduced, namely that an 8-bit register was read using a 16-bit read in _rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75 ("rtlwifi: Fix alignment issues"); however, this change led to instability in the connection. To restore stability, this change was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem"). Unfortunately, the unaligned access causes machine checks in ARM architecture, and we were finally forced to find the actual cause of the problem on x86 platforms. Following a suggestion from Pkshih <pkshih@realtek.com>, it was found that increasing the ASPM L1 latency from 0 to 7 fixed the instability. This parameter was varied to see if a smaller value would work; however, it appears that 7 is the safest value. A new symbol is defined for this quantity, thus it can be easily changed if necessary. Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem") Cc: Stable <stable@vger.kernel.org> # 4.14+ Fix-suggested-by: Pkshih <pkshih@realtek.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Tested-by: James Cameron <quozl@laptop.org> # x86_64 OLPC NL3 Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c5
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/wifi.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 738d541a2255..348ed1b0e58b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1127,7 +1127,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
1127 } 1127 }
1128 if (0 == tmp) { 1128 if (0 == tmp) {
1129 read_addr = REG_DBI_RDATA + addr % 4; 1129 read_addr = REG_DBI_RDATA + addr % 4;
1130 ret = rtl_read_word(rtlpriv, read_addr); 1130 ret = rtl_read_byte(rtlpriv, read_addr);
1131 } 1131 }
1132 return ret; 1132 return ret;
1133} 1133}
@@ -1169,7 +1169,8 @@ static void _rtl8821ae_enable_aspm_back_door(struct ieee80211_hw *hw)
1169 } 1169 }
1170 1170
1171 tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f); 1171 tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f);
1172 _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7)); 1172 _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7) |
1173 ASPM_L1_LATENCY << 3);
1173 1174
1174 tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719); 1175 tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719);
1175 _rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4)); 1176 _rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4));
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index b6faf624480e..d676d055feda 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -99,6 +99,7 @@
99#define RTL_USB_MAX_RX_COUNT 100 99#define RTL_USB_MAX_RX_COUNT 100
100#define QBSS_LOAD_SIZE 5 100#define QBSS_LOAD_SIZE 5
101#define MAX_WMMELE_LENGTH 64 101#define MAX_WMMELE_LENGTH 64
102#define ASPM_L1_LATENCY 7
102 103
103#define TOTAL_CAM_ENTRY 32 104#define TOTAL_CAM_ENTRY 32
104 105