From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: "Marek Behún" <kabel@kernel.org>
Cc: "Bjorn Helgaas" <helgaas@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Marc Zyngier" <maz@kernel.org>,
pali@kernel.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
rafael@kernel.org
Subject: Re: [PATCH 16/18] PCI: aardvark: Add suspend to RAM support
Date: Tue, 12 Apr 2022 12:14:01 +0100 [thread overview]
Message-ID: <20220412111401.GA20749@lpieralisi> (raw)
In-Reply-To: <20220220193346.23789-17-kabel@kernel.org>
[+Rafael]
On Sun, Feb 20, 2022 at 08:33:44PM +0100, Marek Behún wrote:
> From: Miquel Raynal <miquel.raynal@bootlin.com>
>
> Add suspend and resume callbacks. The priority of these are
> "_noirq()", to workaround early access to the registers done by the
> PCI core through the ->read()/->write() callbacks at resume time.
This commit log should be rewritten to clarify it. IIUC, you are hooking
up the _noirq() callbacks to take advantage of callbacks ordering rather
than needing the IRQ disabled per-se.
Thread here:
https://lore.kernel.org/linux-pci/20220220193346.23789-17-kabel@kernel.org
I'd ask Rafael please if this is common practice or a workaround and
whether that's how it should be done.
Thanks,
Lorenzo
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
> drivers/pci/controller/pci-aardvark.c | 39 +++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 3b51f47abd72..8c9ac7766ac7 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -1896,6 +1896,44 @@ static int advk_pcie_setup_phy(struct advk_pcie *pcie)
> return ret;
> }
>
> +static int __maybe_unused advk_pcie_suspend(struct device *dev)
> +{
> + struct advk_pcie *pcie = dev_get_drvdata(dev);
> +
> + advk_pcie_disable_phy(pcie);
> +
> + clk_disable_unprepare(pcie->clk);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused advk_pcie_resume(struct device *dev)
> +{
> + struct advk_pcie *pcie = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = clk_prepare_enable(pcie->clk);
> + if (ret)
> + return ret;
> +
> + ret = advk_pcie_enable_phy(pcie);
> + if (ret)
> + return ret;
> +
> + advk_pcie_setup_hw(pcie);
> +
> + return 0;
> +}
> +
> +/*
> + * The PCI core will try to reconfigure the bus quite early in the resume path.
> + * We must use the _noirq() alternatives to ensure the controller is ready when
> + * the core uses the ->read()/->write() callbacks.
> + */
> +static const struct dev_pm_ops advk_pcie_dev_pm_ops = {
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(advk_pcie_suspend, advk_pcie_resume)
> +};
> +
> static int advk_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -2171,6 +2209,7 @@ static struct platform_driver advk_pcie_driver = {
> .driver = {
> .name = "advk-pcie",
> .of_match_table = advk_pcie_of_match_table,
> + .pm = &advk_pcie_dev_pm_ops,
> },
> .probe = advk_pcie_probe,
> .remove = advk_pcie_remove,
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-04-12 12:12 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-20 19:33 [PATCH 00/18] PCI: aardvark controller changes BATCH 5 Marek Behún
2022-02-20 19:33 ` [PATCH 01/18] PCI: pci-bridge-emul: Re-arrange register tests Marek Behún
2022-02-20 19:33 ` [PATCH 02/18] PCI: pci-bridge-emul: Add support for PCIe extended capabilities Marek Behún
2022-02-20 19:33 ` [PATCH 03/18] PCI: aardvark: Add support for AER registers on emulated bridge Marek Behún
2022-02-20 19:33 ` [PATCH 04/18] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros Marek Behún
2022-04-28 11:09 ` Lorenzo Pieralisi
2022-04-28 11:16 ` Pali Rohár
2022-05-18 19:23 ` Bjorn Helgaas
2022-05-18 19:26 ` Pali Rohár
2022-05-18 20:05 ` Marek Behún
2022-05-18 20:27 ` Bjorn Helgaas
2022-02-20 19:33 ` [PATCH 05/18] PCI: aardvark: Fix reporting Slot capabilities on emulated bridge Marek Behún
2022-02-20 19:33 ` [PATCH 06/18] PCI: pciehp: Enable DLLSC interrupt only if supported Marek Behún
2022-05-09 3:42 ` Lukas Wunner
2022-05-13 16:57 ` Pali Rohár
2022-05-14 9:14 ` Lukas Wunner
2022-08-18 12:22 ` Marek Behún
2022-02-20 19:33 ` [PATCH 07/18] PCI: pciehp: Enable Command Completed Interrupt " Marek Behún
2022-05-09 4:01 ` Lukas Wunner
2022-05-13 16:59 ` Pali Rohár
2022-02-20 19:33 ` [PATCH 08/18] PCI: aardvark: Add support for DLLSC and hotplug interrupt Marek Behún
2022-02-20 19:33 ` [PATCH 09/18] PCI: Add PCI_EXP_SLTCTL_ASPL_DISABLE macro Marek Behún
2022-02-20 19:33 ` [PATCH 10/18] PCI: Add function for parsing `slot-power-limit-milliwatt` DT property Marek Behún
2022-02-20 19:33 ` [PATCH 11/18] dt-bindings: PCI: aardvark: Describe slot-power-limit-milliwatt Marek Behún
2022-02-20 19:33 ` [PATCH 12/18] PCI: aardvark: Send Set_Slot_Power_Limit message Marek Behún
2022-02-20 19:33 ` [PATCH 13/18] arm64: dts: armada-3720-turris-mox: Define slot-power-limit-milliwatt for PCIe Marek Behún
2022-02-20 19:33 ` [PATCH 14/18] PCI: aardvark: Add clock support Marek Behún
2022-02-20 19:33 ` [PATCH 15/18] arm64: dts: marvell: armada-37xx: Add clock to PCIe node Marek Behún
2022-02-28 15:52 ` Gregory CLEMENT
2022-02-20 19:33 ` [PATCH 16/18] PCI: aardvark: Add suspend to RAM support Marek Behún
2022-04-12 11:14 ` Lorenzo Pieralisi [this message]
2022-02-20 19:33 ` [PATCH 17/18] PCI: aardvark: Run link training in separate worker Marek Behún
2022-04-12 15:25 ` Lorenzo Pieralisi
2022-04-12 17:55 ` Pali Rohár
2022-04-13 9:16 ` Lorenzo Pieralisi
2022-05-04 14:02 ` Marek Behún
2022-02-20 19:33 ` [PATCH 18/18] PCI: aardvark: Optimize PCIe card reset via GPIO Marek Behún
2022-04-11 15:36 ` [PATCH 00/18] PCI: aardvark controller changes BATCH 5 Lorenzo Pieralisi
2022-04-11 16:53 ` Pali Rohár
2022-05-13 10:33 ` Lorenzo Pieralisi
2022-05-13 16:48 ` Pali Rohár
2022-05-18 15:54 ` (subset) " Lorenzo Pieralisi
2022-08-16 16:25 ` Lorenzo Pieralisi
2022-08-18 13:56 ` Marek Behún
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=20220412111401.GA20749@lpieralisi \
--to=lorenzo.pieralisi@arm.com \
--cc=gregory.clement@bootlin.com \
--cc=helgaas@kernel.org \
--cc=kabel@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=maz@kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=pali@kernel.org \
--cc=rafael@kernel.org \
/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).