Commit 216202ae authored by Jes Sorensen's avatar Jes Sorensen Committed by Kalle Valo

rtl8xxxu: If fw running in RAM, reset the 8051 before trying to download a new one

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent ef1c0499
...@@ -2089,7 +2089,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv) ...@@ -2089,7 +2089,7 @@ static int rtl8xxxu_start_firmware(struct rtl8xxxu_priv *priv)
static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
{ {
int pages, remainder, i, ret; int pages, remainder, i, ret;
u8 val8; u8 val8, sys_func;
u16 val16; u16 val16;
u32 val32; u32 val32;
u8 *fwptr; u8 *fwptr;
...@@ -2103,6 +2103,23 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) ...@@ -2103,6 +2103,23 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
val16 |= SYS_FUNC_CPU_ENABLE; val16 |= SYS_FUNC_CPU_ENABLE;
rtl8xxxu_write16(priv, REG_SYS_FUNC, val16); 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 */ /* MCU firmware download enable */
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL); val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL);
val8 |= MCU_FW_DL_ENABLE; val8 |= MCU_FW_DL_ENABLE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment