From: Rob Herring <robh@kernel.org>
To: Athani Nadeem Ladkhan <nadeem@cadence.com>
Cc: Tom Joseph <tjoseph@cadence.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
PCI <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Milind Parab <mparab@cadence.com>,
Swapnil Kashinath Jakhade <sjakhade@cadence.com>
Subject: Re: [PATCH] PCI: Cadence: Add quirk for Gen2 controller to do autonomous speed change.
Date: Wed, 23 Sep 2020 08:13:20 -0600 [thread overview]
Message-ID: <CAL_JsqKjzuhLL1UipOVimVb7pt-0KTk3vZ2kX3PssCtRKqhoHw@mail.gmail.com> (raw)
In-Reply-To: <SN2PR07MB2557BD3FF1959A113303C741D8380@SN2PR07MB2557.namprd07.prod.outlook.com>
On Wed, Sep 23, 2020 at 1:54 AM Athani Nadeem Ladkhan
<nadeem@cadence.com> wrote:
>
> Hi Rob,
>
> > -----Original Message-----
> > From: Rob Herring <robh@kernel.org>
> > Sent: Tuesday, September 22, 2020 11:08 PM
> > To: Athani Nadeem Ladkhan <nadeem@cadence.com>
> > Cc: Tom Joseph <tjoseph@cadence.com>; Lorenzo Pieralisi
> > <lorenzo.pieralisi@arm.com>; Bjorn Helgaas <bhelgaas@google.com>; PCI
> > <linux-pci@vger.kernel.org>; linux-kernel@vger.kernel.org; Milind Parab
> > <mparab@cadence.com>; Swapnil Kashinath Jakhade
> > <sjakhade@cadence.com>
> > Subject: Re: [PATCH] PCI: Cadence: Add quirk for Gen2 controller to do
> > autonomous speed change.
> >
> > EXTERNAL MAIL
> >
> >
> > On Fri, Sep 18, 2020 at 4:34 AM Nadeem Athani <nadeem@cadence.com>
> > wrote:
> > >
> > > Cadence controller will not initiate autonomous speed change if
> > > strapped as Gen2. The Retrain bit is set as a quirk to trigger this
> > > speed change.
> > >
> > > Signed-off-by: Nadeem Athani <nadeem@cadence.com>
> > > ---
> > > drivers/pci/controller/cadence/pcie-cadence-host.c | 13 +++++++++++++
> > > drivers/pci/controller/cadence/pcie-cadence.h | 6 ++++++
> > > 2 files changed, 19 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c
> > > b/drivers/pci/controller/cadence/pcie-cadence-host.c
> > > index 4550e0d..4cb7f29 100644
> > > --- a/drivers/pci/controller/cadence/pcie-cadence-host.c
> > > +++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
> > > @@ -83,6 +83,8 @@ static int cdns_pcie_host_init_root_port(struct
> > cdns_pcie_rc *rc)
> > > struct cdns_pcie *pcie = &rc->pcie;
> > > u32 value, ctrl;
> > > u32 id;
> > > + u32 link_cap = CDNS_PCIE_LINK_CAP_OFFSET;
> > > + u8 sls, lnk_ctl;
> > >
> > > /*
> > > * Set the root complex BAR configuration register:
> > > @@ -111,6 +113,17 @@ static int cdns_pcie_host_init_root_port(struct
> > cdns_pcie_rc *rc)
> > > if (rc->device_id != 0xffff)
> > > cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID,
> > > rc->device_id);
> > >
> > > + /* Quirk to enable autonomous speed change for GEN2 controller */
> > > + /* Reading Supported Link Speed value */
> > > + sls = PCI_EXP_LNKCAP_SLS &
> > > + cdns_pcie_rp_readb(pcie, link_cap + PCI_EXP_LNKCAP);
> > > + if (sls == PCI_EXP_LNKCAP_SLS_5_0GB) {
> > > + /* Since this a Gen2 controller, set Retrain Link(RL) bit */
> > > + lnk_ctl = cdns_pcie_rp_readb(pcie, link_cap + PCI_EXP_LNKCTL);
> > > + lnk_ctl |= PCI_EXP_LNKCTL_RL;
> > > + cdns_pcie_rp_writeb(pcie, link_cap + PCI_EXP_LNKCTL,
> > > + lnk_ctl);
> >
> > Why the byte accesses? This is a 16-bit register.
> This is a 32bit register. But the register field require is at first byte only. Hence the byte access.
No, it's a 16-bit register as Link Status is at the next half word:
#define PCI_EXP_LNKCTL 16 /* Link Control */
#define PCI_EXP_LNKSTA 18 /* Link Status */
Use accesses that match the register size.
Rob
prev parent reply other threads:[~2020-09-23 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 10:34 [PATCH] PCI: Cadence: Add quirk for Gen2 controller to do autonomous speed change Nadeem Athani
2020-09-22 17:37 ` Rob Herring
2020-09-23 7:43 ` Athani Nadeem Ladkhan
2020-09-23 7:54 ` Athani Nadeem Ladkhan
2020-09-23 14:13 ` Rob Herring [this message]
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=CAL_JsqKjzuhLL1UipOVimVb7pt-0KTk3vZ2kX3PssCtRKqhoHw@mail.gmail.com \
--to=robh@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mparab@cadence.com \
--cc=nadeem@cadence.com \
--cc=sjakhade@cadence.com \
--cc=tjoseph@cadence.com \
/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).