18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: ISC 28c2ecf20Sopenharmony_ci/* Copyright (C) 2019 MediaTek Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Author: Ryder Lee <ryder.lee@mediatek.com> 58c2ecf20Sopenharmony_ci * Roy Luo <royluo@google.com> 68c2ecf20Sopenharmony_ci * Lorenzo Bianconi <lorenzo@kernel.org> 78c2ecf20Sopenharmony_ci * Felix Fietkau <nbd@nbd.name> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include "mt7615.h" 118c2ecf20Sopenharmony_ci#include "../dma.h" 128c2ecf20Sopenharmony_ci#include "mac.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic int 158c2ecf20Sopenharmony_cimt7615_init_tx_queue(struct mt7615_dev *dev, int qid, int idx, int n_desc) 168c2ecf20Sopenharmony_ci{ 178c2ecf20Sopenharmony_ci struct mt76_queue *hwq; 188c2ecf20Sopenharmony_ci int err; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci hwq = devm_kzalloc(dev->mt76.dev, sizeof(*hwq), GFP_KERNEL); 218c2ecf20Sopenharmony_ci if (!hwq) 228c2ecf20Sopenharmony_ci return -ENOMEM; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci err = mt76_queue_alloc(dev, hwq, idx, n_desc, 0, MT_TX_RING_BASE); 258c2ecf20Sopenharmony_ci if (err < 0) 268c2ecf20Sopenharmony_ci return err; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci dev->mt76.q_tx[qid] = hwq; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci return 0; 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic int 348c2ecf20Sopenharmony_cimt7622_init_tx_queues_multi(struct mt7615_dev *dev) 358c2ecf20Sopenharmony_ci{ 368c2ecf20Sopenharmony_ci static const u8 wmm_queue_map[] = { 378c2ecf20Sopenharmony_ci [IEEE80211_AC_BK] = MT7622_TXQ_AC0, 388c2ecf20Sopenharmony_ci [IEEE80211_AC_BE] = MT7622_TXQ_AC1, 398c2ecf20Sopenharmony_ci [IEEE80211_AC_VI] = MT7622_TXQ_AC2, 408c2ecf20Sopenharmony_ci [IEEE80211_AC_VO] = MT7622_TXQ_AC3, 418c2ecf20Sopenharmony_ci }; 428c2ecf20Sopenharmony_ci int ret; 438c2ecf20Sopenharmony_ci int i; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(wmm_queue_map); i++) { 468c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, i, wmm_queue_map[i], 478c2ecf20Sopenharmony_ci MT7615_TX_RING_SIZE / 2); 488c2ecf20Sopenharmony_ci if (ret) 498c2ecf20Sopenharmony_ci return ret; 508c2ecf20Sopenharmony_ci } 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, MT_TXQ_PSD, 538c2ecf20Sopenharmony_ci MT7622_TXQ_MGMT, MT7615_TX_MGMT_RING_SIZE); 548c2ecf20Sopenharmony_ci if (ret) 558c2ecf20Sopenharmony_ci return ret; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU, 588c2ecf20Sopenharmony_ci MT7622_TXQ_MCU, MT7615_TX_MCU_RING_SIZE); 598c2ecf20Sopenharmony_ci return ret; 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistatic int 638c2ecf20Sopenharmony_cimt7615_init_tx_queues(struct mt7615_dev *dev) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci int ret, i; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, MT_TXQ_FWDL, 688c2ecf20Sopenharmony_ci MT7615_TXQ_FWDL, 698c2ecf20Sopenharmony_ci MT7615_TX_FWDL_RING_SIZE); 708c2ecf20Sopenharmony_ci if (ret) 718c2ecf20Sopenharmony_ci return ret; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci if (!is_mt7615(&dev->mt76)) 748c2ecf20Sopenharmony_ci return mt7622_init_tx_queues_multi(dev); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, 0, 0, MT7615_TX_RING_SIZE); 778c2ecf20Sopenharmony_ci if (ret) 788c2ecf20Sopenharmony_ci return ret; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci for (i = 1; i < MT_TXQ_MCU; i++) 818c2ecf20Sopenharmony_ci dev->mt76.q_tx[i] = dev->mt76.q_tx[0]; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queue(dev, MT_TXQ_MCU, MT7615_TXQ_MCU, 848c2ecf20Sopenharmony_ci MT7615_TX_MCU_RING_SIZE); 858c2ecf20Sopenharmony_ci return 0; 868c2ecf20Sopenharmony_ci} 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistatic int mt7615_poll_tx(struct napi_struct *napi, int budget) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci struct mt7615_dev *dev; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci dev = container_of(napi, struct mt7615_dev, mt76.tx_napi); 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci mt76_queue_tx_cleanup(dev, MT_TXQ_MCU, false); 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci if (napi_complete_done(napi, 0)) 978c2ecf20Sopenharmony_ci mt7615_irq_enable(dev, mt7615_tx_mcu_int_mask(dev)); 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci return 0; 1008c2ecf20Sopenharmony_ci} 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ciint mt7615_wait_pdma_busy(struct mt7615_dev *dev) 1038c2ecf20Sopenharmony_ci{ 1048c2ecf20Sopenharmony_ci struct mt76_dev *mdev = &dev->mt76; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci if (!is_mt7663(mdev)) { 1078c2ecf20Sopenharmony_ci u32 mask = MT_PDMA_TX_BUSY | MT_PDMA_RX_BUSY; 1088c2ecf20Sopenharmony_ci u32 reg = mt7615_reg_map(dev, MT_PDMA_BUSY); 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci if (!mt76_poll_msec(dev, reg, mask, 0, 1000)) { 1118c2ecf20Sopenharmony_ci dev_err(mdev->dev, "PDMA engine busy\n"); 1128c2ecf20Sopenharmony_ci return -EIO; 1138c2ecf20Sopenharmony_ci } 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci return 0; 1168c2ecf20Sopenharmony_ci } 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci if (!mt76_poll_msec(dev, MT_PDMA_BUSY_STATUS, 1198c2ecf20Sopenharmony_ci MT_PDMA_TX_IDX_BUSY, 0, 1000)) { 1208c2ecf20Sopenharmony_ci dev_err(mdev->dev, "PDMA engine tx busy\n"); 1218c2ecf20Sopenharmony_ci return -EIO; 1228c2ecf20Sopenharmony_ci } 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci if (!mt76_poll_msec(dev, MT_PSE_PG_INFO, 1258c2ecf20Sopenharmony_ci MT_PSE_SRC_CNT, 0, 1000)) { 1268c2ecf20Sopenharmony_ci dev_err(mdev->dev, "PSE engine busy\n"); 1278c2ecf20Sopenharmony_ci return -EIO; 1288c2ecf20Sopenharmony_ci } 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci if (!mt76_poll_msec(dev, MT_PDMA_BUSY_STATUS, 1318c2ecf20Sopenharmony_ci MT_PDMA_BUSY_IDX, 0, 1000)) { 1328c2ecf20Sopenharmony_ci dev_err(mdev->dev, "PDMA engine busy\n"); 1338c2ecf20Sopenharmony_ci return -EIO; 1348c2ecf20Sopenharmony_ci } 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci return 0; 1378c2ecf20Sopenharmony_ci} 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_cistatic void mt7622_dma_sched_init(struct mt7615_dev *dev) 1408c2ecf20Sopenharmony_ci{ 1418c2ecf20Sopenharmony_ci u32 reg = mt7615_reg_map(dev, MT_DMASHDL_BASE); 1428c2ecf20Sopenharmony_ci int i; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci mt76_rmw(dev, reg + MT_DMASHDL_PKT_MAX_SIZE, 1458c2ecf20Sopenharmony_ci MT_DMASHDL_PKT_MAX_SIZE_PLE | MT_DMASHDL_PKT_MAX_SIZE_PSE, 1468c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PLE, 1) | 1478c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PSE, 8)); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci for (i = 0; i <= 5; i++) 1508c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_GROUP_QUOTA(i), 1518c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x10) | 1528c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x800)); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_Q_MAP(0), 0x42104210); 1558c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_Q_MAP(1), 0x42104210); 1568c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_Q_MAP(2), 0x5); 1578c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_Q_MAP(3), 0); 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_SCHED_SET0, 0x6012345f); 1608c2ecf20Sopenharmony_ci mt76_wr(dev, reg + MT_DMASHDL_SCHED_SET1, 0xedcba987); 1618c2ecf20Sopenharmony_ci} 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cistatic void mt7663_dma_sched_init(struct mt7615_dev *dev) 1648c2ecf20Sopenharmony_ci{ 1658c2ecf20Sopenharmony_ci int i; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci mt76_rmw(dev, MT_DMA_SHDL(MT_DMASHDL_PKT_MAX_SIZE), 1688c2ecf20Sopenharmony_ci MT_DMASHDL_PKT_MAX_SIZE_PLE | MT_DMASHDL_PKT_MAX_SIZE_PSE, 1698c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PLE, 1) | 1708c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PSE, 8)); 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci /* enable refill control group 0, 1, 2, 4, 5 */ 1738c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_REFILL), 0xffc80000); 1748c2ecf20Sopenharmony_ci /* enable group 0, 1, 2, 4, 5, 15 */ 1758c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_OPTIONAL), 0x70068037); 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci /* each group min quota must larger then PLE_PKT_MAX_SIZE_NUM */ 1788c2ecf20Sopenharmony_ci for (i = 0; i < 5; i++) 1798c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(i)), 1808c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x40) | 1818c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x800)); 1828c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(5)), 1838c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x40) | 1848c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x40)); 1858c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(15)), 1868c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x20) | 1878c2ecf20Sopenharmony_ci FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x20)); 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(0)), 0x42104210); 1908c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(1)), 0x42104210); 1918c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(2)), 0x00050005); 1928c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(3)), 0); 1938c2ecf20Sopenharmony_ci /* ALTX0 and ALTX1 QID mapping to group 5 */ 1948c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_SCHED_SET0), 0x6012345f); 1958c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_SCHED_SET1), 0xedcba987); 1968c2ecf20Sopenharmony_ci} 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ciint mt7615_dma_init(struct mt7615_dev *dev) 1998c2ecf20Sopenharmony_ci{ 2008c2ecf20Sopenharmony_ci int rx_ring_size = MT7615_RX_RING_SIZE; 2018c2ecf20Sopenharmony_ci int rx_buf_size = MT_RX_BUF_SIZE; 2028c2ecf20Sopenharmony_ci int ret; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci /* Increase buffer size to receive large VHT MPDUs */ 2058c2ecf20Sopenharmony_ci if (dev->mphy.cap.has_5ghz) 2068c2ecf20Sopenharmony_ci rx_buf_size *= 2; 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci mt76_dma_attach(&dev->mt76); 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_GLO_CFG, 2118c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE | 2128c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN | 2138c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_OMIT_TX_INFO); 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci mt76_rmw_field(dev, MT_WPDMA_GLO_CFG, 2168c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0, 0x1); 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci mt76_rmw_field(dev, MT_WPDMA_GLO_CFG, 2198c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT21, 0x1); 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci mt76_rmw_field(dev, MT_WPDMA_GLO_CFG, 2228c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_DMA_BURST_SIZE, 0x3); 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci mt76_rmw_field(dev, MT_WPDMA_GLO_CFG, 2258c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_MULTI_DMA_EN, 0x3); 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci if (is_mt7615(&dev->mt76)) { 2288c2ecf20Sopenharmony_ci mt76_set(dev, MT_WPDMA_GLO_CFG, 2298c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY); 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_GLO_CFG1, 0x1); 2328c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_TX_PRE_CFG, 0xf0000); 2338c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_RX_PRE_CFG, 0xf7f0000); 2348c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_ABT_CFG, 0x4000026); 2358c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_ABT_CFG1, 0x18811881); 2368c2ecf20Sopenharmony_ci mt76_set(dev, 0x7158, BIT(16)); 2378c2ecf20Sopenharmony_ci mt76_clear(dev, 0x7000, BIT(23)); 2388c2ecf20Sopenharmony_ci } 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci mt76_wr(dev, MT_WPDMA_RST_IDX, ~0); 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci ret = mt7615_init_tx_queues(dev); 2438c2ecf20Sopenharmony_ci if (ret) 2448c2ecf20Sopenharmony_ci return ret; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci /* init rx queues */ 2478c2ecf20Sopenharmony_ci ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU], 1, 2488c2ecf20Sopenharmony_ci MT7615_RX_MCU_RING_SIZE, rx_buf_size, 2498c2ecf20Sopenharmony_ci MT_RX_RING_BASE); 2508c2ecf20Sopenharmony_ci if (ret) 2518c2ecf20Sopenharmony_ci return ret; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci if (!is_mt7615(&dev->mt76)) 2548c2ecf20Sopenharmony_ci rx_ring_size /= 2; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN], 0, 2578c2ecf20Sopenharmony_ci rx_ring_size, rx_buf_size, MT_RX_RING_BASE); 2588c2ecf20Sopenharmony_ci if (ret) 2598c2ecf20Sopenharmony_ci return ret; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci mt76_wr(dev, MT_DELAY_INT_CFG, 0); 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci ret = mt76_init_queues(dev); 2648c2ecf20Sopenharmony_ci if (ret < 0) 2658c2ecf20Sopenharmony_ci return ret; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci netif_tx_napi_add(&dev->mt76.napi_dev, &dev->mt76.tx_napi, 2688c2ecf20Sopenharmony_ci mt7615_poll_tx, NAPI_POLL_WEIGHT); 2698c2ecf20Sopenharmony_ci napi_enable(&dev->mt76.tx_napi); 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci mt76_poll(dev, MT_WPDMA_GLO_CFG, 2728c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_DMA_BUSY | 2738c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_RX_DMA_BUSY, 0, 1000); 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci /* start dma engine */ 2768c2ecf20Sopenharmony_ci mt76_set(dev, MT_WPDMA_GLO_CFG, 2778c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_DMA_EN | 2788c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_RX_DMA_EN); 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci /* enable interrupts for TX/RX rings */ 2818c2ecf20Sopenharmony_ci mt7615_irq_enable(dev, MT_INT_RX_DONE_ALL | mt7615_tx_mcu_int_mask(dev) | 2828c2ecf20Sopenharmony_ci MT_INT_MCU_CMD); 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci if (is_mt7622(&dev->mt76)) 2858c2ecf20Sopenharmony_ci mt7622_dma_sched_init(dev); 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci if (is_mt7663(&dev->mt76)) 2888c2ecf20Sopenharmony_ci mt7663_dma_sched_init(dev); 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci return 0; 2918c2ecf20Sopenharmony_ci} 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_civoid mt7615_dma_cleanup(struct mt7615_dev *dev) 2948c2ecf20Sopenharmony_ci{ 2958c2ecf20Sopenharmony_ci mt76_clear(dev, MT_WPDMA_GLO_CFG, 2968c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_TX_DMA_EN | 2978c2ecf20Sopenharmony_ci MT_WPDMA_GLO_CFG_RX_DMA_EN); 2988c2ecf20Sopenharmony_ci mt76_set(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_SW_RESET); 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci mt76_dma_cleanup(&dev->mt76); 3018c2ecf20Sopenharmony_ci} 302