Commit ef1c0499 authored by Jes Sorensen's avatar Jes Sorensen Committed by Kalle Valo

rtl8xxxu: rtl8xxxu_download_firmware(): Cosmetic cleanups

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 43154f6f
...@@ -2105,15 +2105,18 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) ...@@ -2105,15 +2105,18 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
/* MCU firmware download enable */ /* MCU firmware download enable */
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL); val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL);
rtl8xxxu_write8(priv, REG_MCU_FW_DL, val8 | MCU_FW_DL_ENABLE); val8 |= MCU_FW_DL_ENABLE;
rtl8xxxu_write8(priv, REG_MCU_FW_DL, val8);
/* 8051 reset */ /* 8051 reset */
val32 = rtl8xxxu_read32(priv, REG_MCU_FW_DL); val32 = rtl8xxxu_read32(priv, REG_MCU_FW_DL);
rtl8xxxu_write32(priv, REG_MCU_FW_DL, val32 & ~BIT(19)); val32 &= ~BIT(19);
rtl8xxxu_write32(priv, REG_MCU_FW_DL, val32);
/* Reset firmware download checksum */ /* Reset firmware download checksum */
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL); val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL);
rtl8xxxu_write8(priv, REG_MCU_FW_DL, val8 | MCU_FW_DL_CSUM_REPORT); val8 |= MCU_FW_DL_CSUM_REPORT;
rtl8xxxu_write8(priv, REG_MCU_FW_DL, val8);
pages = priv->fw_size / RTL_FW_PAGE_SIZE; pages = priv->fw_size / RTL_FW_PAGE_SIZE;
remainder = priv->fw_size % RTL_FW_PAGE_SIZE; remainder = priv->fw_size % RTL_FW_PAGE_SIZE;
...@@ -2122,7 +2125,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) ...@@ -2122,7 +2125,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
for (i = 0; i < pages; i++) { for (i = 0; i < pages; i++) {
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL + 2) & 0xF8; val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL + 2) & 0xF8;
rtl8xxxu_write8(priv, REG_MCU_FW_DL + 2, val8 | i); val8 |= i;
rtl8xxxu_write8(priv, REG_MCU_FW_DL + 2, val8);
ret = rtl8xxxu_writeN(priv, REG_FW_START_ADDRESS, ret = rtl8xxxu_writeN(priv, REG_FW_START_ADDRESS,
fwptr, RTL_FW_PAGE_SIZE); fwptr, RTL_FW_PAGE_SIZE);
...@@ -2136,7 +2140,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) ...@@ -2136,7 +2140,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
if (remainder) { if (remainder) {
val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL + 2) & 0xF8; val8 = rtl8xxxu_read8(priv, REG_MCU_FW_DL + 2) & 0xF8;
rtl8xxxu_write8(priv, REG_MCU_FW_DL + 2, val8 | i); val8 |= i;
rtl8xxxu_write8(priv, REG_MCU_FW_DL + 2, val8);
ret = rtl8xxxu_writeN(priv, REG_FW_START_ADDRESS, ret = rtl8xxxu_writeN(priv, REG_FW_START_ADDRESS,
fwptr, remainder); fwptr, remainder);
if (ret != remainder) { if (ret != remainder) {
...@@ -2149,8 +2154,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv) ...@@ -2149,8 +2154,8 @@ static int rtl8xxxu_download_firmware(struct rtl8xxxu_priv *priv)
fw_abort: fw_abort:
/* MCU firmware download disable */ /* MCU firmware download disable */
val16 = rtl8xxxu_read16(priv, REG_MCU_FW_DL); val16 = rtl8xxxu_read16(priv, REG_MCU_FW_DL);
rtl8xxxu_write16(priv, REG_MCU_FW_DL, val16 &= ~MCU_FW_DL_ENABLE;
val16 & (~MCU_FW_DL_ENABLE & 0xff)); rtl8xxxu_write16(priv, REG_MCU_FW_DL, val16);
return ret; return ret;
} }
......
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