summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2016-02-03 13:39:37 -0500
committerKalle Valo <kvalo@codeaurora.org>2016-02-25 11:55:22 +0200
commit216202ae20ea93585630e6a88486ea23200199cc (patch)
tree3f0854193a3183da555cbf19c578b7f4bd227f7a
parentef1c0499316b892d700201edeeb013b60be96877 (diff)
downloadlinux-216202ae20ea93585630e6a88486ea23200199cc.tar.bz2
rtl8xxxu: If fw running in RAM, reset the 8051 before trying to download a new one
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
index b6a264bc4463..e98e0535c14f 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
@@ -2089,7 +2089,7 @@ exit:
static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
{
int pages, remainder, i, ret;
- u8 val8;
+ u8 val8, sys_func;
u16 val16;
u32 val32;
u8 *fwptr;
@@ -2103,6 +2103,23 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
val16 |= SYS_FUNC_CPU_ENABLE;
rtl8xxxu_write16(priv, REG_SYS_FUNC, val16);
+ val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL);
+ if (val8 & MCU_FW_RAM_SEL) {
+ pr_info("do the RAM reset\n");
+ rtl8xxxu_write8(priv, REG_MCU_FW_DL, 0x00);
+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1);
+ val8 &= ~BIT(3);
+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8);
+ sys_func = rtl8xxxu_read8(priv, REG_SYS_FUNC + 1);
+ sys_func &= ~BIT(2);
+ rtl8xxxu_write8(priv, REG_SYS_FUNC + 1, sys_func);
+ val8 = rtl8xxxu_read8(priv, REG_RSV_CTRL + 1);
+ val8 |= BIT(3);
+ rtl8xxxu_write8(priv, REG_RSV_CTRL + 1, val8);
+ sys_func |= BIT(2);
+ rtl8xxxu_write8(priv, REG_SYS_FUNC + 1, sys_func);
+ }
+
/* MCU firmware download enable */
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL);
val8 |= MCU_FW_DL_ENABLE;