Skip to content

Commit

Permalink
wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
Browse files Browse the repository at this point in the history
commit 09d4d6d upstream.

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.

Tested-by: Anson Tsao <anson.tsao@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
superm1 authored and gregkh committed May 11, 2023
1 parent a83b81b commit 5bcc0ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7921/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
struct mt76_dev *mdev;
u8 features;
int ret;
u16 cmd;

ret = pcim_enable_device(pdev);
if (ret)
Expand All @@ -272,6 +273,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);
Expand Down

0 comments on commit 5bcc0ff

Please sign in to comment.