| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #include <HalPwrSeqCmd.h> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| u8 HalPwrSeqCmdParsing( |
| <------>PADAPTER padapter, |
| <------>u8 CutVersion, |
| <------>u8 FabVersion, |
| <------>u8 InterfaceType, |
| <------>WLAN_PWR_CFG PwrSeqCmd[]) |
| { |
| <------>WLAN_PWR_CFG PwrCfgCmd = {0}; |
| <------>u8 bPollingBit = _FALSE; |
| <------>u32 AryIdx = 0; |
| <------>u8 value = 0; |
| <------>u32 offset = 0; |
| <------>u32 pollingCount = 0; |
| <------>u32 maxPollingCnt = 5000; |
| |
| <------>do { |
| <------><------>PwrCfgCmd = PwrSeqCmd[AryIdx]; |
| |
| |
| <------><------> |
| <------><------>if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && |
| <------><------> (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) && |
| <------><------> (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) { |
| <------><------><------>switch (GET_PWR_CFG_CMD(PwrCfgCmd)) { |
| <------><------><------>case PWR_CMD_READ: |
| <------><------><------><------>break; |
| |
| <------><------><------>case PWR_CMD_WRITE: |
| <------><------><------><------>offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); |
| |
| #ifdef CONFIG_SDIO_HCI |
| <------><------><------><------> |
| <------><------><------><------> |
| <------><------><------><------> |
| <------><------><------><------> |
| <------><------><------><------>if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) { |
| <------><------><------><------><------> |
| <------><------><------><------><------>value = SdioLocalCmd52Read1Byte(padapter, offset); |
| |
| <------><------><------><------><------>value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); |
| <------><------><------><------><------>value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); |
| |
| <------><------><------><------><------> |
| <------><------><------><------><------>SdioLocalCmd52Write1Byte(padapter, offset, value); |
| <------><------><------><------>} else |
| #endif |
| <------><------><------><------>{ |
| #ifdef CONFIG_GSPI_HCI |
| <------><------><------><------><------>if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) |
| <------><------><------><------><------><------>offset = SPI_LOCAL_OFFSET | offset; |
| #endif |
| <------><------><------><------><------> |
| <------><------><------><------><------>value = rtw_read8(padapter, offset); |
| |
| <------><------><------><------><------>value = value & (~(GET_PWR_CFG_MASK(PwrCfgCmd))); |
| <------><------><------><------><------>value = value | (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); |
| |
| <------><------><------><------><------> |
| <------><------><------><------><------>rtw_write8(padapter, offset, value); |
| <------><------><------><------>} |
| <------><------><------><------>break; |
| |
| <------><------><------>case PWR_CMD_POLLING: |
| |
| <------><------><------><------>bPollingBit = _FALSE; |
| <------><------><------><------>offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); |
| #ifdef CONFIG_GSPI_HCI |
| <------><------><------><------>if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) |
| <------><------><------><------><------>offset = SPI_LOCAL_OFFSET | offset; |
| #endif |
| <------><------><------><------>do { |
| #ifdef CONFIG_SDIO_HCI |
| <------><------><------><------><------>if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) |
| <------><------><------><------><------><------>value = SdioLocalCmd52Read1Byte(padapter, offset); |
| <------><------><------><------><------>else |
| #endif |
| <------><------><------><------><------><------>value = rtw_read8(padapter, offset); |
| |
| <------><------><------><------><------>value = value & GET_PWR_CFG_MASK(PwrCfgCmd); |
| <------><------><------><------><------>if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd))) |
| <------><------><------><------><------><------>bPollingBit = _TRUE; |
| <------><------><------><------><------>else |
| <------><------><------><------><------><------>rtw_udelay_os(10); |
| |
| <------><------><------><------><------>if (pollingCount++ > maxPollingCnt) { |
| <------><------><------><------><------><------>RTW_ERR("HalPwrSeqCmdParsing: Fail to polling Offset[%#x]=%02x\n", offset, value); |
| <------><------><------><------><------><------>return _FALSE; |
| <------><------><------><------><------>} |
| <------><------><------><------>} while (!bPollingBit); |
| |
| <------><------><------><------>break; |
| |
| <------><------><------>case PWR_CMD_DELAY: |
| <------><------><------><------>if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) |
| <------><------><------><------><------>rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd)); |
| <------><------><------><------>else |
| <------><------><------><------><------>rtw_udelay_os(GET_PWR_CFG_OFFSET(PwrCfgCmd) * 1000); |
| <------><------><------><------>break; |
| |
| <------><------><------>case PWR_CMD_END: |
| <------><------><------><------> |
| <------><------><------><------>return _TRUE; |
| <------><------><------><------>break; |
| |
| <------><------><------>default: |
| <------><------><------><------>break; |
| <------><------><------>} |
| <------><------>} |
| |
| <------><------>AryIdx++; |
| <------>} while (1); |
| |
| <------>return _TRUE; |
| } |
| |