From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
magnus.damm@gmail.com, linux-renesas-soc@vger.kernel.org,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH v2 08/10] clk: renesas: rzg2l-cpg: Add suspend/resume support for power domains
Date: Wed, 10 Apr 2024 13:31:35 +0300 [thread overview]
Message-ID: <00b6c73b-d57f-4520-b1af-d2ad2a88240d@tuxon.dev> (raw)
In-Reply-To: <CAMuHMdVdn9K1gKJAKyyDz8ObaJboknE_qqYfS_vyxNU+zhRWPA@mail.gmail.com>
Hi, Geert,
Sorry for replying that late to this one.
On 18.03.2024 18:48, Geert Uytterhoeven wrote:
> Hi Claudiu,
>
> On Thu, Mar 7, 2024 at 3:07 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> RZ/G3S supports deep sleep states that it can reach with the help of the
>> TF-A.
>>
>> RZ/G3S has a few power domains (e.g. GIC) that need to be always-on while
>> Linux is running. These domains are initialized (and powered on) when
>> clock driver is probed.
>>
>> As the TF-A takes control at the very last(suspend)/first(resume)
>> phase of configuring the deep sleep state, it can do it's own settings on
>> power domains.
>>
>> Thus, to restore the proper Linux state, add rzg2l_cpg_resume() which
>> powers on the always-on domains and rzg2l_cpg_complete() which activates
>> the power down mode for the IPs selected through CPG_PWRDN_IP{1, 2}.
>>
>> Along with it, added the suspend_check member to the RZ/G2L power domain
>> data structure whose purpose is to checks if a domain can be powered off
>> while the system is going to suspend. This is necessary for the serial
>> console domain which needs to be powered on if no_console_suspend is
>> available in bootargs.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>> ---
>>
>> Changes in v2:
>> - none; this patch is new
>
> Thanks for your patch!
>
>> --- a/drivers/clk/renesas/rzg2l-cpg.c
>> +++ b/drivers/clk/renesas/rzg2l-cpg.c
>> @@ -1700,6 +1719,8 @@ static int __init rzg2l_cpg_pd_setup(struct rzg2l_cpg_pd *pd, bool always_on)
>> } else {
>> pd->genpd.power_on = rzg2l_cpg_power_on;
>> pd->genpd.power_off = rzg2l_cpg_power_off;
>> + if (flags & RZG2L_PD_F_CONSOLE)
>
> I think this should be replaced by some dynamic check, cfr. my comments
> on PATCH 9/10.
I agree.
>
>> + pd->suspend_check = rzg2l_pd_suspend_check_console;
>> governor = &simple_qos_governor;
>> }
>>
>
>> @@ -1890,9 +1911,43 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev)
>> if (error)
>> return error;
>>
>> + dev_set_drvdata(dev, priv);
>> +
>> return 0;
>> }
>>
>> +static int rzg2l_cpg_resume(struct device *dev)
>> +{
>> + struct rzg2l_cpg_priv *priv = dev_get_drvdata(dev);
>> + const struct rzg2l_cpg_info *info = priv->info;
>> +
>> + /* Power on always ON domains. */
>> + for (unsigned int i = 0; i < info->num_pm_domains; i++) {
>> + if (info->pm_domains[i].flags & RZG2L_PD_F_ALWAYS_ON) {
>
> If you would check "priv-domains[i].flags & GENPD_FLAG_ALWAYS_ON"
> instead, I think you can make r9a08g045_pm_domains[] __initconst.
> You may need to make a copy of the name for pd->genpd.name, though.
I wanted to avoid this copy.
>
>> + int ret = rzg2l_cpg_power_on(priv->domains[i]);
>
> I assume you are sure none of these domains are enabled by TF/A after
> system resume, or by the pmdomain core code?
Out of TF-A the MSTOP and PWRDN bits for these ones are set and setting
CPG_PWRDN_MSTOP though rzg2l_cpg_complete() leads to system being blocked.
It is the same as in booting case exlained in cover letter.
"the DDR, TZCDDR, OTFDE_DDR were also added, to avoid system being blocked
due to the following lines of code from patch 6/10.
+ /* Prepare for power down the BUSes in power down mode. */
+ if (info->pm_domain_pwrdn_mstop)
+ writel(CPG_PWRDN_MSTOP_ENABLE, priv->base + CPG_PWRDN_MSTOP);
Domain IDs were added to all SoC specific bindings.
"
The PM domain core code doesn't touch these domains while resuming as of my
checkings.
Thank you,
Claudiu Beznea
>
> Gr{oetje,eeting}s,
>
> Geert
>
next prev parent reply other threads:[~2024-04-10 10:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 14:07 [PATCH v2 00/10] clk: renesas: rzg2l: Add support for power domains Claudiu
2024-03-07 14:07 ` [PATCH v2 01/10] dt-bindings: clock: r9a07g043-cpg: Add power domain IDs Claudiu
2024-03-11 15:04 ` Rob Herring
2024-03-14 15:58 ` Geert Uytterhoeven
2024-03-07 14:07 ` [PATCH v2 02/10] dt-bindings: clock: r9a07g044-cpg: " Claudiu
2024-03-11 15:04 ` Rob Herring
2024-03-07 14:07 ` [PATCH v2 03/10] dt-bindings: clock: r9a07g054-cpg: " Claudiu
2024-03-11 15:04 ` Rob Herring
2024-03-07 14:07 ` [PATCH v2 04/10] dt-bindings: clock: r9a08g045-cpg: " Claudiu
2024-03-11 15:04 ` Rob Herring
2024-03-07 14:07 ` [PATCH v2 05/10] dt-bindings: clock: renesas,rzg2l-cpg: Update #power-domain-cells = <1> for RZ/G3S Claudiu
2024-03-07 22:19 ` Rob Herring
2024-03-14 15:59 ` Geert Uytterhoeven
2024-03-07 14:07 ` [PATCH v2 06/10] clk: renesas: rzg2l: Extend power domain support Claudiu
2024-03-14 15:59 ` Geert Uytterhoeven
2024-03-07 14:07 ` [PATCH v2 07/10] clk: renesas: r9a08g045: Add support for power domains Claudiu
2024-03-14 16:01 ` Geert Uytterhoeven
2024-04-10 10:32 ` claudiu beznea
2024-03-07 14:07 ` [PATCH v2 08/10] clk: renesas: rzg2l-cpg: Add suspend/resume " Claudiu
2024-03-18 16:48 ` Geert Uytterhoeven
2024-04-10 10:31 ` claudiu beznea [this message]
2024-04-16 12:07 ` Ulf Hansson
2024-04-17 8:04 ` claudiu beznea
2024-04-17 9:39 ` Ulf Hansson
2024-04-17 11:31 ` claudiu beznea
2024-03-07 14:07 ` [PATCH v2 09/10] clk: renesas: r9a08g045: Add the RZG2L_PD_F_CONSOLE flag to scif0 PM domain Claudiu
2024-03-14 16:06 ` Geert Uytterhoeven
2024-03-15 5:45 ` claudiu beznea
2024-03-07 14:07 ` [PATCH v2 10/10] arm64: dts: renesas: r9a08g045: Update #power-domain-cells = <1> Claudiu
2024-03-14 16:01 ` Geert Uytterhoeven
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=00b6c73b-d57f-4520-b1af-d2ad2a88240d@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@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