linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
@ 2023-03-10 17:00 Mario Limonciello
  2023-03-20 13:26 ` Limonciello, Mario
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2023-03-10 17:00 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Mario Limonciello, Anson Tsao, Felix Fietkau, Lorenzo Bianconi,
	Ryder Lee, Shayne Chen, Sean Wang, Kalle Valo, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless,
	netdev, linux-arm-kernel, linux-mediatek, linux-kernel

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>
---
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index 8a53d8f286db..24a2aafa6e2a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
  2023-03-10 17:00 [PATCH] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset Mario Limonciello
@ 2023-03-20 13:26 ` Limonciello, Mario
  0 siblings, 0 replies; 2+ messages in thread
From: Limonciello, Mario @ 2023-03-20 13:26 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee
  Cc: Tsao, Anson, Shayne Chen, Sean Wang, Kalle Valo, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-wireless,
	netdev, linux-arm-kernel, linux-mediatek, linux-kernel,
	Matthias Brugger

[Public]



> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Friday, March 10, 2023 11:00
> To: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Tsao, Anson
> <anson.tsao@amd.com>; Felix Fietkau <nbd@nbd.name>; Lorenzo Bianconi
> <lorenzo@kernel.org>; Ryder Lee <ryder.lee@mediatek.com>; Shayne Chen
> <shayne.chen@mediatek.com>; Sean Wang <sean.wang@mediatek.com>;
> Kalle Valo <kvalo@kernel.org>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; linux-wireless@vger.kernel.org;
> netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> mediatek@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] 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.
> 
> Tested-by: Anson Tsao <anson.tsao@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Hi Felix, Lorenzo, Ryder,

Any comments please?

Thanks,

> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> index 8a53d8f286db..24a2aafa6e2a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> @@ -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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-20 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 17:00 [PATCH] wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset Mario Limonciello
2023-03-20 13:26 ` Limonciello, Mario

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).