From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Christian Marangi" <ansuelsmth@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Ryder Lee" <ryder.lee@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Jianjun Wang" <jianjun.wang@mediatek.com>,
linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/2] PCI: mediatek-gen3: Add 2-lanes mode support for Airoha AN7581
Date: Mon, 24 Aug 2026 16:52:43 +0200 [thread overview]
Message-ID: <f419c95ff3f97e25593557234d1b2276ba6cf453.camel@pengutronix.de> (raw)
In-Reply-To: <20260806165334.7328-3-ansuelsmth@gmail.com>
On Do, 2026-08-06 at 18:53 +0200, Christian Marangi wrote:
> The Airoha AN7581 SoC supports configuring the first PCIe0 lane to 2-lanes
> mode (x2 link) by bonding it with the second PCIe lane (PCIe1). This is
> done by configuring the PCIe MUX in the SCU register.
>
> To correctly configure PCIe0 in x2 link, define in DT the following
> additional properties:
>
> - additional reg, 'sec-pcie-mac' for the secondary PCIe.
> - PERSTOUT reset for both main and secondary PCIE0, called 'perstout' and
> 'sec-perstout'
> - 'airoha,scu' property to correctly configure the SCU register for the
> PCIe MUX
> - 'num-lanes' set to '2' to enable PCIe0 in x2 link
>
> In such configuration the EQ preset are configured to the same values.
>
> To permit correct configuration of the PCIe link, additional logic is added
> to assert and deassert the PERSTOUT resets. Support of these additional
> reset was introduced in Airoha clk driver with commit
> 6712f48eb3a1 ("clk: en7523: add support for dedicated PCIe PERSTOUT reset")
> and on backporting of this commit also the clk driver change will be
> needed.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/pci/controller/pcie-mediatek-gen3.c | 106 ++++++++++++++++----
> 1 file changed, 89 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c
> index b0accd828589..c8300c47374b 100644
> --- a/drivers/pci/controller/pcie-mediatek-gen3.c
> +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> @@ -32,6 +32,11 @@
>
> #include "../pci.h"
>
> +/* AN7581 SCU register */
> +#define SCU_PCIC 0x88
> +#define SCU_PCIC_PCIE_CTRL GENMASK(7, 0)
> +
> +/* PCIe register */
> #define PCIE_BASE_CFG_REG 0x14
> #define PCIE_BASE_CFG_SPEED GENMASK(15, 8)
>
> @@ -131,6 +136,7 @@
> #define PCIE_ATR_TLP_TYPE_IO PCIE_ATR_TLP_TYPE(2)
>
> #define MAX_NUM_PHY_RESETS 3
> +#define MAX_NUM_PERSTOUT_RESETS 2
>
> #define PCIE_MTK_RESET_TIME_US 10
>
> @@ -203,9 +209,11 @@ struct mtk_msi_set {
> struct mtk_gen3_pcie {
> struct device *dev;
> void __iomem *base;
> + void __iomem *sec_base;
> phys_addr_t reg_base;
> struct reset_control *mac_reset;
> struct reset_control_bulk_data phy_resets[MAX_NUM_PHY_RESETS];
> + struct reset_control_bulk_data perstout_resets[MAX_NUM_PERSTOUT_RESETS];
> struct phy *phy;
> struct clk_bulk_data *clks;
> int num_clks;
> @@ -928,6 +936,14 @@ static int mtk_pcie_parse_port(struct mtk_gen3_pcie *pcie)
> if (ret)
> return dev_err_probe(dev, ret, "failed to get PHY bulk reset\n");
>
> + pcie->perstout_resets[0].id = "perstout";
> + pcie->perstout_resets[1].id = "sec-perstout";
> +
> + ret = devm_reset_control_bulk_get_optional_exclusive(dev, MAX_NUM_PERSTOUT_RESETS,
> + pcie->perstout_resets);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to get PERSTOUT bulk reset\n");
"bulk" is a property of the API, not the reset controls. Maybe just
"failed to get PERSTOUT resets"?
> +
> pcie->mac_reset = devm_reset_control_get_optional_exclusive(dev, "mac");
> if (IS_ERR(pcie->mac_reset))
> return dev_err_probe(dev, PTR_ERR(pcie->mac_reset), "failed to get MAC reset\n");
[...]
> @@ -992,6 +1028,19 @@ static int mtk_pcie_en7581_power_up(struct mtk_gen3_pcie *pcie)
> size = lower_32_bits(resource_size(entry->res));
> regmap_write(pbus_regmap, args[1], GENMASK(31, __fls(size)));
>
> + /* Assert PERSTOUT for all relevant lanes */
> + err = reset_control_bulk_assert(MAX_NUM_PERSTOUT_RESETS,
> + pcie->perstout_resets);
Isn't there a possible error return before this? Should the PERSTOUT
resets be asserted in those error cases as well?
regards
Philipp
next prev parent reply other threads:[~2026-08-24 14:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 16:53 [PATCH v5 0/2] PCI: mediatek-gen3: Add 2-lanes mode support + clock Christian Marangi
2026-08-06 16:53 ` [PATCH v5 1/2] dt-bindings: PCI: mediatek-gen3: Split Airoha schema and document 2-lanes Christian Marangi
2026-08-06 16:53 ` [PATCH v5 2/2] PCI: mediatek-gen3: Add 2-lanes mode support for Airoha AN7581 Christian Marangi
2026-08-13 17:08 ` Bjorn Helgaas
2026-08-13 19:30 ` Christian Marangi
2026-08-15 6:16 ` Manivannan Sadhasivam
2026-08-15 11:04 ` Christian Marangi
2026-08-24 14:52 ` Philipp Zabel [this message]
2026-08-07 3:24 ` [PATCH v5 0/2] PCI: mediatek-gen3: Add 2-lanes mode support + clock Chen-Yu Tsai
2026-08-07 15:20 ` Bjorn Helgaas
2026-08-09 12:12 ` Christian Marangi (Ansuel)
2026-08-09 14:08 ` Benjamin Larsson
2026-08-09 14:14 ` Christian Marangi (Ansuel)
2026-08-09 15:27 ` Benjamin Larsson
2026-08-10 10:33 ` Chen-Yu Tsai
2026-08-10 10:55 ` Christian Marangi (Ansuel)
2026-08-11 19:43 ` Benjamin Larsson
2026-08-12 7:59 ` Chen-Yu Tsai
2026-08-13 5:21 ` Manivannan Sadhasivam
2026-08-14 22:36 ` Bjorn Helgaas
2026-08-21 20:36 ` Rob Herring
2026-08-21 21:44 ` 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=f419c95ff3f97e25593557234d1b2276ba6cf453.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--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=robh@kernel.org \
--cc=ryder.lee@mediatek.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