From: Christian Marangi <ansuelsmth@gmail.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Ryder Lee" <ryder.lee@mediatek.com>,
"Jianjun Wang" <jianjun.wang@mediatek.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"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-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, upstream@airoha.com
Subject: Re: [PATCH v5 5/5] PCI: mediatek: add support for Airoha AN7583 SoC
Date: Mon, 20 Oct 2025 13:03:57 +0200 [thread overview]
Message-ID: <68f61725.050a0220.343129.f1f0@mx.google.com> (raw)
In-Reply-To: <hjyhso2sqgyq4ymzqg6pmjfrfncla24zwsev2mfinolmclm3ih@sol2yoapbykq>
On Sun, Oct 19, 2025 at 01:01:44PM +0530, Manivannan Sadhasivam wrote:
> On Sun, Oct 12, 2025 at 10:56:59PM +0200, Christian Marangi wrote:
> > Add support for the second PCIe Root Complex present on Airoha AN7583
> > SoC.
> >
> > This is based on the Mediatek Gen1/2 PCIe driver and similar to Gen3
> > also require workaround for the reset signals.
> >
> > Introduce a new flag to skip having to reset signals and also introduce
> > some additional logic to configure the PBUS registers required for
> > Airoha SoC.
> >
> > While at it, also add additional info on the PERST# Signal delay
> > comments and use dedicated macro.
> >
>
> This belongs to a separate patch which should come before this one.
>
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > drivers/pci/controller/pcie-mediatek.c | 92 ++++++++++++++++++++------
> > 1 file changed, 70 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
> > index 1678461e56d3..3340c005da4b 100644
> > --- a/drivers/pci/controller/pcie-mediatek.c
> > +++ b/drivers/pci/controller/pcie-mediatek.c
> > @@ -148,6 +148,7 @@ enum mtk_pcie_flags {
> > NO_MSI = BIT(2), /* Bridge has no MSI support, and relies on an
> > * external block
> > */
> > + SKIP_PCIE_RSTB = BIT(3), /* Skip calling RSTB bits on PCIe probe */
> > };
> >
> > /**
> > @@ -684,28 +685,32 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port)
> > regmap_update_bits(pcie->cfg, PCIE_SYS_CFG_V2, val, val);
> > }
> >
> > - /* Assert all reset signals */
> > - writel(0, port->base + PCIE_RST_CTRL);
> > -
> > - /*
> > - * Enable PCIe link down reset, if link status changed from link up to
> > - * link down, this will reset MAC control registers and configuration
> > - * space.
> > - */
> > - writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL);
> > -
> > - /*
> > - * Described in PCIe CEM specification sections 2.2 (PERST# Signal) and
> > - * 2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# should
> > - * be delayed 100ms (TPVPERL) for the power and clock to become stable.
> > - */
> > - msleep(100);
> > -
> > - /* De-assert PHY, PE, PIPE, MAC and configuration reset */
> > - val = readl(port->base + PCIE_RST_CTRL);
> > - val |= PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB |
> > - PCIE_MAC_SRSTB | PCIE_CRSTB;
> > - writel(val, port->base + PCIE_RST_CTRL);
> > + if (!(soc->flags & SKIP_PCIE_RSTB)) {
> > + /* Assert all reset signals */
> > + writel(0, port->base + PCIE_RST_CTRL);
> > +
> > + /*
> > + * Enable PCIe link down reset, if link status changed from
> > + * link up to link down, this will reset MAC control registers
> > + * and configuration space.
> > + */
> > + writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL);
> > +
> > + /*
> > + * Described in PCIe CEM specification revision 3.0 sections
> > + * 2.2 (PERST# Signal) and 2.2.1 (Initial Power-Up (G3 to S0)).
> > + *
> > + * The deassertion of PERST# should be delayed 100ms (TPVPERL)
> > + * for the power and clock to become stable.
>
> You can drop the comments since PCIE_T_PVPERL_MS definition has them.
>
> > + */
> > + msleep(PCIE_T_PVPERL_MS);
> > +
> > + /* De-assert PHY, PE, PIPE, MAC and configuration reset */
> > + val = readl(port->base + PCIE_RST_CTRL);
> > + val |= PCIE_PHY_RSTB | PCIE_PERSTB | PCIE_PIPE_SRSTB |
> > + PCIE_MAC_SRSTB | PCIE_CRSTB;
> > + writel(val, port->base + PCIE_RST_CTRL);
>
> If PCIE_LINKDOWN_RST_EN corresponds to PERST# signal, then it should be
> deasserted only after the power and REFCLK are stable. But I'm not sure what the
> above PCIE_RST_CTRL setting is doing. If it somehow affects either power or
> REFCLK, then it should come before PCIE_LINKDOWN_RST_EN.
>
Hi I checked MT7622 programming guide for this.
The order of operation for reset is exactly what you have described.
Indded, first everything is reset (assert all signals) then we set
PCIE_LINKDOWN_RST_EN that in unrelated. We wait for clock stabilization
with the msleep and only AFTER we deassert the PCIE_PERSTB.
So no, PCIE_LINKDOWN_RST_EN is not PERST# signal sw but it's actually
PCIE_PERSTB.
>
> --
> மணிவண்ணன் சதாசிவம்
--
Ansuel
next prev parent reply other threads:[~2025-10-20 11:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-12 20:56 [PATCH v5 0/5] PCI: mediatek: add support AN7583 + YAML rework Christian Marangi
2025-10-12 20:56 ` [PATCH v5 1/5] ARM: dts: mediatek: drop wrong syscon hifsys compatible for MT2701/7623 Christian Marangi
2025-10-12 20:56 ` [PATCH v5 2/5] dt-bindings: PCI: mediatek: Convert to YAML schema Christian Marangi
2025-10-15 13:59 ` Rob Herring (Arm)
2025-10-12 20:56 ` [PATCH v5 3/5] dt-bindings: PCI: mediatek: Add support for Airoha AN7583 Christian Marangi
2025-10-15 14:00 ` Rob Herring (Arm)
2025-10-12 20:56 ` [PATCH v5 4/5] PCI: mediatek: convert bool to single flags entry and bitmap Christian Marangi
2025-10-14 11:46 ` AngeloGioacchino Del Regno
2025-10-19 7:20 ` Manivannan Sadhasivam
2025-10-12 20:56 ` [PATCH v5 5/5] PCI: mediatek: add support for Airoha AN7583 SoC Christian Marangi
2025-10-19 7:31 ` Manivannan Sadhasivam
2025-10-20 11:03 ` Christian Marangi [this message]
2025-10-14 11:47 ` (subset) [PATCH v5 0/5] PCI: mediatek: add support AN7583 + YAML rework AngeloGioacchino Del Regno
2025-10-15 16:50 ` 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=68f61725.050a0220.343129.f1f0@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jianjun.wang@mediatek.com \
--cc=krzk+dt@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.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).