wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
PATCH 1/1 wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
When the BIOS has been configured for Fast Boot, systems with mt7921e have non-functional wifi. Turning on Fast boot caused both bus master enable and memory space enable bits in PCI_COMMAND not to get configured.
The mt7921 driver already sets bus master enable, but explicitly check and set memory access enable as well to fix this problem.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +6 -0
@@ -256,6 +256,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,struct mt7921_dev *dev;struct mt76_dev *mdev;int ret; +u16 cmd; ret =pcim_enable_device (pdev);if (ret)
@@ -265,6 +266,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev,if (ret)return ret; +pci_read_config_word (pdev,PCI_COMMAND , &cmd); +if (!(cmd &PCI_COMMAND_MEMORY )) { + cmd |=PCI_COMMAND_MEMORY ; +pci_write_config_word (pdev,PCI_COMMAND , cmd); + }pci_set_master (pdev); ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES );
Signature · 1 line
2.34.1
[Public]
Quoted 21 lines
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Friday, March 10, 2023 11:00
To: Matthias Brugger <[email protected]>
Cc: Limonciello, Mario <[email protected]>; Tsao, Anson <[email protected]>; Felix Fietkau <[email protected]>; Lorenzo Bianconi <[email protected]>; Ryder Lee <[email protected]>; Shayne Chen <[email protected]>; Sean Wang <[email protected]>; Kalle Valo <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH] wifi: mt76: mt7921e: Set memory space enable inPCI_COMMANDif unsetWhen the BIOS has been configured for Fast Boot, systems with mt7921e have non-functional wifi. Turning on Fast boot caused both bus master enable and memory space enable bits in
PCI_COMMANDnot to get configured.
Quoted 8 lines
The mt7921 driver already sets bus master enable, but explicitly check and set memory access enable as well to fix this problem.
Tested-by Anson Tsao <[email protected]>Signed-off-by Mario Limonciello <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++ 1 file changed, 6 insertions(+)
Hi Felix, Lorenzo, Ryder,
Any comments please?
Thanks,
Quoted 28 lines
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +6
-1@@ -256,6 +256,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,struct mt7921_dev *dev;struct mt76_dev *mdev;int ret; +u16 cmd; ret =pcim_enable_device (pdev);if (ret)@@ -265,6 +266,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev,if (ret)return ret; +pci_read_config_word (pdev,PCI_COMMAND , &cmd); +if (!(cmd &PCI_COMMAND_MEMORY )) { + cmd |=PCI_COMMAND_MEMORY ; +pci_write_config_word (pdev,PCI_COMMAND , cmd); + }pci_set_master (pdev); ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES ); --2.34.1