Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtw88: 8821c: coex: add functions and parameters

Without this patch, RTL8821CE will not have coex support,
and will crash the system because of the NULL pointers
for the coex functions.

While RTL8822C series are WiFi + BT combo chips, it needs
the co-existence mechanism for the device to work on both
WiFi and BT without interfering each other. And the coex
support has already been added before, most of the mechanisms
are implemented. The driver should just add corresponding
functions to operate on different types of chips and its
coex parameters.

Fixes: f745eb9ca5bf ("rtw88: 8821c: Add 8821CE to Kconfig and Makefile")
Signed-off-by: Ping-Cheng Chen <pc.chen@realtek.com>
Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200724054208.31115-1-yhchuang@realtek.com

authored by

Ping-Cheng Chen and committed by
Kalle Valo
7b080e08 9de6959f

+430
+1
drivers/net/wireless/realtek/rtw88/reg.h
··· 61 61 #define BIT_FSPI_EN BIT(19) 62 62 #define BIT_EN_SIC BIT(12) 63 63 #define BIT_BT_AOD_GPIO3 BIT(9) 64 + #define BIT_PO_BT_PTA_PINS BIT(9) 64 65 #define BIT_BT_PTA_EN BIT(5) 65 66 #define BIT_WLRFE_4_5_EN BIT(2) 66 67
+403
drivers/net/wireless/realtek/rtw88/rtw8821c.c
··· 649 649 rtw8821c_do_iqk(rtwdev); 650 650 } 651 651 652 + /* for coex */ 653 + static void rtw8821c_coex_cfg_init(struct rtw_dev *rtwdev) 654 + { 655 + /* enable TBTT nterrupt */ 656 + rtw_write8_set(rtwdev, REG_BCN_CTRL, BIT_EN_BCN_FUNCTION); 657 + 658 + /* BT report packet sample rate */ 659 + rtw_write8_mask(rtwdev, REG_BT_TDMA_TIME, SAMPLE_RATE_MASK, 660 + SAMPLE_RATE); 661 + 662 + /* enable BT counter statistics */ 663 + rtw_write8(rtwdev, REG_BT_STAT_CTRL, BT_CNT_ENABLE); 664 + 665 + /* enable PTA (3-wire function form BT side) */ 666 + rtw_write32_set(rtwdev, REG_GPIO_MUXCFG, BIT_BT_PTA_EN); 667 + rtw_write32_set(rtwdev, REG_GPIO_MUXCFG, BIT_PO_BT_PTA_PINS); 668 + 669 + /* enable PTA (tx/rx signal form WiFi side) */ 670 + rtw_write8_set(rtwdev, REG_QUEUE_CTRL, BIT_PTA_WL_TX_EN); 671 + /* wl tx signal to PTA not case EDCCA */ 672 + rtw_write8_clr(rtwdev, REG_QUEUE_CTRL, BIT_PTA_EDCCA_EN); 673 + /* GNT_BT=1 while select both */ 674 + rtw_write16_set(rtwdev, REG_BT_COEX_V2, BIT_GNT_BT_POLARITY); 675 + 676 + /* beacon queue always hi-pri */ 677 + rtw_write8_mask(rtwdev, REG_BT_COEX_TABLE_H + 3, BIT_BCN_QUEUE, 678 + BCN_PRI_EN); 679 + } 680 + 681 + static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, 682 + u8 pos_type) 683 + { 684 + struct rtw_coex *coex = &rtwdev->coex; 685 + struct rtw_coex_dm *coex_dm = &coex->dm; 686 + struct rtw_coex_rfe *coex_rfe = &coex->rfe; 687 + u32 switch_status = FIELD_PREP(CTRL_TYPE_MASK, ctrl_type) | pos_type; 688 + bool polarity_inverse; 689 + u8 regval = 0; 690 + 691 + if (switch_status == coex_dm->cur_switch_status) 692 + return; 693 + 694 + coex_dm->cur_switch_status = switch_status; 695 + 696 + if (coex_rfe->ant_switch_diversity && 697 + ctrl_type == COEX_SWITCH_CTRL_BY_BBSW) 698 + ctrl_type = COEX_SWITCH_CTRL_BY_ANTDIV; 699 + 700 + polarity_inverse = (coex_rfe->ant_switch_polarity == 1); 701 + 702 + switch (ctrl_type) { 703 + default: 704 + case COEX_SWITCH_CTRL_BY_BBSW: 705 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 706 + rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); 707 + /* BB SW, DPDT use RFE_ctrl8 and RFE_ctrl9 as ctrl pin */ 708 + rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_RFE_SEL89, 709 + DPDT_CTRL_PIN); 710 + 711 + if (pos_type == COEX_SWITCH_TO_WLG_BT) { 712 + if (coex_rfe->rfe_module_type != 0x4 && 713 + coex_rfe->rfe_module_type != 0x2) 714 + regval = 0x3; 715 + else 716 + regval = (!polarity_inverse ? 0x2 : 0x1); 717 + } else if (pos_type == COEX_SWITCH_TO_WLG) { 718 + regval = (!polarity_inverse ? 0x2 : 0x1); 719 + } else { 720 + regval = (!polarity_inverse ? 0x1 : 0x2); 721 + } 722 + 723 + rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, 724 + regval); 725 + break; 726 + case COEX_SWITCH_CTRL_BY_PTA: 727 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 728 + rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); 729 + /* PTA, DPDT use RFE_ctrl8 and RFE_ctrl9 as ctrl pin */ 730 + rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_RFE_SEL89, 731 + PTA_CTRL_PIN); 732 + 733 + regval = (!polarity_inverse ? 0x2 : 0x1); 734 + rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, 735 + regval); 736 + break; 737 + case COEX_SWITCH_CTRL_BY_ANTDIV: 738 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 739 + rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); 740 + rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_RFE_SEL89, 741 + ANTDIC_CTRL_PIN); 742 + break; 743 + case COEX_SWITCH_CTRL_BY_MAC: 744 + rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 745 + 746 + regval = (!polarity_inverse ? 0x0 : 0x1); 747 + rtw_write8_mask(rtwdev, REG_PAD_CTRL1, BIT_SW_DPDT_SEL_DATA, 748 + regval); 749 + break; 750 + case COEX_SWITCH_CTRL_BY_FW: 751 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 752 + rtw_write32_set(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); 753 + break; 754 + case COEX_SWITCH_CTRL_BY_BT: 755 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); 756 + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_WL_SEL); 757 + break; 758 + } 759 + 760 + if (ctrl_type == COEX_SWITCH_CTRL_BY_BT) { 761 + rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); 762 + rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); 763 + } else { 764 + rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); 765 + rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); 766 + } 767 + } 768 + 769 + static void rtw8821c_coex_cfg_gnt_fix(struct rtw_dev *rtwdev) 770 + {} 771 + 772 + static void rtw8821c_coex_cfg_gnt_debug(struct rtw_dev *rtwdev) 773 + { 774 + rtw_write32_clr(rtwdev, REG_PAD_CTRL1, BIT_BTGP_SPI_EN); 775 + rtw_write32_clr(rtwdev, REG_PAD_CTRL1, BIT_BTGP_JTAG_EN); 776 + rtw_write32_clr(rtwdev, REG_GPIO_MUXCFG, BIT_FSPI_EN); 777 + rtw_write32_clr(rtwdev, REG_PAD_CTRL1, BIT_LED1DIS); 778 + rtw_write32_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT_SDIO_INT); 779 + rtw_write32_clr(rtwdev, REG_SYS_SDIO_CTRL, BIT_DBG_GNT_WL_BT); 780 + } 781 + 782 + static void rtw8821c_coex_cfg_rfe_type(struct rtw_dev *rtwdev) 783 + { 784 + struct rtw_coex *coex = &rtwdev->coex; 785 + struct rtw_coex_rfe *coex_rfe = &coex->rfe; 786 + struct rtw_efuse *efuse = &rtwdev->efuse; 787 + 788 + coex_rfe->rfe_module_type = efuse->rfe_option; 789 + coex_rfe->ant_switch_polarity = 0; 790 + coex_rfe->ant_switch_exist = true; 791 + coex_rfe->wlg_at_btg = false; 792 + 793 + switch (coex_rfe->rfe_module_type) { 794 + case 0: 795 + case 8: 796 + case 1: 797 + case 9: /* 1-Ant, Main, WLG */ 798 + default: /* 2-Ant, DPDT, WLG */ 799 + break; 800 + case 2: 801 + case 10: /* 1-Ant, Main, BTG */ 802 + case 7: 803 + case 15: /* 2-Ant, DPDT, BTG */ 804 + coex_rfe->wlg_at_btg = true; 805 + break; 806 + case 3: 807 + case 11: /* 1-Ant, Aux, WLG */ 808 + coex_rfe->ant_switch_polarity = 1; 809 + break; 810 + case 4: 811 + case 12: /* 1-Ant, Aux, BTG */ 812 + coex_rfe->wlg_at_btg = true; 813 + coex_rfe->ant_switch_polarity = 1; 814 + break; 815 + case 5: 816 + case 13: /* 2-Ant, no switch, WLG */ 817 + case 6: 818 + case 14: /* 2-Ant, no antenna switch, WLG */ 819 + coex_rfe->ant_switch_exist = false; 820 + break; 821 + } 822 + } 823 + 824 + static void rtw8821c_coex_cfg_wl_tx_power(struct rtw_dev *rtwdev, u8 wl_pwr) 825 + { 826 + struct rtw_coex *coex = &rtwdev->coex; 827 + struct rtw_coex_dm *coex_dm = &coex->dm; 828 + struct rtw_efuse *efuse = &rtwdev->efuse; 829 + bool share_ant = efuse->share_ant; 830 + 831 + if (share_ant) 832 + return; 833 + 834 + if (wl_pwr == coex_dm->cur_wl_pwr_lvl) 835 + return; 836 + 837 + coex_dm->cur_wl_pwr_lvl = wl_pwr; 838 + } 839 + 840 + static void rtw8821c_coex_cfg_wl_rx_gain(struct rtw_dev *rtwdev, bool low_gain) 841 + {} 842 + 652 843 static void 653 844 rtw8821c_txagc_swing_offset(struct rtw_dev *rtwdev, u8 pwr_idx_offset, 654 845 s8 pwr_idx_offset_lower, ··· 1484 1293 .config_bfee = rtw8821c_bf_config_bfee, 1485 1294 .set_gid_table = rtw_bf_set_gid_table, 1486 1295 .cfg_csi_rate = rtw_bf_cfg_csi_rate, 1296 + 1297 + .coex_set_init = rtw8821c_coex_cfg_init, 1298 + .coex_set_ant_switch = rtw8821c_coex_cfg_ant_switch, 1299 + .coex_set_gnt_fix = rtw8821c_coex_cfg_gnt_fix, 1300 + .coex_set_gnt_debug = rtw8821c_coex_cfg_gnt_debug, 1301 + .coex_set_rfe_type = rtw8821c_coex_cfg_rfe_type, 1302 + .coex_set_wl_tx_power = rtw8821c_coex_cfg_wl_tx_power, 1303 + .coex_set_wl_rx_gain = rtw8821c_coex_cfg_wl_rx_gain, 1487 1304 }; 1305 + 1306 + /* rssi in percentage % (dbm = % - 100) */ 1307 + static const u8 wl_rssi_step_8821c[] = {101, 45, 101, 40}; 1308 + static const u8 bt_rssi_step_8821c[] = {101, 101, 101, 101}; 1309 + 1310 + /* Shared-Antenna Coex Table */ 1311 + static const struct coex_table_para table_sant_8821c[] = { 1312 + {0x55555555, 0x55555555}, /* case-0 */ 1313 + {0x55555555, 0x55555555}, 1314 + {0x66555555, 0x66555555}, 1315 + {0xaaaaaaaa, 0xaaaaaaaa}, 1316 + {0x5a5a5a5a, 0x5a5a5a5a}, 1317 + {0xfafafafa, 0xfafafafa}, /* case-5 */ 1318 + {0x6a5a5555, 0xaaaaaaaa}, 1319 + {0x6a5a56aa, 0x6a5a56aa}, 1320 + {0x6a5a5a5a, 0x6a5a5a5a}, 1321 + {0x66555555, 0x5a5a5a5a}, 1322 + {0x66555555, 0x6a5a5a5a}, /* case-10 */ 1323 + {0x66555555, 0xaaaaaaaa}, 1324 + {0x66555555, 0x6a5a5aaa}, 1325 + {0x66555555, 0x6aaa6aaa}, 1326 + {0x66555555, 0x6a5a5aaa}, 1327 + {0x66555555, 0xaaaaaaaa}, /* case-15 */ 1328 + {0xffff55ff, 0xfafafafa}, 1329 + {0xffff55ff, 0x6afa5afa}, 1330 + {0xaaffffaa, 0xfafafafa}, 1331 + {0xaa5555aa, 0x5a5a5a5a}, 1332 + {0xaa5555aa, 0x6a5a5a5a}, /* case-20 */ 1333 + {0xaa5555aa, 0xaaaaaaaa}, 1334 + {0xffffffff, 0x55555555}, 1335 + {0xffffffff, 0x5a5a5a5a}, 1336 + {0xffffffff, 0x5a5a5a5a}, 1337 + {0xffffffff, 0x5a5a5aaa}, /* case-25 */ 1338 + {0x55555555, 0x5a5a5a5a}, 1339 + {0x55555555, 0xaaaaaaaa}, 1340 + {0x66555555, 0x6a5a6a5a}, 1341 + {0x66556655, 0x66556655}, 1342 + {0x66556aaa, 0x6a5a6aaa}, /* case-30 */ 1343 + {0xffffffff, 0x5aaa5aaa}, 1344 + {0x56555555, 0x5a5a5aaa} 1345 + }; 1346 + 1347 + /* Non-Shared-Antenna Coex Table */ 1348 + static const struct coex_table_para table_nsant_8821c[] = { 1349 + {0xffffffff, 0xffffffff}, /* case-100 */ 1350 + {0xffff55ff, 0xfafafafa}, 1351 + {0x66555555, 0x66555555}, 1352 + {0xaaaaaaaa, 0xaaaaaaaa}, 1353 + {0x5a5a5a5a, 0x5a5a5a5a}, 1354 + {0xffffffff, 0xffffffff}, /* case-105 */ 1355 + {0x5afa5afa, 0x5afa5afa}, 1356 + {0x55555555, 0xfafafafa}, 1357 + {0x66555555, 0xfafafafa}, 1358 + {0x66555555, 0x5a5a5a5a}, 1359 + {0x66555555, 0x6a5a5a5a}, /* case-110 */ 1360 + {0x66555555, 0xaaaaaaaa}, 1361 + {0xffff55ff, 0xfafafafa}, 1362 + {0xffff55ff, 0x5afa5afa}, 1363 + {0xffff55ff, 0xaaaaaaaa}, 1364 + {0xffff55ff, 0xffff55ff}, /* case-115 */ 1365 + {0xaaffffaa, 0x5afa5afa}, 1366 + {0xaaffffaa, 0xaaaaaaaa}, 1367 + {0xffffffff, 0xfafafafa}, 1368 + {0xffff55ff, 0xfafafafa}, 1369 + {0xffffffff, 0xaaaaaaaa}, /* case-120 */ 1370 + {0xffff55ff, 0x5afa5afa}, 1371 + {0xffff55ff, 0x5afa5afa}, 1372 + {0x55ff55ff, 0x55ff55ff} 1373 + }; 1374 + 1375 + /* Shared-Antenna TDMA */ 1376 + static const struct coex_tdma_para tdma_sant_8821c[] = { 1377 + { {0x00, 0x00, 0x00, 0x00, 0x00} }, /* case-0 */ 1378 + { {0x61, 0x45, 0x03, 0x11, 0x11} }, /* case-1 */ 1379 + { {0x61, 0x3a, 0x03, 0x11, 0x11} }, 1380 + { {0x61, 0x35, 0x03, 0x11, 0x11} }, 1381 + { {0x61, 0x20, 0x03, 0x11, 0x11} }, 1382 + { {0x61, 0x3a, 0x03, 0x11, 0x11} }, /* case-5 */ 1383 + { {0x61, 0x45, 0x03, 0x11, 0x10} }, 1384 + { {0x61, 0x35, 0x03, 0x11, 0x10} }, 1385 + { {0x61, 0x30, 0x03, 0x11, 0x10} }, 1386 + { {0x61, 0x20, 0x03, 0x11, 0x10} }, 1387 + { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-10 */ 1388 + { {0x61, 0x08, 0x03, 0x11, 0x15} }, 1389 + { {0x61, 0x08, 0x03, 0x10, 0x14} }, 1390 + { {0x51, 0x08, 0x03, 0x10, 0x54} }, 1391 + { {0x51, 0x08, 0x03, 0x10, 0x55} }, 1392 + { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-15 */ 1393 + { {0x51, 0x45, 0x03, 0x10, 0x50} }, 1394 + { {0x51, 0x3a, 0x03, 0x11, 0x50} }, 1395 + { {0x51, 0x30, 0x03, 0x10, 0x50} }, 1396 + { {0x51, 0x21, 0x03, 0x10, 0x50} }, 1397 + { {0x51, 0x10, 0x03, 0x10, 0x50} }, /* case-20 */ 1398 + { {0x51, 0x4a, 0x03, 0x10, 0x50} }, 1399 + { {0x51, 0x08, 0x03, 0x30, 0x54} }, 1400 + { {0x55, 0x08, 0x03, 0x10, 0x54} }, 1401 + { {0x65, 0x10, 0x03, 0x11, 0x10} }, 1402 + { {0x51, 0x10, 0x03, 0x10, 0x51} }, /* case-25 */ 1403 + { {0x51, 0x21, 0x03, 0x10, 0x50} }, 1404 + { {0x61, 0x08, 0x03, 0x11, 0x11} } 1405 + }; 1406 + 1407 + /* Non-Shared-Antenna TDMA */ 1408 + static const struct coex_tdma_para tdma_nsant_8821c[] = { 1409 + { {0x00, 0x00, 0x00, 0x40, 0x00} }, /* case-100 */ 1410 + { {0x61, 0x45, 0x03, 0x11, 0x11} }, 1411 + { {0x61, 0x25, 0x03, 0x11, 0x11} }, 1412 + { {0x61, 0x35, 0x03, 0x11, 0x11} }, 1413 + { {0x61, 0x20, 0x03, 0x11, 0x11} }, 1414 + { {0x61, 0x10, 0x03, 0x11, 0x11} }, /* case-105 */ 1415 + { {0x61, 0x45, 0x03, 0x11, 0x10} }, 1416 + { {0x61, 0x30, 0x03, 0x11, 0x10} }, 1417 + { {0x61, 0x30, 0x03, 0x11, 0x10} }, 1418 + { {0x61, 0x20, 0x03, 0x11, 0x10} }, 1419 + { {0x61, 0x10, 0x03, 0x11, 0x10} }, /* case-110 */ 1420 + { {0x61, 0x10, 0x03, 0x11, 0x11} }, 1421 + { {0x61, 0x08, 0x03, 0x10, 0x14} }, 1422 + { {0x51, 0x08, 0x03, 0x10, 0x54} }, 1423 + { {0x51, 0x08, 0x03, 0x10, 0x55} }, 1424 + { {0x51, 0x08, 0x07, 0x10, 0x54} }, /* case-115 */ 1425 + { {0x51, 0x45, 0x03, 0x10, 0x50} }, 1426 + { {0x51, 0x3a, 0x03, 0x10, 0x50} }, 1427 + { {0x51, 0x30, 0x03, 0x10, 0x50} }, 1428 + { {0x51, 0x21, 0x03, 0x10, 0x50} }, 1429 + { {0x51, 0x21, 0x03, 0x10, 0x50} }, /* case-120 */ 1430 + { {0x51, 0x10, 0x03, 0x10, 0x50} } 1431 + }; 1432 + 1433 + static const struct coex_5g_afh_map afh_5g_8821c[] = { {0, 0, 0} }; 1434 + 1435 + /* wl_tx_dec_power, bt_tx_dec_power, wl_rx_gain, bt_rx_lna_constrain */ 1436 + static const struct coex_rf_para rf_para_tx_8821c[] = { 1437 + {0, 0, false, 7}, /* for normal */ 1438 + {0, 20, false, 7}, /* for WL-CPT */ 1439 + {8, 17, true, 4}, 1440 + {7, 18, true, 4}, 1441 + {6, 19, true, 4}, 1442 + {5, 20, true, 4} 1443 + }; 1444 + 1445 + static const struct coex_rf_para rf_para_rx_8821c[] = { 1446 + {0, 0, false, 7}, /* for normal */ 1447 + {0, 20, false, 7}, /* for WL-CPT */ 1448 + {3, 24, true, 5}, 1449 + {2, 26, true, 5}, 1450 + {1, 27, true, 5}, 1451 + {0, 28, true, 5} 1452 + }; 1453 + 1454 + static_assert(ARRAY_SIZE(rf_para_tx_8821c) == ARRAY_SIZE(rf_para_rx_8821c)); 1488 1455 1489 1456 static const u8 rtw8821c_pwrtrk_5gb_n[][RTW_PWR_TRK_TBL_SZ] = { 1490 1457 {0, 1, 1, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 8, 8, 9, 9, 9, 10, 10, ··· 1743 1394 .pwrtrk_2g_ccka_p = rtw8821c_pwrtrk_2g_cck_a_p, 1744 1395 }; 1745 1396 1397 + static const struct rtw_reg_domain coex_info_hw_regs_8821c[] = { 1398 + {0xCB0, MASKDWORD, RTW_REG_DOMAIN_MAC32}, 1399 + {0xCB4, MASKDWORD, RTW_REG_DOMAIN_MAC32}, 1400 + {0xCBA, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, 1401 + {0, 0, RTW_REG_DOMAIN_NL}, 1402 + {0x430, MASKDWORD, RTW_REG_DOMAIN_MAC32}, 1403 + {0x434, MASKDWORD, RTW_REG_DOMAIN_MAC32}, 1404 + {0x42a, MASKLWORD, RTW_REG_DOMAIN_MAC16}, 1405 + {0x426, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, 1406 + {0x45e, BIT(3), RTW_REG_DOMAIN_MAC8}, 1407 + {0x454, MASKLWORD, RTW_REG_DOMAIN_MAC16}, 1408 + {0, 0, RTW_REG_DOMAIN_NL}, 1409 + {0x4c, BIT(24) | BIT(23), RTW_REG_DOMAIN_MAC32}, 1410 + {0x64, BIT(0), RTW_REG_DOMAIN_MAC8}, 1411 + {0x4c6, BIT(4), RTW_REG_DOMAIN_MAC8}, 1412 + {0x40, BIT(5), RTW_REG_DOMAIN_MAC8}, 1413 + {0x1, RFREG_MASK, RTW_REG_DOMAIN_RF_A}, 1414 + {0, 0, RTW_REG_DOMAIN_NL}, 1415 + {0x550, MASKDWORD, RTW_REG_DOMAIN_MAC32}, 1416 + {0x522, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, 1417 + {0x953, BIT(1), RTW_REG_DOMAIN_MAC8}, 1418 + {0xc50, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, 1419 + {0x60A, MASKBYTE0, RTW_REG_DOMAIN_MAC8}, 1420 + }; 1421 + 1746 1422 struct rtw_chip_info rtw8821c_hw_spec = { 1747 1423 .ops = &rtw8821c_ops, 1748 1424 .id = RTW_CHIP_TYPE_8821C, ··· 1814 1440 .iqk_threshold = 8, 1815 1441 .bfer_su_max_num = 2, 1816 1442 .bfer_mu_max_num = 1, 1443 + 1444 + .coex_para_ver = 0x19092746, 1445 + .bt_desired_ver = 0x46, 1446 + .scbd_support = true, 1447 + .new_scbd10_def = false, 1448 + .pstdma_type = COEX_PSTDMA_FORCE_LPSOFF, 1449 + .bt_rssi_type = COEX_BTRSSI_RATIO, 1450 + .ant_isolation = 15, 1451 + .rssi_tolerance = 2, 1452 + .wl_rssi_step = wl_rssi_step_8821c, 1453 + .bt_rssi_step = bt_rssi_step_8821c, 1454 + .table_sant_num = ARRAY_SIZE(table_sant_8821c), 1455 + .table_sant = table_sant_8821c, 1456 + .table_nsant_num = ARRAY_SIZE(table_nsant_8821c), 1457 + .table_nsant = table_nsant_8821c, 1458 + .tdma_sant_num = ARRAY_SIZE(tdma_sant_8821c), 1459 + .tdma_sant = tdma_sant_8821c, 1460 + .tdma_nsant_num = ARRAY_SIZE(tdma_nsant_8821c), 1461 + .tdma_nsant = tdma_nsant_8821c, 1462 + .wl_rf_para_num = ARRAY_SIZE(rf_para_tx_8821c), 1463 + .wl_rf_para_tx = rf_para_tx_8821c, 1464 + .wl_rf_para_rx = rf_para_rx_8821c, 1465 + .bt_afh_span_bw20 = 0x24, 1466 + .bt_afh_span_bw40 = 0x36, 1467 + .afh_5g_num = ARRAY_SIZE(afh_5g_8821c), 1468 + .afh_5g = afh_5g_8821c, 1469 + 1470 + .coex_info_hw_regs_num = ARRAY_SIZE(coex_info_hw_regs_8821c), 1471 + .coex_info_hw_regs = coex_info_hw_regs_8821c, 1817 1472 }; 1818 1473 EXPORT_SYMBOL(rtw8821c_hw_spec); 1819 1474
+26
drivers/net/wireless/realtek/rtw88/rtw8821c.h
··· 160 160 le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(11, 8)) 161 161 #define GET_PHY_STAT_P1_HT_RXSC(phy_stat) \ 162 162 le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(15, 12)) 163 + #define GET_PHY_STAT_P1_RXEVM_A(phy_stat) \ 164 + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0)) 165 + #define GET_PHY_STAT_P1_RXEVM_B(phy_stat) \ 166 + le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(15, 8)) 167 + #define GET_PHY_STAT_P1_CFO_TAIL_A(phy_stat) \ 168 + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(7, 0)) 169 + #define GET_PHY_STAT_P1_CFO_TAIL_B(phy_stat) \ 170 + le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(15, 8)) 171 + #define GET_PHY_STAT_P1_RXSNR_A(phy_stat) \ 172 + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(7, 0)) 173 + #define GET_PHY_STAT_P1_RXSNR_B(phy_stat) \ 174 + le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(15, 8)) 163 175 164 176 #define REG_INIRTS_RATE_SEL 0x0480 165 177 #define REG_HTSTFWT 0x800 ··· 229 217 #define REG_CCA_CCK 0xfcc 230 218 #define REG_ANTWT 0x1904 231 219 #define REG_IQKFAILMSK 0x1bf0 220 + #define BIT_MASK_R_RFE_SEL_15 GENMASK(31, 28) 221 + #define BIT_SDIO_INT BIT(18) 222 + #define SAMPLE_RATE_MASK GENMASK(5, 0) 223 + #define SAMPLE_RATE 0x5 224 + #define BT_CNT_ENABLE 0x1 225 + #define BIT_BCN_QUEUE BIT(3) 226 + #define BCN_PRI_EN 0x1 227 + #define PTA_CTRL_PIN 0x66 228 + #define DPDT_CTRL_PIN 0x77 229 + #define ANTDIC_CTRL_PIN 0x88 230 + #define REG_CTRL_TYPE 0x67 231 + #define BIT_CTRL_TYPE1 BIT(5) 232 + #define BIT_CTRL_TYPE2 BIT(4) 233 + #define CTRL_TYPE_MASK GENMASK(15, 8) 232 234 233 235 #define RF18_BAND_MASK (BIT(16) | BIT(9) | BIT(8)) 234 236 #define RF18_BAND_2G (0)