u32 SdioLocalCmd53Read4Byte(PADAPTER padapter, u32 addr) { PSDIO_DATA psdio; u8 bMacPwrCtrlOn; u32 val; val = 0; psdio = &adapter_to_dvobj(padapter)->intf_data; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if ((_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == padapter->pwrctrlpriv.bFwCurrentInPSMode) #endif ) { sd_cmd52_read(psdio, addr, 4, (u8*)&val); val = le32_to_cpu(val); } else val = sd_read32(psdio, addr, NULL); return val; }
static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr) { struct adapter *adapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; u32 val; s32 err; __le32 le_tmp; adapter = intfhdl->padapter; ftaddr = _cvrt2ftaddr(addr, &device_id, &offset); rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); if ( ((device_id == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (!mac_pwr_ctrl_on) || (adapter_to_pwrctl(adapter)->bFwCurrentInPSMode) ) { err = sd_cmd52_read(intfhdl, ftaddr, 4, (u8 *)&le_tmp); #ifdef SDIO_DEBUG_IO if (!err) { #endif return le32_to_cpu(le_tmp); #ifdef SDIO_DEBUG_IO } DBG_8192C(KERN_ERR "%s: Mac Power off, Read FAIL(%d)! addr = 0x%x\n", __func__, err, addr); return SDIO_ERR_VAL32; #endif } /* 4 bytes alignment */ shift = ftaddr & 0x3; if (shift == 0) { val = sd_read32(intfhdl, ftaddr, NULL); } else { u8 *tmpbuf; tmpbuf = rtw_malloc(8); if (!tmpbuf) { DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size =8) addr = 0x%x\n", __func__, addr); return SDIO_ERR_VAL32; } ftaddr &= ~(u16)0x3; sd_read(intfhdl, ftaddr, 8, tmpbuf); memcpy(&le_tmp, tmpbuf+shift, 4); val = le32_to_cpu(le_tmp); kfree(tmpbuf); } return val; }
static u32 SdioLocalCmd53Read4Byte(struct adapter *adapter, u32 addr) { u8 mac_pwr_ctrl_on; u32 val = 0; struct intf_hdl *intfhdl = &adapter->iopriv.intf; __le32 le_tmp; HalSdioGetCmdAddr8723BSdio(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); if (!mac_pwr_ctrl_on || adapter_to_pwrctl(adapter)->bFwCurrentInPSMode) { sd_cmd52_read(intfhdl, addr, 4, (u8 *)&le_tmp); val = le32_to_cpu(le_tmp); } else { val = sd_read32(intfhdl, addr, NULL); } return val; }
u32 SdioLocalCmd53Read4Byte(PADAPTER padapter, u32 addr) { u8 bMacPwrCtrlOn; u32 val = 0; struct intf_hdl * pintfhdl=&padapter->iopriv.intf; HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if ((_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) #endif ) { sd_cmd52_read(pintfhdl, addr, 4, (u8*)&val); val = le32_to_cpu(val); } else val = sd_read32(pintfhdl, addr, NULL); return val; }
u32 sdio_read32(struct intf_hdl *pintfhdl, u32 addr) { PADAPTER padapter; u8 bMacPwrCtrlOn; u8 deviceId; u16 offset; u32 ftaddr; u8 shift; u32 val; s32 err; _func_enter_; padapter = pintfhdl->padapter; ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) #endif ) { err = sd_cmd52_read(pintfhdl, ftaddr, 4, (u8*)&val); #ifdef SDIO_DEBUG_IO if (!err) { #endif val = le32_to_cpu(val); return val; #ifdef SDIO_DEBUG_IO } DBG_8192C(KERN_ERR "%s: Mac Power off, Read FAIL(%d)! addr=0x%x\n", __func__, err, addr); return SDIO_ERR_VAL32; #endif } // 4 bytes alignment shift = ftaddr & 0x3; if (shift == 0) { val = sd_read32(pintfhdl, ftaddr, NULL); } else { u8 *ptmpbuf; ptmpbuf = (u8*)rtw_malloc(8); if (NULL == ptmpbuf) { DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size=8) addr=0x%x\n", __func__, addr); return SDIO_ERR_VAL32; } ftaddr &= ~(u16)0x3; sd_read(pintfhdl, ftaddr, 8, ptmpbuf); _rtw_memcpy(&val, ptmpbuf+shift, 4); val = le32_to_cpu(val); rtw_mfree(ptmpbuf, 8); } _func_exit_; return val; }