/** * @brief This function downloads firmware image, gets * HW spec from firmware and set basic parameters to * firmware. * * @param priv A pointer to wlan_private structure * @return WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE */ int wlan_download_firmware(void) { int ret = WLAN_STATUS_SUCCESS; sbi_disable_host_int(); /* Download the helper */ // ret= sbi_prog_firmware_image((u8*)helpgspibin, sizeof(helpgspibin)); ret= sbi_prog_firmware_file("/helper.bin"); if (ret) { WlanDebug(WlanErr,"download helper failed!\n"); ret = WLAN_STATUS_FAILURE; goto done; } /* Download firmware */ // if (sbi_download_wlan_fw_image((u8*)gspi8686bin, sizeof(gspi8686bin))) ret = sbi_download_wlan_fw_file("/fw.bin"); if (ret) { WlanDebug(WlanErr,"download firmware failed\n"); ret = WLAN_STATUS_FAILURE; goto done; } /* check if the fimware is downloaded successfully or not */ if (sbi_verify_fw_download()) { WlanDebug(WlanErr, "FW failed to be active in time!\n"); ret = WLAN_STATUS_FAILURE; goto done; } sbi_enable_host_int(); ret = WLAN_STATUS_SUCCESS; done: return (ret); }
/** * @brief This function downloads firmware image, gets * HW spec from firmware and set basic parameters to * firmware. * * @param priv A pointer to wlan_private structure * @return WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE */ int wlan_setup_station_hw(wlan_private * priv) { int ret = WLAN_STATUS_SUCCESS; wlan_adapter *adapter = priv->adapter; struct net_device *dev = priv->wlan_dev.netdev; ENTER(); if (netif_running(dev)) netif_device_detach(dev); sbi_disable_host_int(priv); /* Download the helper */ ret = sbi_prog_helper(priv); if (ret) { PRINTM(INFO, "Bootloader in invalid state!\n"); ret = WLAN_STATUS_FAILURE; goto done; } /* Download the main firmware via the helper firmware */ if (sbi_prog_firmware_w_helper(priv)) { PRINTM(INFO, "Wlan FW download failed!\n"); ret = WLAN_STATUS_FAILURE; goto done; } /* check if the fimware is downloaded successfully or not */ if (sbi_verify_fw_download(priv)) { PRINTM(INFO, "FW failed to be active in time!\n"); ret = WLAN_STATUS_FAILURE; goto done; } priv->adapter->fwstate = FW_STATE_READY; if (netif_running(dev)) netif_device_attach(dev); #define RF_REG_OFFSET 0x07 #define RF_REG_VALUE 0xc8 sbi_enable_host_int(priv); #ifdef MFG_CMD_SUPPORT if (mfgmode == 0) { #endif /* * Read MAC address from HW */ memset(adapter->CurrentAddr, 0xff, MRVDRV_ETH_ADDR_LEN); ret = PrepareAndSendCommand(priv, HostCmd_CMD_GET_HW_SPEC, 0, HostCmd_OPTION_WAITFORRSP, 0, NULL); if (ret) { ret = WLAN_STATUS_FAILURE; goto done; } SetMacPacketFilter(priv); ret = PrepareAndSendCommand(priv, HostCmd_CMD_802_11_FW_WAKEUP_METHOD, HostCmd_ACT_GET, HostCmd_OPTION_WAITFORRSP, 0, &priv->adapter->fwWakeupMethod); if (ret) { ret = WLAN_STATUS_FAILURE; goto done; } #ifdef MFG_CMD_SUPPORT } #endif #ifdef MFG_CMD_SUPPORT if (mfgmode == 0) { #endif ret = PrepareAndSendCommand(priv, HostCmd_CMD_802_11_RATE_ADAPT_RATESET, HostCmd_ACT_GEN_GET, HostCmd_OPTION_WAITFORRSP, 0, NULL); if (ret) { ret = WLAN_STATUS_FAILURE; goto done; } priv->adapter->DataRate = 0; ret = PrepareAndSendCommand(priv, HostCmd_CMD_802_11_RF_TX_POWER, HostCmd_ACT_GEN_GET, HostCmd_OPTION_WAITFORRSP, 0, NULL); if (ret) { ret = WLAN_STATUS_FAILURE; goto done; } #ifdef MFG_CMD_SUPPORT } #endif ret = WLAN_STATUS_SUCCESS; done: LEAVE(); return (ret); }