Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp192167rdh; Thu, 23 Nov 2023 00:49:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHP+6fQ0UHHiG7RY+oxUviJRRGjDJ+p3JRwa8Kqq9aHx+a1tEuEStRBYqTFO/ZAI3ZL1A3V X-Received: by 2002:a05:6808:14cf:b0:3ae:2b43:dd47 with SMTP id f15-20020a05680814cf00b003ae2b43dd47mr6165524oiw.22.1700729365644; Thu, 23 Nov 2023 00:49:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700729365; cv=none; d=google.com; s=arc-20160816; b=gNWL0aBKBdr+NGHMvy9dNZS5R6CKnomZ3auEs9f5cu3nyt8dxE7nGBHaJkLHK18D4s PtmQK4W35EzmT33OzeUCYBw+H1vz4a3p51N6BJ+G1GsYEAtGqLq6daIljCWTvx3xSgWu WFAJ4C34qm/IbciNivV4F2lLfrJUpFNGvRStAuwVvifxkmWAQQZMx770+MFMIKR+WLWr zkSadrCxNHwpB70Xx5EWrpORmmomxzcA99h03c9ax23oGFkbIPXuyFcwYZZFJvv1HPQ4 43ULq07+PMqcjAcXhRQg8caahsUfnrzwbmZZae566uv2RdNm9aX8H9Yp3wBBA8fLEWFj FvuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=wFwa7sugfg4/yVXhdOMWVFPhIlJqJajDlmclwxbwNa8=; fh=esgUc2XB/RhjY60lCr5rFo+hql2R8rq8ldDfNon1sAQ=; b=wwNTevUbxN+fJBS/l3s68cRpLGLwp5q+6fcUsN03xWukztzISPbr/eSxZ81nb8VF40 gzSDsrVtEpwYKLkgAjHPNqI496oCuwoFHMNGlTmMLYF6Cn5steXzhztJLfa3RRBwJVFn xrT1LuCZnUkjpq4w7wycbysaT9EzKSPJguFdQL6BpCfJTwRm891RcDFacu0k+giaHLLv bVAoN78o8YWbCsCTDBm2onIFr31xm0a2Nymvdp5hk1jxC9CYQk1c9cXnx6FbijSNIJul ajODf1WL3bNfK5mCFHeeHDHH79ClGputAqACXIPtfJsTaUAsChHlSxNCtCMHkVrE9+CG wXJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h27-20020a63531b000000b005c179c0075dsi871134pgb.883.2023.11.23.00.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:49:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4BAC98250267; Thu, 23 Nov 2023 00:49:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235204AbjKWItJ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 23 Nov 2023 03:49:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235364AbjKWIsz (ORCPT ); Thu, 23 Nov 2023 03:48:55 -0500 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D7410F1; Thu, 23 Nov 2023 00:48:37 -0800 (PST) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-5cca8b559b3so6406287b3.0; Thu, 23 Nov 2023 00:48:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700729317; x=1701334117; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=by70aOFOUFhdqOrGLgCt75M9J4tcctz7/cOLhtXw5mU=; b=lXzPxZtVuvJrSuES03OyPnm9QhB6d6thXcwq3c1e0LYE45DzMUwjofnzpgkdSiotGv /KKcXmFiNG9tNjVPTCjp2JLu+wY7vQeEgBk3hz7Ktk/McfN8CsJWl13UlEgOrN30rk4b qecS4uV+lyDaFiCmaXbqvIn6JGIaSUMbKOgHR7Z2xxLCZd3+uXMeXL5y8M27eztHglQT uRM7//6hHLQtcOZ2beWI0r/MXPrW6gc45ub1RnbsyS21sUCkQ4vIML78RX0BfnzGJE6x pkMwIj/Rv2TKhdub1eRljm2FSkJq+pbym0IlPtPQIKknp1gQIIY2yZyU/jG++d5n8Afg u4Bg== X-Gm-Message-State: AOJu0YxAl/TK17K90/MdJYyNY/yFNZkAw4u+l+LKhI5q9cc62O9JFP56 QDYx2vJmHi2X19MfiHmYS5f4yMm9TsfwfA== X-Received: by 2002:a25:6b06:0:b0:d9a:cd62:410c with SMTP id g6-20020a256b06000000b00d9acd62410cmr4853893ybc.4.1700729316791; Thu, 23 Nov 2023 00:48:36 -0800 (PST) Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com. [209.85.128.177]) by smtp.gmail.com with ESMTPSA id e71-20020a25d34a000000b00da076458395sm214481ybf.43.2023.11.23.00.48.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Nov 2023 00:48:36 -0800 (PST) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-5cc69df1b9aso6181697b3.3; Thu, 23 Nov 2023 00:48:36 -0800 (PST) X-Received: by 2002:a0d:ca90:0:b0:5ca:7a21:7e22 with SMTP id m138-20020a0dca90000000b005ca7a217e22mr5419324ywd.9.1700729315801; Thu, 23 Nov 2023 00:48:35 -0800 (PST) MIME-Version: 1.0 References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> <20231120084606.4083194-9-claudiu.beznea.uj@bp.renesas.com> In-Reply-To: <20231120084606.4083194-9-claudiu.beznea.uj@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 23 Nov 2023 09:48:22 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/13] net: ravb: Rely on PM domain to enable refclk To: Claudiu 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 23 Nov 2023 00:49:23 -0800 (PST) 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 wrote: > From: Claudiu Beznea > > 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? > 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 > --- 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. > > 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