linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <ricky_wu@realtek.com>
To: <arnd@arndb.de>, <gregkh@linuxfoundation.org>,
	<ricky_wu@realtek.corp-partner.google.com>, <sashal@kernel.org>,
	<levinale@google.com>, <keitasuzuki.park@sslab.ics.keio.ac.jp>,
	<kdlnx@doth.eu>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] rtsx: pci: fix device aspm state bug
Date: Thu, 21 Jan 2021 15:28:23 +0800	[thread overview]
Message-ID: <20210121072823.31977-1-ricky_wu@realtek.com> (raw)

From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>

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 <ricky_wu@realtek.corp-partner.google.com>
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


             reply	other threads:[~2021-01-21  7:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  7:28 ricky_wu [this message]
2021-01-21  7:28 [PATCH] rtsx: pci: fix device aspm state bug ricky_wu
2021-01-21  7:33 ` 吳昊澄 Ricky
2021-01-21  8:07   ` gregkh
2021-01-21  8:15     ` 吳昊澄 Ricky
2021-01-21  8:27       ` gregkh
2021-01-21 10:07         ` 吳昊澄 Ricky
2021-01-21  7:45 ` Greg KH
2021-01-21  7:59   ` 吳昊澄 Ricky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210121072823.31977-1-ricky_wu@realtek.com \
    --to=ricky_wu@realtek.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kdlnx@doth.eu \
    --cc=keitasuzuki.park@sslab.ics.keio.ac.jp \
    --cc=levinale@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricky_wu@realtek.corp-partner.google.com \
    --cc=sashal@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).