2021-01-21 07:41:10

by Ricky Wu

[permalink] [raw]
Subject: [PATCH] rtsx: pci: fix device aspm state bug

From: Ricky Wu <[email protected]>

changed rtsx_pci_disable_aspm() to rtsx_disable_aspm()
make sure pcr->aspm_enabled to sync with aspm state

BUG=b:175338107
TEST=chromeos-kernel-5_4

Signed-off-by: Ricky Wu <[email protected]>
Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
---
drivers/misc/cardreader/rtsx_pcr.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index f07b01125d19..f3645e72ecc4 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1285,8 +1285,15 @@ int rtsx_ms_power_off_card3v3(struct rtsx_pcr *pcr)
static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
{
int err;
+ u8 val;

pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP);
+ rtsx_pci_read_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, &val);
+ if (val & 0x02)
+ pcr->aspm_enabled = true;
+ else
+ pcr->aspm_enabled = false;
+
rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr);

rtsx_pci_enable_bus_int(pcr);
@@ -1307,7 +1314,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
/* Wait SSC power stable */
udelay(200);

- rtsx_pci_disable_aspm(pcr);
+ rtsx_disable_aspm(pcr);
if (pcr->ops->optimize_phy) {
err = pcr->ops->optimize_phy(pcr);
if (err < 0)
--
2.17.1


2021-01-21 07:48:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug

On Thu, Jan 21, 2021 at 03:28:58PM +0800, [email protected] wrote:
> From: Ricky Wu <[email protected]>
>
> changed rtsx_pci_disable_aspm() to rtsx_disable_aspm()
> make sure pcr->aspm_enabled to sync with aspm state

Can you make this a bit more descriptive?


>
> BUG=b:175338107
> TEST=chromeos-kernel-5_4

What are these lines for?

>
> Signed-off-by: Ricky Wu <[email protected]>

This email does not match your From: address :(

> Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258

Please use checkpatch.pl before sending patches to us :(

And why did you send this twice?

thanks,

greg k-h

2021-01-21 08:18:22

by Ricky Wu

[permalink] [raw]
Subject: RE: [PATCH] rtsx: pci: fix device aspm state bug

> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Thursday, January 21, 2021 3:46 PM
> To: ?d???? Ricky <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
>
> On Thu, Jan 21, 2021 at 03:28:58PM +0800, [email protected] wrote:
> > From: Ricky Wu <[email protected]>
> >
> > changed rtsx_pci_disable_aspm() to rtsx_disable_aspm() make sure
> > pcr->aspm_enabled to sync with aspm state
>
> Can you make this a bit more descriptive?
>
Changed rtsx_pci_disable_aspm() to rtsx_disable_aspm() make sure
pcr->aspm_enabled to sync with aspm state.
rtsx_pci_disable_aspm() this function disable aspm by setting config space directly
did not change value of pcr->aspm_enabled so changed to use rtsx_disable_aspm().
Give initial value to pcr->aspm_enabled by reading config space setting at init_hw().

>
> >
> > BUG=b:175338107
> > TEST=chromeos-kernel-5_4
>
> What are these lines for?
>
> >
> > Signed-off-by: Ricky Wu <[email protected]>
>
> This email does not match your From: address :(
>
> > Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
>
> Please use checkpatch.pl before sending patches to us :(
>
> And why did you send this twice?
>
> thanks,
>
> greg k-h
>
> ------Please consider the environment before printing this e-mail.