summaryrefslogtreecommitdiff
path: root/mwl_fwdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'mwl_fwdl.c')
-rw-r--r--mwl_fwdl.c63
1 files changed, 37 insertions, 26 deletions
diff --git a/mwl_fwdl.c b/mwl_fwdl.c
index 0f1c916..6508c93 100644
--- a/mwl_fwdl.c
+++ b/mwl_fwdl.c
@@ -64,18 +64,21 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
mwl_fwcmd_reset(hw);
- /* FW before jumping to boot rom, it will enable PCIe transaction retry, wait for boot code to stop it.
- */
+ /* FW before jumping to boot rom, it will enable PCIe transaction retry,
+ * wait for boot code to stop it.
+ */
WL_MSEC_SLEEP(FW_CHECK_MSECS);
- writel(MACREG_A2HRIC_BIT_MASK, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL);
+ writel(MACREG_A2HRIC_BIT_MASK,
+ priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL);
writel(0x00, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CAUSE);
writel(0x00, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_MASK);
- writel(MACREG_A2HRIC_BIT_MASK, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK);
+ writel(MACREG_A2HRIC_BIT_MASK,
+ priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK);
/* this routine interacts with SC2 bootrom to download firmware binary
- * to the device. After DMA'd to SC2, the firmware could be deflated to reside
- * on its respective blocks such as ITCM, DTCM, SQRAM,
+ * to the device. After DMA'd to SC2, the firmware could be deflated to
+ * reside on its respective blocks such as ITCM, DTCM, SQRAM,
* (or even DDR, AFTER DDR is init'd before fw download
*/
WLDBG_PRINT("fw download start 88");
@@ -86,7 +89,8 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
/* make sure SCRATCH2 C40 is clear, in case we are too quick
*/
- while (readl(priv->iobase1 + 0xc40) == 0);
+ while (readl(priv->iobase1 + 0xc40) == 0)
+ ;
while (size_fw_downloaded < fw->size) {
len = readl(priv->iobase1 + 0xc40);
@@ -94,21 +98,24 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
if (!len)
break;
- /* this copies the next chunk of fw binary to be delivered
- */
- memcpy((char *)&priv->pcmd_buf[0], (fw->data + size_fw_downloaded), len);
+ /* this copies the next chunk of fw binary to be delivered */
+ memcpy((char *)&priv->pcmd_buf[0],
+ (fw->data + size_fw_downloaded), len);
/* this function writes pdata to c10, then write 2 to c18
*/
mwl_fwdl_trig_pcicmd_bootcode(priv);
- curr_iteration = FW_MAX_NUM_CHECKS; /* this is arbitrary per your platform; we use 0xffff */
+ /* this is arbitrary per your platform; we use 0xffff */
+ curr_iteration = FW_MAX_NUM_CHECKS;
- /* NOTE: the following back to back checks on C1C is time sensitive, hence
- * may need to be tweaked dependent on host processor. Time for SC2 to go from
- * the write of event 2 to C1C == 2 is ~1300 nSec. Hence the checkings on host
- * has to consider how efficient your code can be to meet this timing, or you
- * can alternatively tweak this routines to fit your platform
+ /* NOTE: the following back to back checks on C1C is time
+ * sensitive, hence may need to be tweaked dependent on host
+ * processor. Time for SC2 to go from the write of event 2 to
+ * C1C == 2 is ~1300 nSec. Hence the checkings on host has to
+ * consider how efficient your code can be to meet this timing,
+ * or you can alternatively tweak this routines to fit your
+ * platform
*/
do {
int_code = readl(priv->iobase1 + 0xc1c);
@@ -119,16 +126,18 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
do {
int_code = readl(priv->iobase1 + 0xc1c);
- if ((int_code & MACREG_H2ARIC_BIT_DOOR_BELL) != MACREG_H2ARIC_BIT_DOOR_BELL)
+ if ((int_code & MACREG_H2ARIC_BIT_DOOR_BELL) !=
+ MACREG_H2ARIC_BIT_DOOR_BELL)
break;
curr_iteration--;
} while (curr_iteration);
if (curr_iteration == 0) {
- /* This limited loop check allows you to exit gracefully without locking up
- * your entire system just because fw download failed
+ /* This limited loop check allows you to exit gracefully
+ * without locking up your entire system just because fw
+ * download failed
*/
- WLDBG_PRINT("Exhausted curr_iteration during fw download");
+ WLDBG_PRINT("Exhausted curr_iteration for fw download");
goto err_download;
}
@@ -139,9 +148,10 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
(int)fw->size, size_fw_downloaded, curr_iteration);
/* Now firware is downloaded successfully, so this part is to check
- * whether fw can properly execute to an extent that write back signature
- * to indicate its readiness to the host. NOTE: if your downloaded fw crashes,
- * this signature checking will fail. This part is similar as SC1
+ * whether fw can properly execute to an extent that write back
+ * signature to indicate its readiness to the host. NOTE: if your
+ * downloaded fw crashes, this signature checking will fail. This
+ * part is similar as SC1
*/
writew(0x00, &priv->pcmd_buf[1]);
mwl_fwdl_trig_pcicmd(priv);
@@ -153,14 +163,15 @@ int mwl_fwdl_download_firmware(struct ieee80211_hw *hw)
int_code = readl(priv->iobase1 + MACREG_REG_INT_CODE);
if (!(curr_iteration % 0xff))
WLDBG_PRINT("%x;", int_code);
- } while ((curr_iteration) && (int_code != HOSTCMD_SOFTAP_FWRDY_SIGNATURE));
+ } while ((curr_iteration) &&
+ (int_code != HOSTCMD_SOFTAP_FWRDY_SIGNATURE));
if (curr_iteration == 0) {
- WLDBG_PRINT("Exhausted curr_iteration waiting for fw signature; firmware seems failed to operate");
+ WLDBG_PRINT("Exhausted curr_iteration for fw signature");
goto err_download;
}
- WLDBG_PRINT("complete");
+ WLDBG_PRINT("complete");
writel(0x00, priv->iobase1 + MACREG_REG_INT_CODE);
WLDBG_EXIT(DBG_LEVEL_1);