1 /******************************************************************************
2 *
3 * Copyright(c) 2019 Realtek Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *****************************************************************************/
15 #define _HAL_SDIO_C_
16 #include "hal_headers.h"
17
18 #ifdef CONFIG_SDIO_HCI
hal_sdio_f0_read8(struct rtw_hal_com_t * hal,u32 addr)19 static u8 hal_sdio_f0_read8(struct rtw_hal_com_t *hal, u32 addr)
20 {
21 u8 val = 0;
22 u8 ret;
23
24 ret = _os_sdio_f0_read(hal->drv_priv, addr, &val, 1);
25 if (_FAIL == ret)
26 PHL_ERR("%s: Read f0 register(0x%x) FAIL!\n",
27 __FUNCTION__, addr);
28
29 return val;
30 }
31 #ifdef RTW_WKARD_BUS_WRITE
sdio_write_post_cfg(struct rtw_hal_com_t * hal,u32 addr,u32 val)32 static int sdio_write_post_cfg(struct rtw_hal_com_t *hal, u32 addr, u32 val)
33 {
34 struct hal_info_t *hal_info = hal->hal_priv;
35 struct hal_ops_t *hal_ops = hal_get_ops(hal_info);
36
37 enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
38
39 if(NULL != hal_ops->write_reg_post_cfg) {
40 hal_status = hal_ops->write_reg_post_cfg(hal_info, addr, val);
41 }
42
43 return hal_status;
44 }
45 #endif
hal_sdio_set_io_ops(struct rtw_hal_com_t * hal,struct hal_io_ops * pops)46 void hal_sdio_set_io_ops(struct rtw_hal_com_t *hal, struct hal_io_ops *pops)
47 {
48 pops->_read8 = hal_mac_sdio_read8;
49 pops->_read16 = hal_mac_sdio_read16;
50 pops->_read32 = hal_mac_sdio_read32;
51 pops->_read_mem = hal_mac_sdio_read_mem;
52
53 pops->_write8 = hal_mac_sdio_write8;
54 pops->_write16 = hal_mac_sdio_write16;
55 pops->_write32 = hal_mac_sdio_write32;
56
57 pops->_sd_f0_read8 = hal_sdio_f0_read8;
58
59 #ifdef CONFIG_SDIO_INDIRECT_ACCESS
60 pops->_sd_iread8 = hal_mac_sdio_iread8;
61 pops->_sd_iread16 = hal_mac_sdio_iread16;
62 pops->_sd_iread32 = hal_mac_sdio_iread32;
63 pops->_sd_iwrite8 = hal_mac_sdio_write8;
64 pops->_sd_iwrite16 = hal_mac_sdio_write16;
65 pops->_sd_iwrite32 = hal_mac_sdio_write32;
66 #endif /* CONFIG_SDIO_INDIRECT_ACCESS */
67 #ifdef RTW_WKARD_BUS_WRITE
68 pops->_write_post_cfg = &sdio_write_post_cfg;
69 #endif
70 }
71 #endif
72