xref: /linux/drivers/net/wireless/realtek/rtw88/efuse.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1e3037485SYan-Hsuan Chuang /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2e3037485SYan-Hsuan Chuang /* Copyright(c) 2018-2019  Realtek Corporation
3e3037485SYan-Hsuan Chuang  */
4e3037485SYan-Hsuan Chuang 
5e3037485SYan-Hsuan Chuang #ifndef __RTW_EFUSE_H__
6e3037485SYan-Hsuan Chuang #define __RTW_EFUSE_H__
7e3037485SYan-Hsuan Chuang 
8e3037485SYan-Hsuan Chuang #define EFUSE_HW_CAP_IGNORE		0
9e3037485SYan-Hsuan Chuang #define EFUSE_HW_CAP_PTCL_VHT		3
10e3037485SYan-Hsuan Chuang #define EFUSE_HW_CAP_SUPP_BW80		7
11e3037485SYan-Hsuan Chuang #define EFUSE_HW_CAP_SUPP_BW40		6
12e3037485SYan-Hsuan Chuang 
13*5ad4d895STzu-En Huang #define EFUSE_READ_FAIL			0xff
14*5ad4d895STzu-En Huang 
15e3037485SYan-Hsuan Chuang #define GET_EFUSE_HW_CAP_HCI(hw_cap)					       \
16e3037485SYan-Hsuan Chuang 	le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(3, 0))
17e3037485SYan-Hsuan Chuang #define GET_EFUSE_HW_CAP_BW(hw_cap)					       \
18e3037485SYan-Hsuan Chuang 	le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(18, 16))
19e3037485SYan-Hsuan Chuang #define GET_EFUSE_HW_CAP_NSS(hw_cap)					       \
20e3037485SYan-Hsuan Chuang 	le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(20, 19))
21e3037485SYan-Hsuan Chuang #define GET_EFUSE_HW_CAP_ANT_NUM(hw_cap)				       \
22e3037485SYan-Hsuan Chuang 	le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(23, 21))
23e3037485SYan-Hsuan Chuang #define GET_EFUSE_HW_CAP_PTCL(hw_cap)					       \
24e3037485SYan-Hsuan Chuang 	le32_get_bits(*((__le32 *)(hw_cap) + 0x01), GENMASK(27, 26))
25e3037485SYan-Hsuan Chuang 
26e3037485SYan-Hsuan Chuang int rtw_parse_efuse_map(struct rtw_dev *rtwdev);
27*5ad4d895STzu-En Huang int rtw_read8_physical_efuse(struct rtw_dev *rtwdev, u16 addr, u8 *data);
28e3037485SYan-Hsuan Chuang 
29e3037485SYan-Hsuan Chuang #endif
30