Lines Matching +full:int +full:- +full:map +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
5 * Copyright(c) 2018-2019 Realtek Corporation
16 [DESC_RATE1M] = { .addr = 0xe08, .mask = 0x0000ff00 },
17 [DESC_RATE2M] = { .addr = 0x86c, .mask = 0x0000ff00 },
18 [DESC_RATE5_5M] = { .addr = 0x86c, .mask = 0x00ff0000 },
19 [DESC_RATE11M] = { .addr = 0x86c, .mask = 0xff000000 },
20 [DESC_RATE6M] = { .addr = 0xe00, .mask = 0x000000ff },
21 [DESC_RATE9M] = { .addr = 0xe00, .mask = 0x0000ff00 },
22 [DESC_RATE12M] = { .addr = 0xe00, .mask = 0x00ff0000 },
23 [DESC_RATE18M] = { .addr = 0xe00, .mask = 0xff000000 },
24 [DESC_RATE24M] = { .addr = 0xe04, .mask = 0x000000ff },
25 [DESC_RATE36M] = { .addr = 0xe04, .mask = 0x0000ff00 },
26 [DESC_RATE48M] = { .addr = 0xe04, .mask = 0x00ff0000 },
27 [DESC_RATE54M] = { .addr = 0xe04, .mask = 0xff000000 },
28 [DESC_RATEMCS0] = { .addr = 0xe10, .mask = 0x000000ff },
29 [DESC_RATEMCS1] = { .addr = 0xe10, .mask = 0x0000ff00 },
30 [DESC_RATEMCS2] = { .addr = 0xe10, .mask = 0x00ff0000 },
31 [DESC_RATEMCS3] = { .addr = 0xe10, .mask = 0xff000000 },
32 [DESC_RATEMCS4] = { .addr = 0xe14, .mask = 0x000000ff },
33 [DESC_RATEMCS5] = { .addr = 0xe14, .mask = 0x0000ff00 },
34 [DESC_RATEMCS6] = { .addr = 0xe14, .mask = 0x00ff0000 },
35 [DESC_RATEMCS7] = { .addr = 0xe14, .mask = 0xff000000 },
42 int ret; in __rtw8723x_lck()
66 #define DBG_EFUSE_VAL(rtwdev, map, name) \ argument
68 (map)->name)
69 #define DBG_EFUSE_2BYTE(rtwdev, map, name) \ argument
71 (map)->name[0], (map)->name[1])
74 struct rtw8723x_efuse *map) in rtw8723xe_efuse_debug() argument
76 rtw_dbg(rtwdev, RTW_DBG_EFUSE, "mac_addr=%pM\n", map->e.mac_addr); in rtw8723xe_efuse_debug()
77 DBG_EFUSE_2BYTE(rtwdev, map, e.vendor_id); in rtw8723xe_efuse_debug()
78 DBG_EFUSE_2BYTE(rtwdev, map, e.device_id); in rtw8723xe_efuse_debug()
79 DBG_EFUSE_2BYTE(rtwdev, map, e.sub_vendor_id); in rtw8723xe_efuse_debug()
80 DBG_EFUSE_2BYTE(rtwdev, map, e.sub_device_id); in rtw8723xe_efuse_debug()
84 struct rtw8723x_efuse *map) in rtw8723xu_efuse_debug() argument
86 DBG_EFUSE_2BYTE(rtwdev, map, u.vendor_id); in rtw8723xu_efuse_debug()
87 DBG_EFUSE_2BYTE(rtwdev, map, u.product_id); in rtw8723xu_efuse_debug()
88 DBG_EFUSE_VAL(rtwdev, map, u.usb_option); in rtw8723xu_efuse_debug()
89 rtw_dbg(rtwdev, RTW_DBG_EFUSE, "mac_addr=%pM\n", map->u.mac_addr); in rtw8723xu_efuse_debug()
93 struct rtw8723x_efuse *map) in rtw8723xs_efuse_debug() argument
95 rtw_dbg(rtwdev, RTW_DBG_EFUSE, "mac_addr=%pM\n", map->s.mac_addr); in rtw8723xs_efuse_debug()
100 int tx_path_count) in __rtw8723x_debug_txpwr_limit()
110 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
123 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
130 /* BW40-1S base */ in __rtw8723x_debug_txpwr_limit()
131 rtw_dbg(rtwdev, RTW_DBG_EFUSE, "BW40-1S base\n"); in __rtw8723x_debug_txpwr_limit()
133 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
145 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
156 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
167 for (int i = 0; i < tx_path_count; i++) in __rtw8723x_debug_txpwr_limit()
177 struct rtw8723x_efuse *map) in efuse_debug_dump() argument
182 rtw_dbg(rtwdev, RTW_DBG_EFUSE, "EFUSE raw logical map:\n"); in efuse_debug_dump()
184 (u8 *)map, sizeof(struct rtw8723x_efuse), false); in efuse_debug_dump()
186 DBG_EFUSE_VAL(rtwdev, map, rtl_id); in efuse_debug_dump()
187 DBG_EFUSE_VAL(rtwdev, map, afe); in efuse_debug_dump()
188 rtw8723x_debug_txpwr_limit(rtwdev, map->txpwr_idx_table, 4); in efuse_debug_dump()
189 DBG_EFUSE_VAL(rtwdev, map, channel_plan); in efuse_debug_dump()
190 DBG_EFUSE_VAL(rtwdev, map, xtal_k); in efuse_debug_dump()
191 DBG_EFUSE_VAL(rtwdev, map, thermal_meter); in efuse_debug_dump()
192 DBG_EFUSE_VAL(rtwdev, map, iqk_lck); in efuse_debug_dump()
193 DBG_EFUSE_VAL(rtwdev, map, pa_type); in efuse_debug_dump()
194 DBG_EFUSE_2BYTE(rtwdev, map, lna_type_2g); in efuse_debug_dump()
195 DBG_EFUSE_2BYTE(rtwdev, map, lna_type_5g); in efuse_debug_dump()
196 DBG_EFUSE_VAL(rtwdev, map, rf_board_option); in efuse_debug_dump()
197 DBG_EFUSE_VAL(rtwdev, map, rf_feature_option); in efuse_debug_dump()
198 DBG_EFUSE_VAL(rtwdev, map, rf_bt_setting); in efuse_debug_dump()
199 DBG_EFUSE_VAL(rtwdev, map, eeprom_version); in efuse_debug_dump()
200 DBG_EFUSE_VAL(rtwdev, map, eeprom_customer_id); in efuse_debug_dump()
201 DBG_EFUSE_VAL(rtwdev, map, tx_bb_swing_setting_2g); in efuse_debug_dump()
202 DBG_EFUSE_VAL(rtwdev, map, tx_pwr_calibrate_rate); in efuse_debug_dump()
203 DBG_EFUSE_VAL(rtwdev, map, rf_antenna_option); in efuse_debug_dump()
204 DBG_EFUSE_VAL(rtwdev, map, rfe_option); in efuse_debug_dump()
205 DBG_EFUSE_2BYTE(rtwdev, map, country_code); in efuse_debug_dump()
209 rtw8723xe_efuse_debug(rtwdev, map); in efuse_debug_dump()
212 rtw8723xu_efuse_debug(rtwdev, map); in efuse_debug_dump()
215 rtw8723xs_efuse_debug(rtwdev, map); in efuse_debug_dump()
224 struct rtw8723x_efuse *map) in rtw8723xe_efuse_parsing() argument
226 ether_addr_copy(efuse->addr, map->e.mac_addr); in rtw8723xe_efuse_parsing()
230 struct rtw8723x_efuse *map) in rtw8723xu_efuse_parsing() argument
232 ether_addr_copy(efuse->addr, map->u.mac_addr); in rtw8723xu_efuse_parsing()
236 struct rtw8723x_efuse *map) in rtw8723xs_efuse_parsing() argument
238 ether_addr_copy(efuse->addr, map->s.mac_addr); in rtw8723xs_efuse_parsing()
241 static int __rtw8723x_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) in __rtw8723x_read_efuse()
243 struct rtw_efuse *efuse = &rtwdev->efuse; in __rtw8723x_read_efuse()
244 struct rtw8723x_efuse *map; in __rtw8723x_read_efuse() local
245 int i; in __rtw8723x_read_efuse()
247 map = (struct rtw8723x_efuse *)log_map; in __rtw8723x_read_efuse()
248 efuse_debug_dump(rtwdev, map); in __rtw8723x_read_efuse()
250 efuse->rfe_option = 0; in __rtw8723x_read_efuse()
251 efuse->rf_board_option = map->rf_board_option; in __rtw8723x_read_efuse()
252 efuse->crystal_cap = map->xtal_k; in __rtw8723x_read_efuse()
253 efuse->pa_type_2g = map->pa_type; in __rtw8723x_read_efuse()
254 efuse->lna_type_2g = map->lna_type_2g[0]; in __rtw8723x_read_efuse()
255 efuse->channel_plan = map->channel_plan; in __rtw8723x_read_efuse()
256 efuse->country_code[0] = map->country_code[0]; in __rtw8723x_read_efuse()
257 efuse->country_code[1] = map->country_code[1]; in __rtw8723x_read_efuse()
258 efuse->bt_setting = map->rf_bt_setting; in __rtw8723x_read_efuse()
259 efuse->regd = map->rf_board_option & 0x7; in __rtw8723x_read_efuse()
260 efuse->thermal_meter[0] = map->thermal_meter; in __rtw8723x_read_efuse()
261 efuse->thermal_meter_k = map->thermal_meter; in __rtw8723x_read_efuse()
262 efuse->afe = map->afe; in __rtw8723x_read_efuse()
265 efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i]; in __rtw8723x_read_efuse()
269 rtw8723xe_efuse_parsing(efuse, map); in __rtw8723x_read_efuse()
272 rtw8723xu_efuse_parsing(efuse, map); in __rtw8723x_read_efuse()
275 rtw8723xs_efuse_parsing(efuse, map); in __rtw8723x_read_efuse()
279 return -EOPNOTSUPP; in __rtw8723x_read_efuse()
295 static int __rtw8723x_mac_init(struct rtw_dev *rtwdev) in __rtw8723x_mac_init()
331 struct rtw_hal *hal = &rtwdev->hal; in rtw8723x_set_tx_power_index_by_rate()
334 int j; in rtw8723x_set_tx_power_index_by_rate()
338 pwr_index = hal->tx_pwr_tbl[path][rate]; in rtw8723x_set_tx_power_index_by_rate()
345 if (!txagc->addr) { in rtw8723x_set_tx_power_index_by_rate()
350 rtw_write32_mask(rtwdev, txagc->addr, txagc->mask, pwr_index); in rtw8723x_set_tx_power_index_by_rate()
356 struct rtw_hal *hal = &rtwdev->hal; in __rtw8723x_set_tx_power_index()
357 int rs, path; in __rtw8723x_set_tx_power_index()
359 for (path = 0; path < hal->rf_path_num; path++) { in __rtw8723x_set_tx_power_index()
379 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in __rtw8723x_false_alarm_statistics()
398 dm_info->ofdm_cca_cnt = u32_get_bits(val32, BIT_MASK_OFDM_CCA_CNT); in __rtw8723x_false_alarm_statistics()
406 dm_info->cck_fa_cnt = cck_fa_cnt; in __rtw8723x_false_alarm_statistics()
407 dm_info->ofdm_fa_cnt = ofdm_fa_cnt; in __rtw8723x_false_alarm_statistics()
408 dm_info->total_fa_cnt = cck_fa_cnt + ofdm_fa_cnt; in __rtw8723x_false_alarm_statistics()
410 dm_info->cck_err_cnt = rtw_read32(rtwdev, REG_IGI_C_11N); in __rtw8723x_false_alarm_statistics()
411 dm_info->cck_ok_cnt = rtw_read32(rtwdev, REG_IGI_D_11N); in __rtw8723x_false_alarm_statistics()
413 dm_info->ofdm_err_cnt = u32_get_bits(crc32_cnt, BIT_MASK_OFDM_LCRC_ERR); in __rtw8723x_false_alarm_statistics()
414 dm_info->ofdm_ok_cnt = u32_get_bits(crc32_cnt, BIT_MASK_OFDM_LCRC_OK); in __rtw8723x_false_alarm_statistics()
416 dm_info->ht_err_cnt = u32_get_bits(crc32_cnt, BIT_MASK_HT_CRC_ERR); in __rtw8723x_false_alarm_statistics()
417 dm_info->ht_ok_cnt = u32_get_bits(crc32_cnt, BIT_MASK_HT_CRC_OK); in __rtw8723x_false_alarm_statistics()
418 dm_info->vht_err_cnt = 0; in __rtw8723x_false_alarm_statistics()
419 dm_info->vht_ok_cnt = 0; in __rtw8723x_false_alarm_statistics()
422 dm_info->cck_cca_cnt = (u32_get_bits(val32, BIT_MASK_CCK_FA_MSB) << 8) | in __rtw8723x_false_alarm_statistics()
424 dm_info->total_cca_cnt = dm_info->cck_cca_cnt + dm_info->ofdm_cca_cnt; in __rtw8723x_false_alarm_statistics()
447 int i; in __rtw8723x_iqk_backup_regs()
450 backup->adda[i] = rtw_read32(rtwdev, in __rtw8723x_iqk_backup_regs()
454 backup->mac8[i] = rtw_read8(rtwdev, in __rtw8723x_iqk_backup_regs()
457 backup->mac32[i] = rtw_read32(rtwdev, in __rtw8723x_iqk_backup_regs()
461 backup->bb[i] = rtw_read32(rtwdev, in __rtw8723x_iqk_backup_regs()
464 backup->igia = rtw_read32_mask(rtwdev, REG_OFDM0_XAAGC1, MASKBYTE0); in __rtw8723x_iqk_backup_regs()
465 backup->igib = rtw_read32_mask(rtwdev, REG_OFDM0_XBAGC1, MASKBYTE0); in __rtw8723x_iqk_backup_regs()
467 backup->bb_sel_btg = rtw_read32(rtwdev, REG_BB_SEL_BTG); in __rtw8723x_iqk_backup_regs()
474 int i; in __rtw8723x_iqk_restore_regs()
478 backup->adda[i]); in __rtw8723x_iqk_restore_regs()
482 backup->mac8[i]); in __rtw8723x_iqk_restore_regs()
485 backup->mac32[i]); in __rtw8723x_iqk_restore_regs()
489 backup->bb[i]); in __rtw8723x_iqk_restore_regs()
492 rtw_write32_mask(rtwdev, REG_OFDM0_XAAGC1, MASKBYTE0, backup->igia); in __rtw8723x_iqk_restore_regs()
495 rtw_write32_mask(rtwdev, REG_OFDM0_XBAGC1, MASKBYTE0, backup->igib); in __rtw8723x_iqk_restore_regs()
517 diff = abs(tmp1 - tmp2); in __rtw8723x_iqk_similarity_cmp()
562 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in __rtw8723x_pwrtrack_get_limit_ofdm()
563 u8 tx_rate = dm_info->tx_rate; in __rtw8723x_pwrtrack_get_limit_ofdm()
597 struct rtw_dm_info *dm_info = &rtwdev->dm_info; in __rtw8723x_pwrtrack_set_xtal()
598 const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl; in __rtw8723x_pwrtrack_set_xtal()
602 if (dm_info->thermal_avg[therm_path] > in __rtw8723x_pwrtrack_set_xtal()
603 rtwdev->efuse.thermal_meter[therm_path]) in __rtw8723x_pwrtrack_set_xtal()
604 pwrtrk_xtal = tbl->pwrtrk_xtal_p; in __rtw8723x_pwrtrack_set_xtal()
606 pwrtrk_xtal = tbl->pwrtrk_xtal_n; in __rtw8723x_pwrtrack_set_xtal()
608 xtal_cap = rtwdev->efuse.crystal_cap & 0x3F; in __rtw8723x_pwrtrack_set_xtal()
624 le32p_replace_bits(&tx_desc->w7, 0, RTW_TX_DESC_W7_TXDESC_CHECKSUM); in __rtw8723x_fill_txdesc_checksum()
626 while (words--) in __rtw8723x_fill_txdesc_checksum()
631 le32p_replace_bits(&tx_desc->w7, __le16_to_cpu(chksum), in __rtw8723x_fill_txdesc_checksum()
647 /* enable PTA (3-wire function form BT side) */ in __rtw8723x_coex_cfg_init()
678 [0] = { .addr = 0xc50, .mask = 0x7f },
679 [1] = { .addr = 0xc50, .mask = 0x7f },
682 [0] = { .addr = 0xa0c, .mask = 0x3f00 },