diff options
author | Karel Kočí <cynerd@email.cz> | 2022-09-27 17:09:49 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-09-27 17:09:49 +0200 |
commit | 213042bba186b995bc2f25c8c2d06a9652177fa3 (patch) | |
tree | f8a12ada9ea2a95e400802e4a6451be7f1178ef7 /nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch | |
parent | ff1073d03d303d3b15e66d03dc4a5a479a387fa7 (diff) | |
download | nixturris-213042bba186b995bc2f25c8c2d06a9652177fa3.tar.gz nixturris-213042bba186b995bc2f25c8c2d06a9652177fa3.tar.bz2 nixturris-213042bba186b995bc2f25c8c2d06a9652177fa3.zip |
Import Turris OS kernel patches
Diffstat (limited to 'nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch')
-rw-r--r-- | nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch b/nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch new file mode 100644 index 0000000..d03de3c --- /dev/null +++ b/nixos/modules/kernel-patches/0024-PCI-aardvark-Add-suspend-to-RAM-support.patch @@ -0,0 +1,74 @@ +From ff0d91bd6cfdd3c27d75e631a6aaeb5b4eee4f1f Mon Sep 17 00:00:00 2001 +From: Miquel Raynal <miquel.raynal@bootlin.com> +Date: Wed, 31 Aug 2022 16:07:27 +0200 +Subject: [PATCH 24/96] PCI: aardvark: Add suspend to RAM support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add suspend and resume callbacks. We need to use the NOIRQ variants to +ensure the controller's IRQ handlers are not run during suspend() / +resume(), which could cause races. + +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 | 34 +++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c +index 84c1f3165472..a042bfe70d69 100644 +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -1907,6 +1907,39 @@ static int advk_pcie_setup_phy(struct advk_pcie *pcie) + return ret; + } + ++static int 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 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; ++} ++ ++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; +@@ -2184,6 +2217,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.37.2 + |