From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Ryder Lee" <ryder.lee@mediatek.com>,
"Jianjun Wang" <jianjun.wang@mediatek.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
"Frank Li" <Frank.li@nxp.com>,
Hui.Ma@airoha.com, upstream@airoha.com
Subject: Re: [PATCH v2 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC
Date: Fri, 21 Feb 2025 10:20:01 +0100 [thread overview]
Message-ID: <Z7hFQXIrpMpH_72T@lore-desk> (raw)
In-Reply-To: <20250220235607.GA320302@bhelgaas>
[-- Attachment #1: Type: text/plain, Size: 2357 bytes --]
> [+cc Frank, who asked the same question about DT]
>
> On Thu, Feb 20, 2025 at 08:54:06PM +0100, Lorenzo Bianconi wrote:
> > On Feb 20, Bjorn Helgaas wrote:
> > > On Sun, Feb 02, 2025 at 08:34:24PM +0100, Lorenzo Bianconi wrote:
> > > > Configure PBus base address and address mask to allow the hw
> > > > to detect if a given address is on PCIE0, PCIE1 or PCIE2.
>
> > > > +#define PCIE_EN7581_PBUS_ADDR(_n) (0x00 + ((_n) << 3))
> > > > +#define PCIE_EN7581_PBUS_ADDR_MASK(_n) (0x04 + ((_n) << 3))
> > > > +#define PCIE_EN7581_PBUS_BASE_ADDR(_n) \
> > > > + ((_n) == 2 ? 0x28000000 : \
> > > > + (_n) == 1 ? 0x24000000 : 0x20000000)
> > >
> > > Are these addresses something that should be expressed in devicetree?
> >
> > Do you have any example/pointer for it?
> >
> > > It seems unusual to encode addresses directly in a driver.
> >
> > AFAIK they are fixed for EN7581 SoC.
>
> So this is used to detect if a given address is on PCIE0, PCIE1 or
> PCIE2. What does that mean? There are no other mentions of PCIE0 etc
> in the driver, but maybe they match up to "pcie0/1/2" in
> arch/arm64/boot/dts/mediatek/mt7988a.dtsi?
>
> It looks like you use PCIE_EN7581_PBUS_ADDR(slot), where "slot" came
> from of_get_pci_domain_nr(), which suggests that these might be three
> separate Root Ports?
I was using pci_domain to detect the specific PCIe controller
(something similar to what is done here [0]) but I agree with Frank, it does
not seem completely correct.
[0] https://github.com/torvalds/linux/blob/master/drivers/pci/controller/pcie-mediatek.c#L1048
>
> Are we talking about an MMIO address that an endpoint driver uses for
> readw() etc, and this code configures the hardware apertures through
> the host bridge? Seems like that would be related to the "ranges"
> properties in DT.
I guess so, but I do not have any documentation about pbus-csr (adding Hui in
the loop).
As pointed out by Frank, do you agree to add these info in the dts? Something
like:
pcie0: pcie@1fc00000 {
....
mediatek,pbus-csr = <&pbus_csr 0x0 0x20000000 0x4 0xfc000000>;
....
};
pcie1: pcie@1fc20000 {
....
mediatek,pbus-csr = <&pbus_csr 0x8 0x24000000 0xc 0xfc000000>;
....
};
@Hui: can you please provide a better explanation about pbus-csr usage?
Regards,
Lorenzo
>
> Bjorn
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-02-21 9:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-02 19:34 [PATCH v2 0/2] PCI: mediatek-gen3: Set PBUS_CSR regs for Airoha EN7581 SoC Lorenzo Bianconi
2025-02-02 19:34 ` [PATCH v2 1/2] dt-bindings: PCI: mediatek-gen3: Add mediatek,pbus-csr phandle property Lorenzo Bianconi
2025-02-04 8:14 ` Krzysztof Kozlowski
2025-02-02 19:34 ` [PATCH v2 2/2] PCI: mediatek-gen3: Configure PBUS_CSR registers for EN7581 SoC Lorenzo Bianconi
2025-02-14 17:11 ` Manivannan Sadhasivam
2025-02-17 12:19 ` Lorenzo Bianconi
2025-02-19 18:26 ` Manivannan Sadhasivam
2025-02-20 20:23 ` Frank Li
2025-02-20 22:39 ` Lorenzo Bianconi
2025-02-20 18:20 ` Bjorn Helgaas
2025-02-20 19:54 ` Lorenzo Bianconi
2025-02-20 23:56 ` Bjorn Helgaas
2025-02-21 9:20 ` Lorenzo Bianconi [this message]
2025-02-21 9:30 ` 回复: " Hui Ma (马慧)
2025-02-21 18:31 ` Bjorn Helgaas
2025-02-21 23:18 ` Lorenzo Bianconi
2025-02-22 0:07 ` Bjorn Helgaas
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=Z7hFQXIrpMpH_72T@lore-desk \
--to=lorenzo@kernel.org \
--cc=Frank.li@nxp.com \
--cc=Hui.Ma@airoha.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=helgaas@kernel.org \
--cc=jianjun.wang@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
--cc=ryder.lee@mediatek.com \
--cc=upstream@airoha.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).