From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, p.zabel@pengutronix.de,
yoshihiro.shimoda.uh@renesas.com,
wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com,
prabhakar.mahadev-lad.rj@bp.renesas.com,
sergei.shtylyov@cogentembedded.com,
mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 08/13] net: ravb: Rely on PM domain to enable refclk
Date: Thu, 23 Nov 2023 19:10:17 +0200 [thread overview]
Message-ID: <a9760bbb-d06d-4914-b0d1-48a224f74858@tuxon.dev> (raw)
In-Reply-To: <CAMuHMdV=2_h2PW9K7zT3Hwqjdk6D2m_Dd09bqHtifAvVTM7Lrw@mail.gmail.com>
Hi, Geert,
On 23.11.2023 10:48, Geert Uytterhoeven wrote:
> Hi Claudiu,
>
> Thanks for your patch (which seems to have been delayed by 3 days, ouch)!
>
> On Thu, Nov 23, 2023 at 5:35 AM Claudiu <claudiu.beznea@tuxon.dev> wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> For RZ/G3S and RZ/G2L SoCs the Ethernet's reference clock is part of the
>> Ethernet's power domain. It is controlled though CPG driver that is
>> providing the support for power domain that Ethernet belongs. Thus,
>> to be able to implement runtime PM (at least for RZ/G3S at the moment)
>
> Why only for RZ/G3S?
(I'm copy pasting here what I already replied to Sergey)
The reasons I've limited only to RZ/G3S are:
1/ I don't have all the platforms to test it
2/ on G1H this doesn't work. I tried to debugged it but I don't have a
platform at hand, only remotely, and is hardly to debug once the
ethernet fails to work: probe is working(), open is executed, PHY is
initialized and then TX/RX is not working... don't know why ATM.
>
>> w/o the need to add clock enable/disable specific calls in runtime PM
>> ops of ravb driver and interfere with other IP specific implementations,
>> add a new variable to struct_hw_info and enable the reference clock
>> based on the value of this variable (the variable states if reference
>> clock is part of the Ethernet's power domain).
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
>> --- a/drivers/net/ethernet/renesas/ravb.h
>> +++ b/drivers/net/ethernet/renesas/ravb.h
>> @@ -1043,6 +1043,7 @@ struct ravb_hw_info {
>> unsigned nc_queues:1; /* AVB-DMAC has RX and TX NC queues */
>> unsigned magic_pkt:1; /* E-MAC supports magic packet detection */
>> unsigned half_duplex:1; /* E-MAC supports half duplex mode */
>> + unsigned refclk_in_pd:1; /* Reference clock is part of a power domain. */
>> };
>>
>> struct ravb_private {
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>> index 836fdb4b3bfd..ddd8cd2c0f89 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -2502,6 +2502,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
>> .tx_counters = 1,
>> .carrier_counters = 1,
>> .half_duplex = 1,
>> + .refclk_in_pd = 1,
>> };
>>
>> static const struct of_device_id ravb_match_table[] = {
>> @@ -2749,12 +2750,14 @@ static int ravb_probe(struct platform_device *pdev)
>> goto out_release;
>> }
>>
>> - priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk");
>> - if (IS_ERR(priv->refclk)) {
>> - error = PTR_ERR(priv->refclk);
>> - goto out_release;
>> + if (!info->refclk_in_pd) {
>> + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk");
>> + if (IS_ERR(priv->refclk)) {
>> + error = PTR_ERR(priv->refclk);
>> + goto out_release;
>> + }
>> + clk_prepare_enable(priv->refclk);
>> }
>> - clk_prepare_enable(priv->refclk);
>
> Is this patch really needed? It doesn't hurt to manually enable a
> clock that is also under Runtime PM control. Clock prepare/enable
> refcounting will take care of that.
I agree with that. I chose this path to not interfere w/ the comments
ravb_runtime_nop() which I didn't understand. Also I fail to understand why
the ravb_runtime_nop() is there...
>
>>
>> if (info->gptp_ref_clk) {
>> priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp");
>> @@ -2869,7 +2872,8 @@ static int ravb_probe(struct platform_device *pdev)
>> if (info->ccc_gac)
>> ravb_ptp_stop(ndev);
>> out_disable_refclk:
>> - clk_disable_unprepare(priv->refclk);
>> + if (!info->refclk_in_pd)
>> + clk_disable_unprepare(priv->refclk);
>> out_release:
>> free_netdev(ndev);
>> pm_runtime_put:
>> @@ -2890,7 +2894,8 @@ static void ravb_remove(struct platform_device *pdev)
>> if (info->ccc_gac)
>> ravb_ptp_stop(ndev);
>>
>> - clk_disable_unprepare(priv->refclk);
>> + if (!info->refclk_in_pd)
>> + clk_disable_unprepare(priv->refclk);
>>
>> /* Set reset mode */
>> ravb_write(ndev, CCC_OPC_RESET, CCC);
>
> Gr{oetje,eeting}s,
>
> Geert
>
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
next prev parent reply other threads:[~2023-11-23 17:10 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 8:45 [PATCH 00/13] net: ravb: Add suspend to RAM and runtime PM support for RZ/G3S Claudiu
2023-11-20 8:45 ` [PATCH 01/13] net: ravb: Check return value of reset_control_deassert() Claudiu
2023-11-20 19:03 ` Sergey Shtylyov
2023-11-21 5:59 ` claudiu beznea
2023-11-24 19:04 ` Sergey Shtylyov
2023-11-20 8:45 ` [PATCH 02/13] net: ravb: Use pm_runtime_resume_and_get() Claudiu
2023-11-20 19:23 ` Sergey Shtylyov
2023-11-21 5:57 ` claudiu beznea
2023-11-24 19:02 ` Sergey Shtylyov
2023-11-20 8:45 ` [PATCH 03/13] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Claudiu
2023-11-20 19:44 ` Sergey Shtylyov
2023-11-21 6:02 ` claudiu beznea
2023-11-23 19:30 ` Sergey Shtylyov
2023-11-20 8:45 ` [PATCH 04/13] net: ravb: Start TX queues after HW initialization succeeded Claudiu
2023-11-20 19:49 ` Sergey Shtylyov
2023-11-20 8:45 ` [PATCH 05/13] net: ravb: Stop DMA in case of failures on ravb_open() Claudiu
2023-11-20 20:01 ` Sergey Shtylyov
2023-11-20 8:45 ` [PATCH 06/13] net: ravb: Let IP specific receive function to interrogate descriptors Claudiu
2023-11-23 16:37 ` Sergey Shtylyov
2023-11-23 16:48 ` Biju Das
2023-11-23 16:54 ` Sergey Shtylyov
2023-11-23 17:02 ` Biju Das
2023-11-23 17:15 ` claudiu beznea
2023-11-24 17:27 ` Sergey Shtylyov
2023-11-20 8:46 ` [PATCH 07/13] net: ravb: Rely on PM domain to enable gptp_clk Claudiu
2023-11-22 16:59 ` Sergey Shtylyov
2023-11-20 8:46 ` [PATCH 08/13] net: ravb: Rely on PM domain to enable refclk Claudiu
2023-11-22 17:31 ` Sergey Shtylyov
2023-11-23 8:48 ` Geert Uytterhoeven
2023-11-23 17:10 ` claudiu beznea [this message]
2023-11-23 19:26 ` Sergey Shtylyov
2023-11-20 8:46 ` [PATCH 09/13] net: ravb: Make reset controller support mandatory Claudiu
2023-11-21 18:46 ` Sergey Shtylyov
2023-11-24 8:07 ` Geert Uytterhoeven
2023-11-20 8:46 ` [PATCH 10/13] net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
2023-11-21 20:29 ` Sergey Shtylyov
2023-12-06 11:36 ` Geert Uytterhoeven
2023-11-20 8:46 ` [PATCH 11/13] net: ravb: Use tabs instead of spaces Claudiu
2023-11-21 18:43 ` Sergey Shtylyov
2023-11-20 8:46 ` [PATCH 12/13] net: ravb: Assert/deassert reset on suspend/resume Claudiu
2023-11-21 19:13 ` Sergey Shtylyov
2023-11-22 16:41 ` Sergey Shtylyov
2023-11-20 8:46 ` [PATCH 13/13] net: ravb: Add runtime PM support Claudiu
2023-11-22 16:25 ` Sergey Shtylyov
2023-11-23 17:04 ` claudiu beznea
2023-11-23 19:19 ` Sergey Shtylyov
2023-11-24 18:03 ` claudiu beznea
2023-11-27 14:05 ` Geert Uytterhoeven
2023-11-27 14:46 ` claudiu beznea
2023-11-28 9:23 ` claudiu beznea
2023-11-27 19:01 ` Sergey Shtylyov
2023-11-30 17:35 ` Simon Horman
2023-11-20 20:48 ` [PATCH 00/13] net: ravb: Add suspend to RAM and runtime PM support for RZ/G3S Sergey Shtylyov
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=a9760bbb-d06d-4914-b0d1-48a224f74858@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=masaru.nagai.vx@renesas.com \
--cc=mitsuhiro.kimura.kc@renesas.com \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=s.shtylyov@omp.ru \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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).