ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / hal / hal_halmac.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2015 - 2016 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef _HAL_HALMAC_H_
21 #define _HAL_HALMAC_H_
22
23 #include <drv_types.h>          /* adapter_to_dvobj(), struct intf_hdl and etc. */
24 #include <hal_data.h>           /* struct hal_spec_t */
25 #include "halmac/halmac_api.h"  /* PHALMAC_ADAPTER and etc. */
26
27 /* HALMAC Definition for Driver */
28 #define RTW_HALMAC_H2C_MAX_SIZE         HALMAC_H2C_CMD_ORIGINAL_SIZE_88XX
29 #define RTW_HALMAC_BA_SSN_RPT_SIZE      4
30
31 #define dvobj_set_halmac(d, mac)        ((d)->halmac = (mac))
32 #define dvobj_to_halmac(d)              ((PHALMAC_ADAPTER)((d)->halmac))
33 #define adapter_to_halmac(p)            dvobj_to_halmac(adapter_to_dvobj(p))
34
35 /* for H2C cmd */
36 #define MAX_H2C_BOX_NUMS 4
37 #define MESSAGE_BOX_SIZE 4
38 #define EX_MESSAGE_BOX_SIZE 4
39
40 typedef enum _RTW_HALMAC_MODE {
41         RTW_HALMAC_MODE_NORMAL,
42         RTW_HALMAC_MODE_WIFI_TEST,
43 } RTW_HALMAC_MODE;
44
45 extern HALMAC_PLATFORM_API rtw_halmac_platform_api;
46
47 /* HALMAC API for Driver(HAL) */
48 u8 rtw_halmac_read8(struct intf_hdl *, u32 addr);
49 u16 rtw_halmac_read16(struct intf_hdl *, u32 addr);
50 u32 rtw_halmac_read32(struct intf_hdl *, u32 addr);
51 void rtw_halmac_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
52 #ifdef CONFIG_SDIO_INDIRECT_ACCESS
53 u8 rtw_halmac_iread8(struct intf_hdl *pintfhdl, u32 addr);
54 u16 rtw_halmac_iread16(struct intf_hdl *pintfhdl, u32 addr);
55 u32 rtw_halmac_iread32(struct intf_hdl *pintfhdl, u32 addr);
56 #endif
57 int rtw_halmac_write8(struct intf_hdl *, u32 addr, u8 value);
58 int rtw_halmac_write16(struct intf_hdl *, u32 addr, u16 value);
59 int rtw_halmac_write32(struct intf_hdl *, u32 addr, u32 value);
60
61 void rtw_dump_halmac_info(void *sel);
62 int rtw_halmac_init_adapter(struct dvobj_priv *, PHALMAC_PLATFORM_API);
63 int rtw_halmac_deinit_adapter(struct dvobj_priv *);
64 int rtw_halmac_poweron(struct dvobj_priv *);
65 int rtw_halmac_poweroff(struct dvobj_priv *);
66 int rtw_halmac_init_hal(struct dvobj_priv *);
67 int rtw_halmac_init_hal_fw(struct dvobj_priv *, u8 *fw, u32 fwsize);
68 int rtw_halmac_init_hal_fw_file(struct dvobj_priv *, u8 *fwpath);
69 int rtw_halmac_deinit_hal(struct dvobj_priv *);
70 int rtw_halmac_self_verify(struct dvobj_priv *);
71 int rtw_halmac_dlfw(struct dvobj_priv *, u8 *fw, u32 fwsize);
72 int rtw_halmac_dlfw_from_file(struct dvobj_priv *, u8 *fwpath);
73 int rtw_halmac_phy_power_switch(struct dvobj_priv *, u8 enable);
74 int rtw_halmac_send_h2c(struct dvobj_priv *, u8 *h2c);
75 int rtw_halmac_c2h_handle(struct dvobj_priv *, u8 *c2h, u32 size);
76 int rtw_halmac_get_available_efuse_size(struct dvobj_priv *d, u32 *size);
77
78 int rtw_halmac_get_physical_efuse_size(struct dvobj_priv *, u32 *size);
79 int rtw_halmac_read_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
80 int rtw_halmac_read_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
81 int rtw_halmac_write_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
82 int rtw_halmac_get_logical_efuse_size(struct dvobj_priv *, u32 *size);
83 int rtw_halmac_read_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
84 int rtw_halmac_write_logical_efuse_map(struct dvobj_priv *, u8 *map, u32 size, u8 *maskmap, u32 masksize);
85 int rtw_halmac_read_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
86 int rtw_halmac_write_logical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
87
88 int rtw_halmac_write_bt_physical_efuse(struct dvobj_priv *, u32 offset, u32 cnt, u8 *data);
89 int rtw_halmac_read_bt_physical_efuse_map(struct dvobj_priv *, u8 *map, u32 size);
90
91 int rtw_halmac_config_rx_info(struct dvobj_priv *, HALMAC_DRV_INFO);
92 int rtw_halmac_set_mac_address(struct dvobj_priv *, enum _hw_port, u8 *addr);
93 int rtw_halmac_set_bssid(struct dvobj_priv *, enum _hw_port hwport, u8 *addr);
94
95 int rtw_halmac_set_bandwidth(struct dvobj_priv *, u8 channel, u8 pri_ch_idx, u8 bw);
96 int rtw_halmac_dump_fifo(struct dvobj_priv *d, u8 fifo_sel, u32 addr, u32 size, u8 *buffer);
97 int rtw_halmac_rx_agg_switch(struct dvobj_priv *, u8 enable);
98 int rtw_halmac_get_hw_value(struct dvobj_priv *, HALMAC_HW_ID hw_id, VOID *pvalue);
99 int rtw_halmac_get_wow_reason(struct dvobj_priv *, u8 *reason);
100 int rtw_halmac_get_drv_info_sz(struct dvobj_priv *, u8 *sz);
101 int rtw_halmac_get_rsvd_drv_pg_bndy(struct dvobj_priv *dvobj, u16 *drv_pg);
102 int rtw_halmac_download_rsvd_page(struct dvobj_priv *dvobj, u8 pg_offset, u8 *pbuf, u32 size);
103 int rtw_halmac_fill_hal_spec(struct dvobj_priv *, struct hal_spec_t *);
104
105 #ifdef CONFIG_SDIO_HCI
106 int rtw_halmac_query_tx_page_num(struct dvobj_priv *);
107 int rtw_halmac_get_tx_queue_page_num(struct dvobj_priv *, u8 queue, u32 *page);
108 u32 rtw_halmac_sdio_get_tx_addr(struct dvobj_priv *, u8 *desc, u32 size);
109 int rtw_halmac_sdio_tx_allowed(struct dvobj_priv *, u8 *buf, u32 size);
110 u32 rtw_halmac_sdio_get_rx_addr(struct dvobj_priv *, u8 *seq);
111 #endif /* CONFIG_SDIO_HCI */
112
113 #ifdef CONFIG_USB_HCI
114 u8 rtw_halmac_usb_get_bulkout_id(struct dvobj_priv *, u8 *buf, u32 size);
115 u8 rtw_halmac_switch_usb_mode(struct dvobj_priv *d, enum RTW_USB_SPEED usb_mode);
116 #endif /* CONFIG_USB_HCI */
117
118 #ifdef CONFIG_SUPPORT_TRX_SHARED
119 void dump_trx_share_mode(void *sel, _adapter *adapter);
120 #endif
121 #endif /* _HAL_HALMAC_H_ */