stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
@ 2022-05-10  9:26 Joakim Tjernlund
  2022-05-10 10:20 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2022-05-10  9:26 UTC (permalink / raw)
  To: stable; +Cc: sean.wang, nbd

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380

I see this error on ThinkPad T14 Gen 2a

 Jocke

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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-10  9:26 Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380 Joakim Tjernlund
@ 2022-05-10 10:20 ` Greg KH
  2022-05-10 15:06   ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-05-10 10:20 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: stable, sean.wang, nbd

On Tue, May 10, 2022 at 09:26:31AM +0000, Joakim Tjernlund wrote:
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
> 
> I see this error on ThinkPad T14 Gen 2a

But that commit says it fixes commit bf3747ae2e25 ("mt76: mt7921: enable
aspm by default") which is in 5.16, not 5.15.

Have you tested this on 5.15.y to verify it will work properly?

thanks,

greg k-h

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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-10 10:20 ` Greg KH
@ 2022-05-10 15:06   ` Joakim Tjernlund
  2022-05-13 14:32     ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2022-05-10 15:06 UTC (permalink / raw)
  To: gregkh; +Cc: sean.wang, nbd, stable

On Tue, 2022-05-10 at 12:20 +0200, Greg KH wrote:
> On Tue, May 10, 2022 at 09:26:31AM +0000, Joakim Tjernlund wrote:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fstable%2Flinux.git%2Fcommit%2F%3Fid%3D602cc0c9618a819ab00ea3c9400742a0ca318380&data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7C59fa126bca0c404c5e1e08da326eaf1e%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637877748209285143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CGswwJi11zPnCnULlb6sORh4vllNE80K%2FC7BArf8c7I%3D&reserved=0
> > 
> > I see this error on ThinkPad T14 Gen 2a
> 
> But that commit says it fixes commit bf3747ae2e25 ("mt76: mt7921: enable
> aspm by default") which is in 5.16, not 5.15.
> 
> Have you tested this on 5.15.y to verify it will work properly?
> 
> thanks,
> 
> greg k-h

I got the same error/symptoms as https://bugzilla.kernel.org/show_bug.cgi?id=214557
which I believe "mt76: mt7921e: fix possible probe failure after reboot" addressed.

The patch is not trivial for me to backport so I haven't tested it.

Maybe Sean/Felix can comment?

 Jocke

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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-10 15:06   ` Joakim Tjernlund
@ 2022-05-13 14:32     ` Joakim Tjernlund
  2022-05-17  8:28       ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2022-05-13 14:32 UTC (permalink / raw)
  To: gregkh; +Cc: sean.wang, nbd, stable

Still seeing this on 5.15.39 after reboot, I have to power off to regain WiFi
~ # dmesg | grep mt
[    4.621058] mt7921e 0000:03:00.0: enabling device (0000 -> 0002)
[    4.636344] mt7921e 0000:03:00.0: disabling ASPM  L1
[    4.637038] mt7921e 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[    4.643347] mt7921e 0000:03:00.0: ASIC revision: 79610010
[    5.716687] mt7921e: probe of 0000:03:00.0 failed with error -110

Sean/Felix ping ?

 Jocke

On Tue, 2022-05-10 at 17:06 +0200, Joakim Tjernlund wrote:
> On Tue, 2022-05-10 at 12:20 +0200, Greg KH wrote:
> > On Tue, May 10, 2022 at 09:26:31AM +0000, Joakim Tjernlund wrote:
> > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fstable%2Flinux.git%2Fcommit%2F%3Fid%3D602cc0c9618a819ab00ea3c9400742a0ca318380&data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7C59fa126bca0c404c5e1e08da326eaf1e%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637877748209285143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CGswwJi11zPnCnULlb6sORh4vllNE80K%2FC7BArf8c7I%3D&reserved=0
> > > 
> > > I see this error on ThinkPad T14 Gen 2a
> > 
> > But that commit says it fixes commit bf3747ae2e25 ("mt76: mt7921: enable
> > aspm by default") which is in 5.16, not 5.15.
> > 
> > Have you tested this on 5.15.y to verify it will work properly?
> > 
> > thanks,
> > 
> > greg k-h
> 
> I got the same error/symptoms as https://bugzilla.kernel.org/show_bug.cgi?id=214557
> which I believe "mt76: mt7921e: fix possible probe failure after reboot" addressed.
> 
> The patch is not trivial for me to backport so I haven't tested it.
> 
> Maybe Sean/Felix can comment?
> 
>  Jocke


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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-13 14:32     ` Joakim Tjernlund
@ 2022-05-17  8:28       ` Joakim Tjernlund
  2022-05-22 18:49         ` Joakim Tjernlund
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2022-05-17  8:28 UTC (permalink / raw)
  To: gregkh; +Cc: sean.wang, nbd, stable

