blob: 5ff3139a0db7c401c341f935cf191e3b2c0aec8f [file] [log] [blame]
From 655b23a24e07980cecd4f09e8779dfc9f69bff51 Mon Sep 17 00:00:00 2001
From: "sujuan.chen" <sujuan.chen@mediatek.com>
Date: Thu, 20 Jul 2023 10:25:50 +0800
Subject: [PATCH 2012/2012] wifi: mt76: mt7996: add dma mask limitation
Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
---
dma.c | 4 ++--
mt7996/mmio.c | 10 +---------
mt7996/pci.c | 2 +-
3 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/dma.c b/dma.c
index 7e3d0393b..81412deb1 100644
--- a/dma.c
+++ b/dma.c
@@ -495,7 +495,7 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
} else {
struct mt76_queue_buf qbuf;
- buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC);
+ buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32);
if (!buf)
return NULL;
@@ -714,7 +714,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
if (mt76_queue_is_rro_ind(q))
goto done;
- buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC);
+ buf = page_frag_alloc(&q->rx_page, q->buf_size, GFP_ATOMIC | GFP_DMA32);
if (!buf)
break;
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
index 940f94998..7a1d81447 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -286,7 +286,7 @@ static u32 mt7996_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
void *ptr;
ptr = page_frag_alloc(&wed->rx_buf_ring.rx_page, length,
- GFP_KERNEL);
+ GFP_ATOMIC | GFP_DMA32);
if (!ptr) {
mt76_put_rxwi(&dev->mt76, r);
goto unmap;
@@ -501,14 +501,6 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
dev->mt76.token_size = MT7996_SW_TOKEN_SIZE;
- ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
- if (ret)
- return ret;
-
- ret = dma_set_coherent_mask(wed->dev, DMA_BIT_MASK(32));
- if (ret)
- return ret;
-
return 1;
#else
return 0;
diff --git a/mt7996/pci.c b/mt7996/pci.c
index 9a134fcab..993e53817 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -107,7 +107,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
pci_set_master(pdev);
- ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
--
2.39.2