From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>, Marek Vasut <marex@denx.de>,
patchwork-lst@pengutronix.de,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] soc: imx: gpcv2: prepare bus clocks early
Date: Mon, 5 Jun 2023 10:06:39 +0200 [thread overview]
Message-ID: <20230605100639.54d77ac5@booty> (raw)
In-Reply-To: <20230602185417.4098937-2-l.stach@pengutronix.de>
Hi Lucas,
On Fri, 2 Jun 2023 20:54:17 +0200
Lucas Stach <l.stach@pengutronix.de> wrote:
> Prepare the bus clocks during PGC domain driver probe. This avoids a
> potential deadlock when there a clock providers inside the domain,
> as this might end up trying to take the CCF prepare_lock from two
> different contexts, when runtime PM is trying to resume the PGC domain
> for the clock provider. By keeping the bus clocks prepared as long as
> there is a PGC domain driver attached, we don't need to take the
> prepare_lock in the domain power up/down paths.
>
> We don't want to do this for regular reset clocks, as this might lead
> to some PLLs being kept prepared that could otherwise be shut down.
> For the bus clocks this isn't a concern, as all the bus clocks are
> derived from always-on system PLLs.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
...
> @@ -1343,10 +1355,19 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
> regmap_update_bits(domain->regmap, domain->regs->map,
> domain->bits.map, domain->bits.map);
>
> + if (domain->bus_clocks) {
> + ret = clk_bulk_prepare(domain->num_clks, domain->clks);
> + if (ret) {
> + dev_err(domain->dev,
> + "Failed to prepare domain's clocks\n");
> + goto out_domain_unmap;
> + }
> + }
> +
> ret = pm_genpd_init(&domain->genpd, NULL, true);
> if (ret) {
> dev_err(domain->dev, "Failed to init power domain\n");
> - goto out_domain_unmap;
> + goto out_disable_clocks;
> }
>
> if (IS_ENABLED(CONFIG_LOCKDEP) &&
> @@ -1364,6 +1385,9 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
>
> out_genpd_remove:
> pm_genpd_remove(&domain->genpd);
> +out_disable_clocks:
> + if (domain->bus_clocks)
> + clk_bulk_unprepare(domain->num_clks, domain->clks);
Shouldn't the label be "out_unprepare_clocks"?
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-06-05 8:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 18:54 [PATCH 1/2] soc: imx: gpcv2: rename keep_clocks to bus_clocks Lucas Stach
2023-06-02 18:54 ` [PATCH 2/2] soc: imx: gpcv2: prepare bus clocks early Lucas Stach
2023-06-02 19:12 ` Marek Vasut
2023-06-02 20:06 ` Lucas Stach
2023-06-05 7:15 ` Marco Felsch
2023-06-05 8:06 ` Luca Ceresoli [this message]
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=20230605100639.54d77ac5@booty \
--to=luca.ceresoli@bootlin.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=marex@denx.de \
--cc=patchwork-lst@pengutronix.de \
--cc=shawnguo@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).