xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/hal_sdio.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 #ifndef __HAL_SDIO_H_
17 #define __HAL_SDIO_H_
18 
19 #define ffaddr2deviceId(pdvobj, addr)	(pdvobj->Queue2Pipe[addr])
20 
21 u8 rtw_hal_sdio_max_txoqt_free_space(_adapter *padapter);
22 u8 rtw_hal_sdio_query_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum);
23 void rtw_hal_sdio_update_tx_freepage(_adapter *padapter, u8 PageIdx, u8 RequiredPageNum);
24 void rtw_hal_set_sdio_tx_max_length(PADAPTER padapter, u8 numHQ, u8 numNQ, u8 numLQ, u8 numPubQ, u8 div_num);
25 u32 rtw_hal_get_sdio_tx_max_length(PADAPTER padapter, u8 queue_idx);
26 bool sdio_power_on_check(PADAPTER padapter);
27 
28 #ifdef CONFIG_FW_C2H_REG
29 void sd_c2h_hisr_hdl(_adapter *adapter);
30 #endif
31 
32 #if defined(CONFIG_RTL8188F) || defined (CONFIG_RTL8188GTV) || defined (CONFIG_RTL8192F)
33 #define SDIO_LOCAL_CMD_ADDR(addr) ((SDIO_LOCAL_DEVICE_ID << 13) | ((addr) & SDIO_LOCAL_MSK))
34 #endif
35 
36 #ifdef CONFIG_SDIO_CHK_HCI_RESUME
37 bool sdio_chk_hci_resume(struct intf_hdl *pintfhdl);
38 void sdio_chk_hci_suspend(struct intf_hdl *pintfhdl);
39 #else
40 #define sdio_chk_hci_resume(pintfhdl) _FALSE
41 #define sdio_chk_hci_suspend(pintfhdl) do {} while (0)
42 #endif /* CONFIG_SDIO_CHK_HCI_RESUME */
43 
44 #ifdef CONFIG_SDIO_INDIRECT_ACCESS
45 /* program indirect access register in sdio local to read/write page0 registers */
46 s32 sdio_iread(PADAPTER padapter, u32 addr, u8 size, u8 *v);
47 s32 sdio_iwrite(PADAPTER padapter, u32 addr, u8 size, u8 *v);
48 u8 sdio_iread8(struct intf_hdl *pintfhdl, u32 addr);
49 u16 sdio_iread16(struct intf_hdl *pintfhdl, u32 addr);
50 u32 sdio_iread32(struct intf_hdl *pintfhdl, u32 addr);
51 s32 sdio_iwrite8(struct intf_hdl *pintfhdl, u32 addr, u8 val);
52 s32 sdio_iwrite16(struct intf_hdl *pintfhdl, u32 addr, u16 val);
53 s32 sdio_iwrite32(struct intf_hdl *pintfhdl, u32 addr, u32 val);
54 #endif /* CONFIG_SDIO_INDIRECT_ACCESS */
55 u32 cmd53_4byte_alignment(struct intf_hdl *pintfhdl, u32 addr);
56 
57 #endif /* __HAL_SDIO_H_ */
58