From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Chris Holland <bandidoirlandes@gmail.com>
Cc: Robert Hancock <hancockrwd@gmail.com>,
linux-kernel@vger.kernel.org, jbarnes@virtuousgeek.org
Subject: Re: IDE DVD and CD drive seem to not work with Linux desktop 3.3.0-030300-generic
Date: Fri, 23 Mar 2012 17:20:53 +0000 [thread overview]
Message-ID: <20120323172053.GA24571@srcf.ucam.org> (raw)
In-Reply-To: <CAMfrEMa6EAsLMMvG-Yq03E0Qhc7jdk2WH5fvQUB16W-5=Qgfbw@mail.gmail.com>
Ok, this is very odd - ASPM is disabled in both cases. The only thing I
can think of here is that the hardware dislikes us writing to the
registers? Can you test this patch on top of the broken kernel?
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 24f049e..04eb680 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -185,6 +185,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
int ppos, cpos, same_clock = 1;
u16 reg16, parent_reg, child_reg[8];
unsigned long start_jiffies;
+ bool retrain = false;
struct pci_dev *child, *parent = link->pdev;
struct pci_bus *linkbus = parent->subordinate;
/*
@@ -215,7 +216,10 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
reg16 |= PCI_EXP_LNKCTL_CCC;
else
reg16 &= ~PCI_EXP_LNKCTL_CCC;
- pci_write_config_word(child, cpos + PCI_EXP_LNKCTL, reg16);
+ if (reg16 != child_reg[PCI_FUNC(child->devfn)]) {
+ retrain = true;
+ pci_write_config_word(child, cpos + PCI_EXP_LNKCTL, reg16);
+ }
}
/* Configure upstream component */
@@ -225,9 +229,15 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
reg16 |= PCI_EXP_LNKCTL_CCC;
else
reg16 &= ~PCI_EXP_LNKCTL_CCC;
- pci_write_config_word(parent, ppos + PCI_EXP_LNKCTL, reg16);
+ if (reg16 != parent_reg) {
+ retrain = true;
+ pci_write_config_word(parent, ppos + PCI_EXP_LNKCTL, reg16);
+ }
/* Retrain link */
+ if (!retrain)
+ return;
+
reg16 |= PCI_EXP_LNKCTL_RL;
pci_write_config_word(parent, ppos + PCI_EXP_LNKCTL, reg16);
@@ -436,13 +446,16 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)
{
- u16 reg16;
+ u16 reg16, orig_reg16;
int pos = pci_pcie_cap(pdev);
pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16);
+ orig_reg16 = reg16;
reg16 &= ~0x3;
reg16 |= val;
- pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
+
+ if (reg16 != orig_reg16)
+ pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
}
static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2012-03-23 17:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 4:29 IDE DVD and CD drive seem to not work with Linux desktop 3.3.0-030300-generic Chris Holland
2012-03-22 4:36 ` Robert Hancock
2012-03-22 5:44 ` Chris Holland
2012-03-23 2:15 ` Robert Hancock
2012-03-23 2:30 ` Chris Holland
2012-03-23 2:44 ` Chris Holland
2012-03-23 4:46 ` Chris Holland
2012-03-23 5:22 ` Robert Hancock
2012-03-23 12:49 ` Matthew Garrett
2012-03-23 16:29 ` Matthew Garrett
2012-03-23 16:48 ` Chris Holland
2012-03-23 16:51 ` Matthew Garrett
2012-03-23 17:04 ` Chris Holland
2012-03-23 17:20 ` Matthew Garrett [this message]
2012-03-23 19:12 ` Chris Holland
2012-03-23 19:17 ` Matthew Garrett
2012-03-23 19:20 ` Chris Holland
2012-03-23 19:21 ` Matthew Garrett
2012-03-23 20:10 ` Chris Holland
2012-03-23 20:12 ` Matthew Garrett
2012-03-23 22:33 ` Chris Holland
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=20120323172053.GA24571@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=bandidoirlandes@gmail.com \
--cc=hancockrwd@gmail.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.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