From: "Pali Rohár" <pali@kernel.org>
To: Minda Chen <minda.chen@starfivetech.com>
Cc: Simon Glass <sjg@chromium.org>, Stefan Roese <sr@denx.de>,
Andrew Scull <ascull@google.com>,
Mark Kettenis <kettenis@openbsd.org>,
u-boot@lists.denx.de, Rick Chen <rick@andestech.com>,
Leo <ycliang@andestech.com>,
Mason Huo <mason.huo@starfivetech.com>,
Yanhong Wang <yanhong.wang@starfivetech.com>,
Leyfoon Tan <leyfoon.tan@starfivetech.com>,
Kevin Xie <kevin.xie@starfivetech.com>
Subject: Re: [PATCH v3 1/3] starfive: pci: Add StarFive JH7110 pcie driver
Date: Fri, 31 Mar 2023 14:59:12 +0200 [thread overview]
Message-ID: <20230331125912.4sclo6hadin7mkkd@pali> (raw)
In-Reply-To: <3fefac0c-52b1-f7af-d1e5-8564436be1a8@starfivetech.com>
On Friday 31 March 2023 18:35:00 Minda Chen wrote:
> On 2023/3/30 1:27, Pali Rohár wrote:
> > Hello!
> >
> > On Wednesday 29 March 2023 18:01:41 Minda Chen wrote:
> >> + /* PCIe PCI Standard Configuration Identification Settings. */
> >> + value = (PCI_CLASS_BRIDGE_PCI_NORMAL << IDS_CLASS_CODE_SHIFT) | IDS_REVISION_ID;
> >> + writel(value, priv->reg_base + PCIE_PCI_IDS);
> >
> > This looks like configuration of the PCI_CLASS_REVISION read-only
> > register. Is there any reason why you are removing the original
> > "revision" information by hardcoded IDS_REVISION_ID constant?
> >
> This register is not read-only register, consist resion ID and class code.
> Bit [39:32]: Revision ID
> Bit [63:40]: Class code
I mean that this "priv->reg_base + PCIE_PCI_IDS" read-write register
configures what is visible when reading read-only standard PCI register
PCI_CLASS_REVISION.
PCIe Root Port is by definition of PCI-to-PCI Bridge class and therefore
reading from PCI_CLASS_REVISION must return PCI_CLASS_BRIDGE_PCI_* value.
This is required by PCIe spec.
With above driver init code it looks like that your PCIe controller does
not set correct value into PCI_CLASS_REVISION register after power-on
and manually setting correct value via "priv->reg_base + PCIE_PCI_IDS"
is a workaround.
Hopefully it is a more clear what I mean in my previous email.
Also mvebu controller has this issue and has similar workaround in
pci_mvebu.c driver.
> And the register reset value is zero, Our PCIe version is 2.0. So set value 2.
> Maybe I will add comment to this.
Well, Revision ID (low 8 bits of PCI_CLASS_REVISION) is the extension to
the vendor / device id register. It is not version of PCIe standard.
I would expect that this Vendor ID, Device ID and Revision ID values are
not being changed by the driver as they identify PCI and PCIe devices.
next prev parent reply other threads:[~2023-03-31 12:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 10:01 [PATCH v3 0/3] Add StarFive JH7110 PCIe drvier support Minda Chen
2023-03-29 10:01 ` [PATCH v3 1/3] starfive: pci: Add StarFive JH7110 pcie driver Minda Chen
2023-03-29 17:27 ` Pali Rohár
2023-03-31 10:35 ` Minda Chen
2023-03-31 12:59 ` Pali Rohár [this message]
2023-04-07 8:56 ` Minda Chen
2023-03-29 10:01 ` [PATCH v3 2/3] configs: starfive-jh7110: Add support for PCIe host driver Minda Chen
2023-03-29 10:01 ` [PATCH v3 3/3] riscv: dts: starfive: Enable PCIe host controller Minda Chen
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=20230331125912.4sclo6hadin7mkkd@pali \
--to=pali@kernel.org \
--cc=ascull@google.com \
--cc=kettenis@openbsd.org \
--cc=kevin.xie@starfivetech.com \
--cc=leyfoon.tan@starfivetech.com \
--cc=mason.huo@starfivetech.com \
--cc=minda.chen@starfivetech.com \
--cc=rick@andestech.com \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
--cc=yanhong.wang@starfivetech.com \
--cc=ycliang@andestech.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