Sean and/or Felix, this looks the same error. Please comment.

 Jocke

On Fri, 2022-05-13 at 16:32 +0200, Joakim Tjernlund wrote:
> Still seeing this on 5.15.39 after reboot, I have to power off to regain WiFi
> ~ # dmesg | grep mt
> [    4.621058] mt7921e 0000:03:00.0: enabling device (0000 -> 0002)
> [    4.636344] mt7921e 0000:03:00.0: disabling ASPM  L1
> [    4.637038] mt7921e 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
> [    4.643347] mt7921e 0000:03:00.0: ASIC revision: 79610010
> [    5.716687] mt7921e: probe of 0000:03:00.0 failed with error -110
> 
> Sean/Felix ping ?
> 
>  Jocke
> 
> On Tue, 2022-05-10 at 17:06 +0200, Joakim Tjernlund wrote:
> > On Tue, 2022-05-10 at 12:20 +0200, Greg KH wrote:
> > > On Tue, May 10, 2022 at 09:26:31AM +0000, Joakim Tjernlund wrote:
> > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fstable%2Flinux.git%2Fcommit%2F%3Fid%3D602cc0c9618a819ab00ea3c9400742a0ca318380&data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7C59fa126bca0c404c5e1e08da326eaf1e%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637877748209285143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CGswwJi11zPnCnULlb6sORh4vllNE80K%2FC7BArf8c7I%3D&reserved=0
> > > > 
> > > > I see this error on ThinkPad T14 Gen 2a
> > > 
> > > But that commit says it fixes commit bf3747ae2e25 ("mt76: mt7921: enable
> > > aspm by default") which is in 5.16, not 5.15.
> > > 
> > > Have you tested this on 5.15.y to verify it will work properly?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > I got the same error/symptoms as https://bugzilla.kernel.org/show_bug.cgi?id=214557
> > which I believe "mt76: mt7921e: fix possible probe failure after reboot" addressed.
> > 
> > The patch is not trivial for me to backport so I haven't tested it.
> > 
> > Maybe Sean/Felix can comment?
> > 
> >  Jocke
> 


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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-17  8:28       ` Joakim Tjernlund
@ 2022-05-22 18:49         ` Joakim Tjernlund
  2022-05-23 15:12           ` gregkh
  0 siblings, 1 reply; 7+ messages in thread
From: Joakim Tjernlund @ 2022-05-22 18:49 UTC (permalink / raw)
  To: gregkh; +Cc: sean.wang, nbd, stable

Since neither Sean nor Felix has replied I did my own backport to 5.15.x
Not sure about the proper protocol for this type of work but adding the patch here anyway.
Unsure if this is correct but I have not seen the error after this patch.

From 09bba89cfbed2984270cc6a562b7a07628265e7e Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Date: Sun, 22 May 2022 20:20:45 +0200
Subject: [PATCH] mt76: mt7921e: fix possible probe failure after reboot in 5.15.x

This is a backport of 602cc0c9618a819ab00ea3c9400742a0ca318380 to
5.15.x as the same error can be observed:
[  215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000
[  216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
---
 .../net/wireless/mediatek/mt76/mt7921/dma.c   | 115 -----------------
 .../net/wireless/mediatek/mt76/mt7921/mcu.c   |  20 +--
 .../net/wireless/mediatek/mt76/mt7921/pci.c   | 121 ++++++++++++++++++
 3 files changed, 131 insertions(+), 125 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c
index 7d7d43a5422f..93d0cc1827d2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c
@@ -118,109 +118,6 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev)
 	mt76_wr(dev, MT_WFDMA0_TX_RING17_EXT_CTRL, PREFETCH(0x380, 0x4));
 }
 
-static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
-{
-	static const struct {
-		u32 phys;
-		u32 mapped;
-		u32 size;
-	} fixed_map[] = {
-		{ 0x00400000, 0x80000, 0x10000}, /* WF_MCU_SYSRAM */
-		{ 0x00410000, 0x90000, 0x10000}, /* WF_MCU_SYSRAM (configure register) */
-		{ 0x40000000, 0x70000, 0x10000}, /* WF_UMAC_SYSRAM */
-		{ 0x54000000, 0x02000, 0x1000 }, /* WFDMA PCIE0 MCU DMA0 */
-		{ 0x55000000, 0x03000, 0x1000 }, /* WFDMA PCIE0 MCU DMA1 */
-		{ 0x58000000, 0x06000, 0x1000 }, /* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */
-		{ 0x59000000, 0x07000, 0x1000 }, /* WFDMA PCIE1 MCU DMA1 */
-		{ 0x7c000000, 0xf0000, 0x10000 }, /* CONN_INFRA */
-		{ 0x7c020000, 0xd0000, 0x10000 }, /* CONN_INFRA, WFDMA */
-		{ 0x7c060000, 0xe0000, 0x10000}, /* CONN_INFRA, conn_host_csr_top */
-		{ 0x80020000, 0xb0000, 0x10000 }, /* WF_TOP_MISC_OFF */
-		{ 0x81020000, 0xc0000, 0x10000 }, /* WF_TOP_MISC_ON */
-		{ 0x820c0000, 0x08000, 0x4000 }, /* WF_UMAC_TOP (PLE) */
-		{ 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */
-		{ 0x820cc000, 0x0e000, 0x2000 }, /* WF_UMAC_TOP (PP) */
-		{ 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */
-		{ 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */
-		{ 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */
-		{ 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */
-		{ 0x820e1000, 0x20400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_TRB) */
-		{ 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */
-		{ 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */
-		{ 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */
-		{ 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */
-		{ 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */
-		{ 0x820e9000, 0x23400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_WTBLOFF) */
-		{ 0x820ea000, 0x24000, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_ETBF) */
-		{ 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */
-		{ 0x820ec000, 0x24600, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_INT) */
-		{ 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */
-		{ 0x820f0000, 0xa0000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_CFG) */
-		{ 0x820f1000, 0xa0600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_TRB) */
-		{ 0x820f2000, 0xa0800, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_AGG) */
-		{ 0x820f3000, 0xa0c00, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_ARB) */
-		{ 0x820f4000, 0xa1000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_TMAC) */
-		{ 0x820f5000, 0xa1400, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_RMAC) */
-		{ 0x820f7000, 0xa1e00, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_DMA) */
-		{ 0x820f9000, 0xa3400, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_WTBLOFF) */
-		{ 0x820fa000, 0xa4000, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_ETBF) */
-		{ 0x820fb000, 0xa4200, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_LPON) */
-		{ 0x820fc000, 0xa4600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_INT) */
-		{ 0x820fd000, 0xa4800, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_MIB) */
-	};
-	int i;
-
-	if (addr < 0x100000)
-		return addr;
-
-	for (i = 0; i < ARRAY_SIZE(fixed_map); i++) {
-		u32 ofs;
-
-		if (addr < fixed_map[i].phys)
-			continue;
-
-		ofs = addr - fixed_map[i].phys;
-		if (ofs > fixed_map[i].size)
-			continue;
-
-		return fixed_map[i].mapped + ofs;
-	}
-
-	if ((addr >= 0x18000000 && addr < 0x18c00000) ||
-	    (addr >= 0x70000000 && addr < 0x78000000) ||
-	    (addr >= 0x7c000000 && addr < 0x7c400000))
-		return mt7921_reg_map_l1(dev, addr);
-
-	dev_err(dev->mt76.dev, "Access currently unsupported address %08x\n",
-		addr);
-
-	return 0;
-}
-
-static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset)
-{
-	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-	u32 addr = __mt7921_reg_addr(dev, offset);
-
-	return dev->bus_ops->rr(mdev, addr);
-}
-
-static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val)
-{
-	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-	u32 addr = __mt7921_reg_addr(dev, offset);
-
-	dev->bus_ops->wr(mdev, addr, val);
-}
-
-static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
-{
-	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-	u32 addr = __mt7921_reg_addr(dev, offset);
-
-	return dev->bus_ops->rmw(mdev, addr, mask, val);
-}
-
 static int mt7921_dma_disable(struct mt7921_dev *dev, bool force)
 {
 	if (force) {
@@ -380,20 +277,8 @@ int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev)
 
 int mt7921_dma_init(struct mt7921_dev *dev)
 {
-	struct mt76_bus_ops *bus_ops;
 	int ret;
 
-	dev->bus_ops = dev->mt76.bus;
-	bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops),
-			       GFP_KERNEL);
-	if (!bus_ops)
-		return -ENOMEM;
-
-	bus_ops->rr = mt7921_rr;
-	bus_ops->wr = mt7921_wr;
-	bus_ops->rmw = mt7921_rmw;
-	dev->mt76.bus = bus_ops;
-
 	mt76_dma_attach(&dev->mt76);
 
 	ret = mt7921_dma_disable(dev, true);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index 506a1909ce6d..4119f8efd896 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -1306,8 +1306,6 @@ int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
 
 int __mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
 {
-	struct mt76_phy *mphy = &dev->mt76.phy;
-	struct mt76_connac_pm *pm = &dev->pm;
 	int i, err = 0;
 
 	for (i = 0; i < MT7921_DRV_OWN_RETRY_COUNT; i++) {
@@ -1320,16 +1318,8 @@ int __mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
 	if (i == MT7921_DRV_OWN_RETRY_COUNT) {
 		dev_err(dev->mt76.dev, "driver own failed\n");
 		err = -EIO;
-		goto out;
 	}
 
-	mt7921_wpdma_reinit_cond(dev);
-	clear_bit(MT76_STATE_PM, &mphy->state);
-
-	pm->stats.last_wake_event = jiffies;
-	pm->stats.doze_time += pm->stats.last_wake_event -
-			       pm->stats.last_doze_event;
-out:
 	return err;
 }
 
@@ -1345,6 +1335,16 @@ int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
 		goto out;
 
 	err = __mt7921_mcu_drv_pmctrl(dev);
+        if (err < 0)
+            goto out;
+
+	mt7921_wpdma_reinit_cond(dev);
+	clear_bit(MT76_STATE_PM, &mphy->state);
+
+	pm->stats.last_wake_event = jiffies;
+	pm->stats.doze_time += pm->stats.last_wake_event -
+			       pm->stats.last_doze_event;
+
 out:
 	mutex_unlock(&pm->mutex);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index c3905bcab360..7d9b23a00238 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -88,6 +88,110 @@ static void mt7921_irq_tasklet(unsigned long data)
 		napi_schedule(&dev->mt76.napi[MT_RXQ_MAIN]);
 }
 
+static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
+{
+	static const struct {
+		u32 phys;
+		u32 mapped;
+		u32 size;
+	} fixed_map[] = {
+		{ 0x00400000, 0x80000, 0x10000}, /* WF_MCU_SYSRAM */
+		{ 0x00410000, 0x90000, 0x10000}, /* WF_MCU_SYSRAM (configure register) */
+		{ 0x40000000, 0x70000, 0x10000}, /* WF_UMAC_SYSRAM */
+		{ 0x54000000, 0x02000, 0x1000 }, /* WFDMA PCIE0 MCU DMA0 */
+		{ 0x55000000, 0x03000, 0x1000 }, /* WFDMA PCIE0 MCU DMA1 */
+		{ 0x58000000, 0x06000, 0x1000 }, /* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */
+		{ 0x59000000, 0x07000, 0x1000 }, /* WFDMA PCIE1 MCU DMA1 */
+		{ 0x7c000000, 0xf0000, 0x10000 }, /* CONN_INFRA */
+		{ 0x7c020000, 0xd0000, 0x10000 }, /* CONN_INFRA, WFDMA */
+		{ 0x7c060000, 0xe0000, 0x10000}, /* CONN_INFRA, conn_host_csr_top */
+		{ 0x80020000, 0xb0000, 0x10000 }, /* WF_TOP_MISC_OFF */
+		{ 0x81020000, 0xc0000, 0x10000 }, /* WF_TOP_MISC_ON */
+		{ 0x820c0000, 0x08000, 0x4000 }, /* WF_UMAC_TOP (PLE) */
+		{ 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */
+		{ 0x820cc000, 0x0e000, 0x2000 }, /* WF_UMAC_TOP (PP) */
+		{ 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */
+		{ 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */
+		{ 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */
+		{ 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */
+		{ 0x820e1000, 0x20400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_TRB) */
+		{ 0x820e2000, 0x20800, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_AGG) */
+		{ 0x820e3000, 0x20c00, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_ARB) */
+		{ 0x820e4000, 0x21000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_TMAC) */
+		{ 0x820e5000, 0x21400, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_RMAC) */
+		{ 0x820e7000, 0x21e00, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_DMA) */
+		{ 0x820e9000, 0x23400, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_WTBLOFF) */
+		{ 0x820ea000, 0x24000, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_ETBF) */
+		{ 0x820eb000, 0x24200, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_LPON) */
+		{ 0x820ec000, 0x24600, 0x0200 }, /* WF_LMAC_TOP BN0 (WF_INT) */
+		{ 0x820ed000, 0x24800, 0x0800 }, /* WF_LMAC_TOP BN0 (WF_MIB) */
+		{ 0x820f0000, 0xa0000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_CFG) */
+		{ 0x820f1000, 0xa0600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_TRB) */
+		{ 0x820f2000, 0xa0800, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_AGG) */
+		{ 0x820f3000, 0xa0c00, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_ARB) */
+		{ 0x820f4000, 0xa1000, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_TMAC) */
+		{ 0x820f5000, 0xa1400, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_RMAC) */
+		{ 0x820f7000, 0xa1e00, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_DMA) */
+		{ 0x820f9000, 0xa3400, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_WTBLOFF) */
+		{ 0x820fa000, 0xa4000, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_ETBF) */
+		{ 0x820fb000, 0xa4200, 0x0400 }, /* WF_LMAC_TOP BN1 (WF_LPON) */
+		{ 0x820fc000, 0xa4600, 0x0200 }, /* WF_LMAC_TOP BN1 (WF_INT) */
+		{ 0x820fd000, 0xa4800, 0x0800 }, /* WF_LMAC_TOP BN1 (WF_MIB) */
+	};
+	int i;
+
+	if (addr < 0x100000)
+		return addr;
+
+	for (i = 0; i < ARRAY_SIZE(fixed_map); i++) {
+		u32 ofs;
+
+		if (addr < fixed_map[i].phys)
+			continue;
+
+		ofs = addr - fixed_map[i].phys;
+		if (ofs > fixed_map[i].size)
+			continue;
+
+		return fixed_map[i].mapped + ofs;
+	}
+
+	if ((addr >= 0x18000000 && addr < 0x18c00000) ||
+	    (addr >= 0x70000000 && addr < 0x78000000) ||
+	    (addr >= 0x7c000000 && addr < 0x7c400000))
+		return mt7921_reg_map_l1(dev, addr);
+
+	dev_err(dev->mt76.dev, "Access currently unsupported address %08x\n",
+		addr);
+
+	return 0;
+}
+
+static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset)
+{
+	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
+	u32 addr = __mt7921_reg_addr(dev, offset);
+
+	return dev->bus_ops->rr(mdev, addr);
+}
+
+static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val)
+{
+	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
+	u32 addr = __mt7921_reg_addr(dev, offset);
+
+	dev->bus_ops->wr(mdev, addr, val);
+}
+
+static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
+{
+	struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
+	u32 addr = __mt7921_reg_addr(dev, offset);
+
+	return dev->bus_ops->rmw(mdev, addr, mask, val);
+}
+
+
 static int mt7921_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *id)
 {
@@ -110,6 +214,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
 		.sta_remove = mt7921_mac_sta_remove,
 		.update_survey = mt7921_update_channel,
 	};
+	struct mt76_bus_ops *bus_ops;
 	struct mt7921_dev *dev;
 	struct mt76_dev *mdev;
 	int ret;
@@ -145,6 +250,22 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
 
 	mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
 	tasklet_init(&dev->irq_tasklet, mt7921_irq_tasklet, (unsigned long)dev);
+
+	dev->bus_ops = dev->mt76.bus;
+	bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops),
+			       GFP_KERNEL);
+	if (!bus_ops)
+		return -ENOMEM;
+
+	bus_ops->rr = mt7921_rr;
+	bus_ops->wr = mt7921_wr;
+	bus_ops->rmw = mt7921_rmw;
+	dev->mt76.bus = bus_ops;
+
+	ret = __mt7921_mcu_drv_pmctrl(dev);
+	if (ret)
+		return ret;
+
 	mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) |
 		    (mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
 	dev_err(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
-- 
2.35.1

On Tue, 2022-05-17 at 10:28 +0200, Joakim Tjernlund wrote:
> Sean and/or Felix, this looks the same error. Please comment.
> 
>  Jocke
> 
> On Fri, 2022-05-13 at 16:32 +0200, Joakim Tjernlund wrote:
> > Still seeing this on 5.15.39 after reboot, I have to power off to regain WiFi
> > ~ # dmesg | grep mt
> > [    4.621058] mt7921e 0000:03:00.0: enabling device (0000 -> 0002)
> > [    4.636344] mt7921e 0000:03:00.0: disabling ASPM  L1
> > [    4.637038] mt7921e 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
> > [    4.643347] mt7921e 0000:03:00.0: ASIC revision: 79610010
> > [    5.716687] mt7921e: probe of 0000:03:00.0 failed with error -110
> > 
> > Sean/Felix ping ?
> > 
> >  Jocke
> > 
> > On Tue, 2022-05-10 at 17:06 +0200, Joakim Tjernlund wrote:
> > > On Tue, 2022-05-10 at 12:20 +0200, Greg KH wrote:
> > > > On Tue, May 10, 2022 at 09:26:31AM +0000, Joakim Tjernlund wrote:
> > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fstable%2Flinux.git%2Fcommit%2F%3Fid%3D602cc0c9618a819ab00ea3c9400742a0ca318380&amp;data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7C59fa126bca0c404c5e1e08da326eaf1e%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637877748209285143%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=CGswwJi11zPnCnULlb6sORh4vllNE80K%2FC7BArf8c7I%3D&amp;reserved=0
> > > > > 
> > > > > I see this error on ThinkPad T14 Gen 2a
> > > > 
> > > > But that commit says it fixes commit bf3747ae2e25 ("mt76: mt7921: enable
> > > > aspm by default") which is in 5.16, not 5.15.
> > > > 
> > > > Have you tested this on 5.15.y to verify it will work properly?
> > > > 
> > > > thanks,
> > > > 
> > > > greg k-h
> > > 
> > > I got the same error/symptoms as https://bugzilla.kernel.org/show_bug.cgi?id=214557
> > > which I believe "mt76: mt7921e: fix possible probe failure after reboot" addressed.
> > > 
> > > The patch is not trivial for me to backport so I haven't tested it.
> > > 
> > > Maybe Sean/Felix can comment?
> > > 
> > >  Jocke
> > 
> 


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

* Re: Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380
  2022-05-22 18:49         ` Joakim Tjernlund
@ 2022-05-23 15:12           ` gregkh
  0 siblings, 0 replies; 7+ messages in thread
From: gregkh @ 2022-05-23 15:12 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: sean.wang, nbd, stable

On Sun, May 22, 2022 at 06:49:10PM +0000, Joakim Tjernlund wrote:
> Since neither Sean nor Felix has replied I did my own backport to 5.15.x
> Not sure about the proper protocol for this type of work but adding the patch here anyway.
> Unsure if this is correct but I have not seen the error after this patch.

Now queued up, thanks!

greg k-h

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

end of thread, other threads:[~2022-05-23 15:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  9:26 Please backport to 5.15.x: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=602cc0c9618a819ab00ea3c9400742a0ca318380 Joakim Tjernlund
2022-05-10 10:20 ` Greg KH
2022-05-10 15:06   ` Joakim Tjernlund
2022-05-13 14:32     ` Joakim Tjernlund
2022-05-17  8:28       ` Joakim Tjernlund
2022-05-22 18:49         ` Joakim Tjernlund
2022-05-23 15:12           ` gregkh

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).