From: Vitor Soares <vitor.soares(a)toradex.com>
During the probe, the genpd power_dev is added to the dpm_list after
blk_ctrl due to its parent/child relationship. Making the blk_ctrl
suspend after and resume before the genpd power_dev.
As a consequence, the system hangs when resuming the VPU due to the
power domain dependency.
To ensure the proper suspend/resume order, add a device link betweem
blk_ctrl and genpd power_dev. It guarantees genpd power_dev is suspended
after and resumed before blk-ctrl.
Cc: <stable(a)vger.kernel.org>
Closes: https://lore.kernel.org/all/fccbb040330a706a4f7b34875db1d896a0bf81c8.camel@…
Link: https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.com/
Fixes: 2684ac05a8c4 ("soc: imx: add i.MX8M blk-ctrl driver")
Suggested-by: Lucas Stach <l.stach(a)pengutronix.de>
Signed-off-by: Vitor Soares <vitor.soares(a)toradex.com>
---
This is a new patch, but is a follow-up of:
https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.com/
As suggested by Lucas, we are addressing this PM issue in the imx8m-blk-ctrl
driver instead of in the imx8mm.dtsi.
drivers/pmdomain/imx/imx8m-blk-ctrl.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx/imx8m-blk-ctrl.c
index ca942d7929c2..cd0d2296080d 100644
--- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c
+++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c
@@ -283,6 +283,20 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
goto cleanup_pds;
}
+ /*
+ * Enforce suspend/resume ordering by making genpd power_dev a
+ * provider of blk-ctrl. Genpd power_dev is suspended after and
+ * resumed before blk-ctrl.
+ */
+ if (!device_link_add(dev, domain->power_dev, DL_FLAG_STATELESS)) {
+ ret = -EINVAL;
+ dev_err_probe(dev, ret,
+ "failed to link to %s\n", data->name);
+ pm_genpd_remove(&domain->genpd);
+ dev_pm_domain_detach(domain->power_dev, true);
+ goto cleanup_pds;
+ }
+
/*
* We use runtime PM to trigger power on/off of the upstream GPC
* domain, as a strict hierarchical parent/child power domain
@@ -324,6 +338,7 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
of_genpd_del_provider(dev->of_node);
cleanup_pds:
for (i--; i >= 0; i--) {
+ device_link_remove(dev, bc->domains[i].power_dev);
pm_genpd_remove(&bc->domains[i].genpd);
dev_pm_domain_detach(bc->domains[i].power_dev, true);
}
@@ -343,6 +358,7 @@ static void imx8m_blk_ctrl_remove(struct platform_device *pdev)
for (i = 0; bc->onecell_data.num_domains; i++) {
struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
+ device_link_remove(&pdev->dev, domain->power_dev);
pm_genpd_remove(&domain->genpd);
dev_pm_domain_detach(domain->power_dev, true);
}
--
2.34.1
On 2024-06-24 19:01, gregkh(a)linuxfoundation.org wrote:
> This is a note to let you know that I've just added the patch titled
>
> MIPS: pci: lantiq: restore reset gpio polarity
>
> to the 6.9-stable tree which can be found at:
>
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
>
> The filename of the patch is:
> mips-pci-lantiq-restore-reset-gpio-polarity.patch
> and it can be found in the queue-6.9 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable
> tree,
> please let <stable(a)vger.kernel.org> know about it.
This patch is buggy and should not go into the stable trees.
It has already been reverted upstream in the mips-fixes.
Thank you very much and sorry for the inconvenience,
Martin
>
>
> From 277a0363120276645ae598d8d5fea7265e076ae9 Mon Sep 17 00:00:00 2001
> From: Martin Schiller <ms(a)dev.tdt.de>
> Date: Fri, 7 Jun 2024 11:04:00 +0200
> Subject: MIPS: pci: lantiq: restore reset gpio polarity
>
> From: Martin Schiller <ms(a)dev.tdt.de>
>
> commit 277a0363120276645ae598d8d5fea7265e076ae9 upstream.
>
> Commit 90c2d2eb7ab5 ("MIPS: pci: lantiq: switch to using gpiod API")
> not
> only switched to the gpiod API, but also inverted / changed the
> polarity
> of the GPIO.
>
> According to the PCI specification, the RST# pin is an active-low
> signal. However, most of the device trees that have been widely used
> for
> a long time (mainly in the openWrt project) define this GPIO as
> active-high and the old driver code inverted the signal internally.
>
> Apparently there are actually boards where the reset gpio must be
> operated inverted. For this reason, we cannot use the
> GPIOD_OUT_LOW/HIGH
> flag for initialization. Instead, we must explicitly set the gpio to
> value 1 in order to take into account any "GPIO_ACTIVE_LOW" flag that
> may have been set.
>
> In order to remain compatible with all these existing device trees, we
> should therefore keep the logic as it was before the commit.
>
> Fixes: 90c2d2eb7ab5 ("MIPS: pci: lantiq: switch to using gpiod API")
> Cc: stable(a)vger.kernel.org
> Signed-off-by: Martin Schiller <ms(a)dev.tdt.de>
> Signed-off-by: Thomas Bogendoerfer <tsbogend(a)alpha.franken.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
> ---
> arch/mips/pci/pci-lantiq.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> --- a/arch/mips/pci/pci-lantiq.c
> +++ b/arch/mips/pci/pci-lantiq.c
> @@ -124,14 +124,14 @@ static int ltq_pci_startup(struct platfo
> clk_disable(clk_external);
>
> /* setup reset gpio used by pci */
> - reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
> - GPIOD_OUT_LOW);
> + reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
> GPIOD_ASIS);
> error = PTR_ERR_OR_ZERO(reset_gpio);
> if (error) {
> dev_err(&pdev->dev, "failed to request gpio: %d\n", error);
> return error;
> }
> gpiod_set_consumer_name(reset_gpio, "pci_reset");
> + gpiod_direction_output(reset_gpio, 1);
>
> /* enable auto-switching between PCI and EBU */
> ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
> @@ -194,10 +194,10 @@ static int ltq_pci_startup(struct platfo
>
> /* toggle reset pin */
> if (reset_gpio) {
> - gpiod_set_value_cansleep(reset_gpio, 1);
> + gpiod_set_value_cansleep(reset_gpio, 0);
> wmb();
> mdelay(1);
> - gpiod_set_value_cansleep(reset_gpio, 0);
> + gpiod_set_value_cansleep(reset_gpio, 1);
> }
> return 0;
> }
>
>
> Patches currently in stable-queue which might be from ms(a)dev.tdt.de are
>
> queue-6.9/mips-pci-lantiq-restore-reset-gpio-polarity.patch
On Mon, Jun 24, 2024 at 11:30:42PM -0400, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
>
> arm64: dts: qcom: qcs404: fix bluetooth device address
>
> to the 5.4-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
> commit a48b0e85558565dc3a10c8021b1514099cada102
> Author: Johan Hovold <johan+linaro(a)kernel.org>
> Date: Wed May 1 09:52:01 2024 +0200
>
> arm64: dts: qcom: qcs404: fix bluetooth device address
>
> [ Upstream commit f5f390a77f18eaeb2c93211a1b7c5e66b5acd423 ]
>
> The 'local-bd-address' property is used to pass a unique Bluetooth
> device address from the boot firmware to the kernel and should otherwise
> be left unset so that the OS can prevent the controller from being used
> until a valid address has been provided through some other means (e.g.
> using btmgmt).
>
> Fixes: 60f77ae7d1c1 ("arm64: dts: qcom: qcs404-evb: Enable uart3 and add Bluetooth")
> Cc: stable(a)vger.kernel.org # 5.10
This was supposed to say 5.2. Thanks for catching this.
Johan