blob: fec02ea11ee5589e2324efb54c0d2b66c541205d [file] [log] [blame]
developerbd9fa1e2023-10-16 11:04:00 +08001From 39a1bb49d83141f79bf329fdd68e82bb77f5d0a2 Mon Sep 17 00:00:00 2001
2From: "sujuan.chen" <sujuan.chen@mediatek.com>
3Date: Thu, 20 Jul 2023 10:25:50 +0800
4Subject: [PATCH 75/98] wifi: mt76: mt7996: add dma mask limitation
5
6Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
7---
8 dma.c | 4 ++--
9 mmio.c | 3 ++-
10 mt7996/mmio.c | 8 --------
11 mt7996/pci.c | 2 +-
12 4 files changed, 5 insertions(+), 12 deletions(-)
13
14diff --git a/dma.c b/dma.c
15index 69e314a..7616921 100644
16--- a/dma.c
17+++ b/dma.c
18@@ -494,7 +494,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
19 } else {
20 struct mt76_queue_buf qbuf;
21
22- buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC);
23+ buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32);
24 if (!buf)
25 return NULL;
26
27@@ -713,7 +713,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
28 if (mt76_queue_is_wed_rro_ind(q))
29 goto done;
30
31- buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC);
32+ buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32);
33 if (!buf)
34 break;
35
36diff --git a/mmio.c b/mmio.c
37index f7495f6..22629af 100644
38--- a/mmio.c
39+++ b/mmio.c
40@@ -150,7 +150,8 @@ u32 mt76_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
41 if (!r)
42 goto unmap;
43
44- ptr = page_frag_alloc(&wed->rx_buf_ring.rx_page, length, GFP_ATOMIC);
45+ ptr = page_frag_alloc(&wed->rx_buf_ring.rx_page, length,
46+ GFP_ATOMIC | GFP_DMA32);
47 if (!ptr) {
48 mt76_put_rxwi(dev, r);
49 goto unmap;
50diff --git a/mt7996/mmio.c b/mt7996/mmio.c
51index 631d905..38b8843 100644
52--- a/mt7996/mmio.c
53+++ b/mt7996/mmio.c
54@@ -442,14 +442,6 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
55 *irq = wed->irq;
56 dev->mt76.dma_dev = wed->dev;
57
58- ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
59- if (ret)
60- return ret;
61-
62- ret = dma_set_coherent_mask(wed->dev, DMA_BIT_MASK(32));
63- if (ret)
64- return ret;
65-
66 return 1;
67 #else
68 return 0;
69diff --git a/mt7996/pci.c b/mt7996/pci.c
70index 2bb707d..0024929 100644
71--- a/mt7996/pci.c
72+++ b/mt7996/pci.c
73@@ -111,7 +111,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
74
75 pci_set_master(pdev);
76
77- ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
78+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
79 if (ret)
80 return ret;
81
82--
832.18.0
84