Skip to contentSkip to conversation

misc: rtsx: Fix some platforms can not boot and move the l1ss judgment to probe

PATCH In review Ricky WU 4 participants 5 messages Sep 20, 2023 – Sep 24, 2023 Char and misc drivers

lore
Share & tools
lore

Ricky WU

author
#0 lore raw

PATCH 1/1 misc: rtsx: Fix some platforms can not boot and move the l1ss judgment to probe

commit 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg") some readers no longer force #CLKREQ to low
when the system need to enter ASPM.
But some platform maybe not implement complete ASPM?
it causes some platforms can not boot

Like in the past only the platform support L1ss we release the #CLKREQ. Move the judgment (L1ss) to probe,
we think read config space one time when the driver start is enough

Fixes 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg")
---
 drivers/misc/cardreader/rts5227.c  | 55 ++++------------------------
 drivers/misc/cardreader/rts5228.c  | 57 +++++++++---------------------
 drivers/misc/cardreader/rts5249.c  | 56 ++++-------------------------
 drivers/misc/cardreader/rts5260.c  | 43 +++++++---------------
 drivers/misc/cardreader/rts5261.c  | 52 +++++++--------------------
 drivers/misc/cardreader/rtsx_pcr.c | 51 +++++++++++++++++++++++---
 6 files changed, 102 insertions(+), 212 deletions(-)
drivers/misc/cardreader/rts5227.c +6 -49
index 3dae5e3a1697..cd512284bfb3 100644
@@ -83,63 +83,20 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr)
 
 static void rts5227_init_from_cfg(struct rtsx_pcr *pcr)
 {
-	struct pci_dev *pdev = pcr->pci;
-	int l1ss;
-	u32 lval;
 	struct rtsx_cr_option *option = &pcr->option;
 
-	l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
-	if (!l1ss)
-		return;
-
-	pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
-
 	if (CHK_PCI_PID(pcr, 0x522A)) {
-		if (0 == (lval & 0x0F))
-			rtsx_pci_enable_oobs_polling(pcr);
-		else
+		if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
+				| PM_L1_1_EN | PM_L1_2_EN))
 			rtsx_pci_disable_oobs_polling(pcr);
+		else
+			rtsx_pci_enable_oobs_polling(pcr);
 	}
 
-	if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
-		rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
-	else
-		rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
-
-	if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
-		rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
-	else
-		rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
-
-	if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
-		rtsx_set_dev_flag(pcr, PM_L1_1_EN);
-	else
-		rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
-
-	if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
-		rtsx_set_dev_flag(pcr, PM_L1_2_EN);
-	else
-		rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
-
 	if (option->ltr_en) {
-		u16 val;
-
-		pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &val);
-		if (val & PCI_EXP_DEVCTL2_LTR_EN) {
-			option->ltr_enabled = true;
-			option->ltr_active = true;
+		if (option->ltr_enabled)
 			rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
-		} else {
-			option->ltr_enabled = false;
-		}
 	}
-
-	if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
-				| PM_L1_1_EN | PM_L1_2_EN))
-		option->force_clkreq_0 = false;
-	else
-		option->force_clkreq_0 = true;
-
 }
 
 static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
@@ -195,7 +152,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
 		}
 	}
 
-	if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
+	if (option->force_clkreq_0)
 		rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG,
 				FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
 	else
drivers/misc/cardreader/rts5228.c +17 -40

82 lines not on this page · raw message

drivers/misc/cardreader/rts5249.c +7 -49

89 lines not on this page · raw message

drivers/misc/cardreader/rts5260.c +13 -30

66 lines not on this page · raw message

drivers/misc/cardreader/rts5261.c +13 -39

73 lines not on this page · raw message

drivers/misc/cardreader/rtsx_pcr.c +46 -5

70 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Ricky WU

commit 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg") some readers no longer force #CLKREQ to low
when the system need to enter ASPM.
But some platform maybe not implement complete ASPM?
it causes some platforms can not boot

Quoted 6 lines

Like in the past only the platform support L1ss we release the #CLKREQ. Move the judgment (L1ss) to probe,
we think read config space one time when the driver start is enough

Fixes 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG Reg")

What about all of the people that reported this issue? Have they been able to test it? At least a reported-by line should be added, right?

And I'd like someone to test it to verify it fixes the issue before applying it...

thanks,

greg k-h

#2 lore raw

Hi Greg and Ricky,
I just finished testing the patch (on top of 6.1.53) and AFAICT it's working perfectly:
- system boots and all hardware devices seems to work fine
- nothing weird in kernel and system logs
- suspend-to-ram (S3) works
- the SD card reader works

If there's anything more you want me to test, don't hesitate.

Paul

Quoted 26 lines · On Wed, Sep 20 2023 at 11:21:13 +02:00:00, [email protected] wrote:
Quoted 7 lines · Ricky WU

commit 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG
Reg")
some readers no longer force #CLKREQ to low
when the system need to enter ASPM.
But some platform maybe not implement complete ASPM? it causes some platforms can not boot

Quoted 8 lines

Like in the past only the platform support L1ss we release the
#CLKREQ.
Move the judgment (L1ss) to probe,
we think read config space one time when the driver start is enough

Fixes 101bd907b424 ("misc: rtsx: judge ASPM Mode to set PETXCFG

Reg")

What about all of the people that reported this issue? Have they been able to test it? At least a reported-by line should be added, right?

And I'd like someone to test it to verify it fixes the issue before applying it...

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 9 lines · Paul Grandperrin

Hi Greg and Ricky,
I just finished testing the patch (on top of 6.1.53) and AFAICT it's working perfectly:
- system boots and all hardware devices seems to work fine
- nothing weird in kernel and system logs
- suspend-to-ram (S3) works
- the SD card reader works

If there's anything more you want me to test, don't hesitate.

Great, can I get a "Tested-by:" tag from you for this?

thanks,

greg k-h

Tested-by on v1 1/1
#4 lore raw
In reply to Ricky WU

I have tried this patch out on my machine that was experiencing the regression and it has been stable for two days. The card reader works properly and there is nothing funny in dmesg, so I think this successfully fixes the bug on the Dell XPS 15 9560.

So: