From: Rob Herring <robh@kernel.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: "Ryder Lee" <ryder.lee@mediatek.com>,
"Jianjun Wang" <jianjun.wang@mediatek.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@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-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, upstream@airoha.com
Subject: Re: [PATCH v3 4/4] PCI: mediatek: add support for Airoha AN7583 SoC
Date: Fri, 26 Sep 2025 16:32:02 -0500 [thread overview]
Message-ID: <20250926213202.GB1573360-robh@kernel.org> (raw)
In-Reply-To: <20250925162332.9794-5-ansuelsmth@gmail.com>
On Thu, Sep 25, 2025 at 06:23:18PM +0200, Christian Marangi wrote:
> Add support for the second PCIe line 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 bool to skip having to reset signals and also introduce
> some additional logic to configure the PBUS registers required for
> Airoha SoC.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/pci/controller/pcie-mediatek.c | 85 +++++++++++++++++++-------
> 1 file changed, 63 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
> index 24cc30a2ab6c..640d1f1a6478 100644
> --- a/drivers/pci/controller/pcie-mediatek.c
> +++ b/drivers/pci/controller/pcie-mediatek.c
> @@ -147,6 +147,7 @@ struct mtk_pcie_port;
> * @need_fix_class_id: whether this host's class ID needed to be fixed or not
> * @need_fix_device_id: whether this host's device ID needed to be fixed or not
> * @no_msi: Bridge has no MSI support, and relies on an external block
> + * @skip_pcie_rstb: Skip calling RSTB bits on PCIe probe
> * @device_id: device ID which this host need to be fixed
> * @ops: pointer to configuration access functions
> * @startup: pointer to controller setting functions
> @@ -156,6 +157,7 @@ struct mtk_pcie_soc {
> bool need_fix_class_id;
> bool need_fix_device_id;
> bool no_msi;
> + bool skip_pcie_rstb;
> unsigned int device_id;
> struct pci_ops *ops;
> int (*startup)(struct mtk_pcie_port *port);
> @@ -679,28 +681,30 @@ 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->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 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);
> + }
>
> /* Set up vendor ID and class code */
> if (soc->need_fix_class_id) {
> @@ -1105,6 +1109,33 @@ static int mtk_pcie_probe(struct platform_device *pdev)
> if (err)
> goto put_resources;
>
> + if (device_is_compatible(dev, "airoha,an7583-pcie")) {
This should check some match data flag rather than checking compatible
again. Otherwise this becomes device_is_compatible() ||
device_is_compatible() || device_is_compatible()...
Rob
next prev parent reply other threads:[~2025-09-26 21:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 16:23 [PATCH v3 0/4] PCI: mediatek: add support AN7583 + YAML rework Christian Marangi
2025-09-25 16:23 ` [PATCH v3 1/4] ARM: dts: mediatek: drop wrong syscon hifsys compatible for MT2701/7623 Christian Marangi
2025-09-26 20:53 ` Bjorn Helgaas
2025-09-29 10:10 ` AngeloGioacchino Del Regno
2025-09-25 16:23 ` [PATCH v3 2/4] dt-bindings: PCI: mediatek: Convert to YAML schema Christian Marangi
2025-09-26 13:09 ` Rob Herring (Arm)
2025-09-26 21:26 ` Rob Herring
2025-09-25 16:23 ` [PATCH v3 3/4] dt-bindings: PCI: mediatek: Add support for Airoha AN7583 Christian Marangi
2025-09-25 16:23 ` [PATCH v3 4/4] PCI: mediatek: add support for Airoha AN7583 SoC Christian Marangi
2025-09-26 20:53 ` Bjorn Helgaas
2025-09-26 21:32 ` Rob Herring [this message]
2025-09-29 10:12 ` AngeloGioacchino Del Regno
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=20250926213202.GB1573360-robh@kernel.org \
--to=robh@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ansuelsmth@gmail.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=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