@@ -524,81 +524,26 @@ static void rtw8822c_set_channel(struct rtw_dev *rtwdev, u8 channel, u8 bw,
rtw8822c_toggle_igi(rtwdev);
}
-static void rtw8822c_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
- u8 rx_path, bool is_tx2_path)
+static void rtw8822c_config_cck_rx_path(struct rtw_dev *rtwdev, u8 rx_path)
{
- if ((tx_path | rx_path) & BB_PATH_A)
- rtw_write32_mask(rtwdev, REG_ORITXCODE, MASK20BITS, 0x33312);
- else
- rtw_write32_mask(rtwdev, REG_ORITXCODE, MASK20BITS, 0x11111);
- if ((tx_path | rx_path) & BB_PATH_B)
- rtw_write32_mask(rtwdev, REG_ORITXCODE2, MASK20BITS, 0x33312);
- else
- rtw_write32_mask(rtwdev, REG_ORITXCODE2, MASK20BITS, 0x11111);
-
- rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x8);
- rtw_write32_mask(rtwdev, REG_CCKPATH, BIT(30), 0x1);
-
- if (tx_path == BB_PATH_A)
- rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x8);
- else if (tx_path == BB_PATH_B)
- rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x4);
- else if (tx_path == BB_PATH_AB)
- rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0xc);
-
- rtw_write32_mask(rtwdev, REG_TXANTSEG, 0xf, tx_path);
- rtw_write32_mask(rtwdev, REG_ENFN, BIT(16), 0x0);
- rtw_write32_mask(rtwdev, REG_ENFN, BIT(31), 0x1);
-
- if (tx_path == BB_PATH_A) {
- rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xf, 0x1);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0x3, 0x0);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xc, 0x0);
- } else if (tx_path == BB_PATH_B) {
- rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xf, 0x2);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0x3, 0x0);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xc, 0x0);
- } else if (tx_path == BB_PATH_AB) {
- rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xf, 0x3);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0x3, 0x0);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xc, 0x1);
- }
-
- if (tx_path == BB_PATH_A || tx_path == BB_PATH_B) {
- rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xf0, 0x1);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0x300, 0x0);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xc00, 0x0);
- } else if (tx_path == BB_PATH_AB) {
- rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xf0, 0x3);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0x300, 0x0);
- rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xc00, 0x1);
- }
- rtw_write32_mask(rtwdev, REG_TXANT, 0xf, tx_path);
-
if (rx_path == BB_PATH_A || rx_path == BB_PATH_B) {
+ rtw_write32_mask(rtwdev, REG_CCANRX, 0x00060000, 0x0);
rtw_write32_mask(rtwdev, REG_CCANRX, 0x00600000, 0x0);
} else if (rx_path == BB_PATH_AB) {
rtw_write32_mask(rtwdev, REG_CCANRX, 0x00600000, 0x1);
rtw_write32_mask(rtwdev, REG_CCANRX, 0x00060000, 0x1);
}
- rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0x0f000000, 0x0);
-
if (rx_path == BB_PATH_A)
rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0x0f000000, 0x0);
else if (rx_path == BB_PATH_B)
rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0x0f000000, 0x5);
else if (rx_path == BB_PATH_AB)
rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0x0f000000, 0x1);
+}
- rtw_write32_mask(rtwdev, REG_ANTMAP, MASKBYTE3LOWNIBBLE, rx_path);
- rtw_write32_mask(rtwdev, REG_ANTMAP, 0x000F0000, rx_path);
-
- if (!(rx_path & BB_PATH_A))
- rtw_write_rf(rtwdev, 0, 0, 0xf0000, 0x1);
- if (!(rx_path & BB_PATH_B))
- rtw_write_rf(rtwdev, 1, 0, 0xf0000, 0x1);
-
+static void rtw8822c_config_ofdm_rx_path(struct rtw_dev *rtwdev, u8 rx_path)
+{
if (rx_path == BB_PATH_A || rx_path == BB_PATH_B) {
rtw_write32_mask(rtwdev, REG_RXFNCTL, 0x300, 0x0);
rtw_write32_mask(rtwdev, REG_RXFNCTL, 0x600000, 0x0);
@@ -613,6 +558,73 @@ static void rtw8822c_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
rtw_write32_mask(rtwdev, REG_MRCM, BIT(24), 0x1);
}
+ rtw_write32_mask(rtwdev, 0x824, 0x0f000000, rx_path);
+ rtw_write32_mask(rtwdev, 0x824, 0x000f0000, rx_path);
+}
+
+static void rtw8822c_config_rx_path(struct rtw_dev *rtwdev, u8 rx_path)
+{
+ rtw8822c_config_cck_rx_path(rtwdev, rx_path);
+ rtw8822c_config_ofdm_rx_path(rtwdev, rx_path);
+}
+
+static void rtw8822c_config_cck_tx_path(struct rtw_dev *rtwdev, u8 tx_path,
+ bool is_tx2_path)
+{
+ if (tx_path == BB_PATH_A) {
+ rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x8);
+ } else if (tx_path == BB_PATH_B) {
+ rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x4);
+ } else {
+ if (is_tx2_path)
+ rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0xc);
+ else
+ rtw_write32_mask(rtwdev, REG_RXCCKSEL, 0xf0000000, 0x8);
+ }
+}
+
+static void rtw8822c_config_ofdm_tx_path(struct rtw_dev *rtwdev, u8 tx_path,
+ bool is_tx2_path)
+{
+ if (tx_path == BB_PATH_A) {
+ rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xff, 0x11);
+ rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xff, 0x0);
+ } else if (tx_path == BB_PATH_B) {
+ rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xff, 0x12);
+ rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xff, 0x0);
+ } else {
+ if (is_tx2_path) {
+ rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xff, 0x33);
+ rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xffff, 0x0404);
+ } else {
+ rtw_write32_mask(rtwdev, REG_ANTMAP0, 0xff, 0x31);
+ rtw_write32_mask(rtwdev, REG_TXLGMAP, 0xffff, 0x0400);
+ }
+ }
+}
+
+static void rtw8822c_config_tx_path(struct rtw_dev *rtwdev, u8 tx_path,
+ bool is_tx2_path)
+{
+ rtw8822c_config_cck_tx_path(rtwdev, tx_path, is_tx2_path);
+ rtw8822c_config_ofdm_tx_path(rtwdev, tx_path, is_tx2_path);
+}
+
+static void rtw8822c_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
+ u8 rx_path, bool is_tx2_path)
+{
+ if ((tx_path | rx_path) & BB_PATH_A)
+ rtw_write32_mask(rtwdev, REG_ORITXCODE, MASK20BITS, 0x33312);
+ else
+ rtw_write32_mask(rtwdev, REG_ORITXCODE, MASK20BITS, 0x11111);
+ if ((tx_path | rx_path) & BB_PATH_B)
+ rtw_write32_mask(rtwdev, REG_ORITXCODE2, MASK20BITS, 0x33312);
+ else
+ rtw_write32_mask(rtwdev, REG_ORITXCODE2, MASK20BITS, 0x11111);
+
+ rtw8822c_config_rx_path(rtwdev, rx_path);
+ rtw8822c_config_tx_path(rtwdev, tx_path, is_tx2_path);
+
rtw8822c_toggle_igi(rtwdev);
}