if (card == NULL)
{
- func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
}
r = unifi_init(card);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
r = unifi_hip_init(card);
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
{
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to start host protocol.\n");
- func_exit_r(r);
return r;
}
if (card == NULL)
{
- func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
}
if (csrResult != CSR_RESULT_SUCCESS)
{
r = ConvertCsrSdioToCsrHipResult(card, csrResult);
- func_exit_r(r);
return r;
}
card->sdio_clock_speed = UNIFI_SDIO_CLOCK_SAFE_HZ;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to reset UniFi\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to set power save mode\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write SHARED_DMEM_PAGE\n");
- func_exit_r(r);
return r;
}
r = unifi_write_direct16(card, ChipHelper_HOST_WINDOW2_PAGE(card->helper) * 2, 0);
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write PROG_MEM2_PAGE\n");
- func_exit_r(r);
return r;
}
unifi_error(card->ospriv, "Probe for Flash failed\n");
}
- func_exit_r(r);
return r;
} /* unifi_init() */
if (card == NULL)
{
- func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
}
dlpriv = unifi_dl_fw_read_start(card, UNIFI_FW_STA);
if (dlpriv == NULL)
{
- func_exit_r(CSR_WIFI_HIP_RESULT_NOT_FOUND);
return CSR_WIFI_HIP_RESULT_NOT_FOUND;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to download firmware\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to establish communication with UniFi\n");
- func_exit_r(r);
return r;
}
#ifdef CSR_PRE_ALLOC_NET_DATA
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Init slots failed: %d\n", r);
- func_exit_r(r);
return r;
}
r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
r = CardGenInt(card);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Firmware hasn't started\n");
- func_exit_r(r);
return r;
}
unifi_trace(card->ospriv, UDBG4, "SLUT addr 0x%lX\n", slut_address);
if (csrResult != CSR_RESULT_SUCCESS)
{
r = ConvertCsrSdioToCsrHipResult(card, csrResult);
- func_exit_r(r);
return r;
}
card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read SLUT finger print\n");
- func_exit_r(r);
return r;
}
if (finger_print != SLUT_FINGERPRINT)
{
unifi_error(card->ospriv, "Failed to find Symbol lookup table fingerprint\n");
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
r = unifi_card_read16(card, slut_address, &s);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
slut_address += 2;
r = unifi_read32(card, slut_address, &l);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
slut_address += 4;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read config data\n");
- func_exit_r(r);
return r;
}
/* .. and then we copy the data to the host structure */
{
unifi_error(card->ospriv, "From host data slots %d\n", cfg_data->num_fromhost_data_slots);
unifi_error(card->ospriv, "need to be (queues * x + 2) (UNIFI_RESERVED_COMMAND_SLOTS for commands)\n");
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
if ((card->sdio_io_block_size % cfg_data->sig_frag_size) != 0)
{
unifi_error(card->ospriv, "Configuration error: Can not pad to-host signals.\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
}
cfg_data->tohost_signal_padding = (u16) (card->sdio_io_block_size / cfg_data->sig_frag_size);
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write To-Host Signal Padding Fragments\n");
- func_exit_r(r);
return r;
}
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read build id\n");
- func_exit_r(r);
return r;
}
card->build_id = n;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read build string\n");
- func_exit_r(r);
return r;
}
break;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write loader load image command\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to patch firmware\n");
- func_exit_r(r);
return r;
}
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write loader restart command\n");
- func_exit_r(r);
return r;
}
if (cfg_data == NULL)
{
unifi_error(card->ospriv, "Failed to find SDIO_SLOT_CONFIG Symbol\n");
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
{
unifi_error(card->ospriv, "Failed to read init flag at %08lx\n",
card->init_flag_addr);
- func_exit_r(r);
return r;
}
if (initialised != 0)
{
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
unifi_error(card->ospriv, "UniFi f/w protocol major version (%d) is different from driver (v%d.%d)\n",
major, UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION);
#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
#endif
}
major, minor,
UNIFI_HIP_MAJOR_VERSION, UNIFI_HIP_MINOR_VERSION);
#ifndef CSR_WIFI_DISABLE_HIP_VERSION_CHECK
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
#endif
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read UniFi Mailbox1 register for second time\n");
- func_exit_r(r);
return r;
}
unifi_trace(card->ospriv, UDBG1, "MAILBOX1 value=0x%04X\n", mbox1);
{
unifi_trace(card->ospriv, UDBG1, "Timeout waiting for firmware to start, Mailbox1 still 0 after %d ms\n",
MAILBOX1_ATTEMPTS * MAILBOX1_TIMEOUT);
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write f/w startup handshake to MAILBOX2\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read UniFi Mailbox0 register\n");
- func_exit_r(r);
return r;
}
}
r = ConvertCsrSdioToCsrHipResult(card, sr);
- func_exit_r(r);
return r;
}
if (card->fh_buffer.buf == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for F-H signals\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY);
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
}
card->fh_buffer.bufsize = UNIFI_FH_BUF_SIZE;
if (card->th_buffer.buf == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for T-H signals\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY);
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
}
card->th_buffer.bufsize = UNIFI_FH_BUF_SIZE;
if (card->from_host_data == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY);
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
}
if (card->fh_slot_host_tag_record == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for F-H slot host tag mapping array\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY);
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
}
if (card->to_host_data == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_NO_MEMORY);
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
}
{
unifi_error(card->ospriv, "Failed to allocate card memory resources.\n");
card_free_memory_resources(card);
- func_exit_r(r);
return r;
}
if (card->sdio_ctrl_addr == 0)
{
unifi_error(card->ospriv, "Failed to find config struct!\n");
- func_exit_r(CSR_WIFI_HIP_RESULT_INVALID_VALUE);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read from-host sig written count\n");
- func_exit_r(r);
return r;
}
card->from_host_signals_w = (s16)s;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read to-host sig read count\n");
- func_exit_r(r);
return r;
}
card->to_host_signals_r = (s16)s;
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to write initialised flag\n");
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to identify hw\n");
- func_exit_r(r);
return r;
}
if (csrResult != CSR_RESULT_SUCCESS)
{
r = ConvertCsrSdioToCsrHipResult(card, csrResult);
- func_exit_r(r);
return r;
}
card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
r = ConvertCsrSdioToCsrHipResult(card, csrResult);
/* Can't enable WLAN function. Try resetting the SDIO block. */
unifi_error(card->ospriv, "Failed to re-enable function %d.\n", card->function);
- func_exit_r(r);
return r;
}
r = unifi_read_chip_version(card);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to read GBL_CHIP_VERSION\n");
- func_exit_r(r);
return r;
}
card->chip_version = ver;
unifi_info(card->ospriv, "Chip Version 0x%04X\n", card->chip_version);
- func_exit_r(r);
return r;
} /* unifi_read_chip_version() */
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "unifi_prepare_hw failed after hard reset\n");
- func_exit_r(r);
return r;
}
}
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "software hard reset failed\n");
- func_exit_r(r);
return r;
}
r = unifi_read_chip_version(card);
if (r != CSR_RESULT_SUCCESS)
{
- func_exit_r(r);
return r;
}
}
}
- func_exit_r(r);
return r;
} /* unifi_reset_hardware() */
if (r != CSR_RESULT_SUCCESS)
{
unifi_warning(card->ospriv, "SDIO error writing SDIO_CSR_FUNC_EN: %d\n", r);
- func_exit_r(r);
return r;
}
else
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "Failed to set UNIFI_HOST_STATE_DROWSY\n");
- func_exit_r(r);
return r;
}
CsrThreadSleep(5);
if (r != CSR_RESULT_SUCCESS)
{
unifi_warning(card->ospriv, "SDIO error writing DBG_RESET: %d\n", r);
- func_exit_r(r);
return r;
}
unifi_error(card->ospriv,
"Hard reset (Code download) is unsupported\n");
- func_exit_r(CSR_RESULT_FAILURE);
return CSR_RESULT_FAILURE;
}
/* Software hard reset */
r = card_reset_method_dbg_reset(card);
- func_exit_r(r);
return r;
} /* unifi_card_hard_reset() */
if (r != CSR_RESULT_SUCCESS)
{
unifi_error(card->ospriv, "SDIO error writing UNIFI_SHARED_IO_INTERRUPT: %d\n", r);
- func_exit_r(r);
return r;
}