Message ID | 20231214114600.2451162-18-claudiu.beznea.uj@bp.renesas.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp667542dyi; Sun, 17 Dec 2023 04:02:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU17jfj0Abw21nJEQe61lICQP/oPg+2PnomR27mf4mGURlRfqSy5zOJWCd2RTZT3NgUOBx X-Received: by 2002:a05:6870:d256:b0:203:55da:51dd with SMTP id h22-20020a056870d25600b0020355da51ddmr5183414oac.101.1702814525018; Sun, 17 Dec 2023 04:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702814524; cv=none; d=google.com; s=arc-20160816; b=mPozfRM8y/5bpC+AFV21GeOQfIQpaSOQxMn/Yf5Hzg+Z8nUTD8/Smfs5JWb43B2hl2 1qULa8PqDQGlzkQLsNHG39T1+5ZnTDKVLaSgK46Nw3L7hzbQe0mIjhZl9ByrfDTeJLW8 oBYz6v3AO88y5g36DGnpZywmHKo/wkNH2+BpMpAkUpP1Au9Wjw02FUGzs007E9LeIU22 qfIFWxFMl2rU0apBQbeh01FaezxQcMHKTF8h8pPkndKDFTb9I4SEEc2YKlV1MCKyc6JZ 62mFONK6qmL4Fdj9RFdUC4x/j0II5OBn3kWvkcsrq+oUEXDAZUgR6Kni7qRpgKm/9ZEL Zj8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tYBn9/laLzrg7Vdv2MX/5C0b5odhy/gUWFCra0JFpOw=; fh=JRNH3R6BkbckLgmyv72Fq6g69IcAiTiL2Sp+o8fsz+8=; b=ZcpTXQWHDpZvZJVf5r6vwHwerluol/yTvcFsBA1ydeCYlTojhMPzfIh4t3UAlsOk2Z aR/MG1pcqLFCMRn2Vz6dtK+kph84jjBRdCqGfD+EcxJZzc7WL/ptDsqnvH+MiEytDePa 12hba6ePOYOnHNe8zuRleYImuh1XiA7rYHFTdzr783kym4fxmrJj0qEkqbQl+a/kvp7W QevbgCff5lPV2PVIm4Nr0MZEa7j9WhsTiVFiUsU6/00Qm0qzjeT/RDmps3YzDL6XGw94 t5s5+1VLpzPyq7JzlfsCKfS0RLXEM0qHUruDBOfYKbC/cV97ufhJKBqMeLDVA7NLwuco 6+Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=W7zLXBgU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id a2-20020a056a000c8200b006ce010d03d3si16479738pfv.303.2023.12.17.04.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 04:02:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=W7zLXBgU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7AAAD8023084; Thu, 14 Dec 2023 03:48:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444290AbjLNLrn (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 06:47:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444225AbjLNLrJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 06:47:09 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361E7D7D for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:46:48 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a1ef2f5ed01so1006548166b.0 for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:46:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702554406; x=1703159206; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tYBn9/laLzrg7Vdv2MX/5C0b5odhy/gUWFCra0JFpOw=; b=W7zLXBgU/MmJZmapmnyy1jmsQHZ7zVFjlgXXG1EsktOvneRpT/IuxMOOMw9WM8K56+ SWsoyZ7uC+zoDdYkq+Idik3vzN7uxAA/y3GlzqvxcJS8db8iCKB9Z72NfU0ksgPttFIL Cm0GvfuA7aEYcqrruZpkgwpb3guc/CFjPMCAh3uGWJ3TUOUtqBLlw0TMjvlbqPlvtSTc GteAnq8rhPPTKkTR0IADYOwsJsyrmkouIArwUtjlH4xvHmMM96aRCKb+038EFGSPjpGT iNytUewClQt6tYPHSsY1hhEJnRkFKdZ6BvdZcTLjK3FTah9rN8VmniVvN1ZqgP+E6VTr 2zAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702554406; x=1703159206; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tYBn9/laLzrg7Vdv2MX/5C0b5odhy/gUWFCra0JFpOw=; b=gga2nukTSbekk9RqY8KvfxGIOsYtdbMB/jiX0OtUhtxYsxjOskdO3ENAx0Js+zOhkE zpU5mpbC9z9oaxve0arLHb12AmNEpzXcbqn75YlECI9miqkc5VGIFp0RGlBKVMdpJf6S H4mdUk3FqIFqdR0Q120W5vzEYzNqXzYw3xq98wayN3LfcFWho5xTFkNMmHhOGN3RVmxS IONKr2EykkDpVqXwD9tJoZ6aa8DSbjnAStlWDF/bUWmzmnUK5wwbNCgDhnLHmDOV6aGP 9RCTregQxJkyyZ/O2jwpp0eACsM2uAkfDoqUFyIerEAjkU1FksmKGXbx0jcqLfcIYOFW mV5Q== X-Gm-Message-State: AOJu0YwEiYE+FnXc454LRhwOyDhPA7VXhyY2MEjiPogmAAkb3wPmK3c5 nvgzUePFvxeP66bFT0fKrnY9VQ== X-Received: by 2002:a17:906:197:b0:a1b:d7a5:927a with SMTP id 23-20020a170906019700b00a1bd7a5927amr2171533ejb.183.1702554406583; Thu, 14 Dec 2023 03:46:46 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.103]) by smtp.gmail.com with ESMTPSA id ll9-20020a170907190900b00a1da2f7c1d8sm9240877ejc.77.2023.12.14.03.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:46:45 -0800 (PST) From: Claudiu <claudiu.beznea@tuxon.dev> X-Google-Original-From: Claudiu <claudiu.beznea.uj@bp.renesas.com> To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Subject: [PATCH net-next v2 17/21] net: ravb: Keep clock request operations grouped together Date: Thu, 14 Dec 2023 13:45:56 +0200 Message-Id: <20231214114600.2451162-18-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> References: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:48:19 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785468939715019208 X-GMAIL-MSGID: 1785530443771168706 |
Series |
net: ravb: Add suspend to RAM and runtime PM support for RZ/G3S
|
|
Commit Message
claudiu beznea
Dec. 14, 2023, 11:45 a.m. UTC
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Keep clock request operations grouped togeter to have all clock-related code in a single place. This makes the code simpler to follow. Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> --- Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-)
Comments
On 16.12.2023 21:43, Sergey Shtylyov wrote: > On 12/14/23 2:45 PM, Claudiu wrote: > >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> >> Keep clock request operations grouped togeter to have all clock-related >> code in a single place. This makes the code simpler to follow. >> >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> --- >> >> Changes in v2: >> - none; this patch is new >> >> drivers/net/ethernet/renesas/ravb_main.c | 28 ++++++++++++------------ >> 1 file changed, 14 insertions(+), 14 deletions(-) >> >> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >> index 38999ef1ea85..a2a64c22ec41 100644 >> --- a/drivers/net/ethernet/renesas/ravb_main.c >> +++ b/drivers/net/ethernet/renesas/ravb_main.c >> @@ -2768,6 +2768,20 @@ static int ravb_probe(struct platform_device *pdev) >> if (error) >> goto out_reset_assert; >> >> + priv->clk = devm_clk_get(&pdev->dev, NULL); >> + if (IS_ERR(priv->clk)) { >> + error = PTR_ERR(priv->clk); >> + goto out_reset_assert; >> + } >> + >> + if (info->gptp_ref_clk) { >> + priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); >> + if (IS_ERR(priv->gptp_clk)) { >> + error = PTR_ERR(priv->gptp_clk); >> + goto out_reset_assert; >> + } >> + } >> + >> priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); >> if (IS_ERR(priv->refclk)) { >> error = PTR_ERR(priv->refclk); > > Hmm... I think we currently have all these calls in one place. > Perhaps you just shouldn't have moved this code around? refclk have been moved at this point due to runtime PM. As refclk was changed to be part of driver's runtime PM APIs we need to have it requested (and prepared) before pm_runtime_resume_and_get(). Calling pm_runtime_resume_and_get() will call driver's runtime PM resume. The idea with this patch was to have all clock requests (clk, gptp, refclk) in a single place (it's easier to follow the code this way, in my opinion). If you prefer I can squash this patch with patch 07/21 "net: ravb: Move reference clock enable/disable on runtime PM APIs". Please, let me know what do you think. > > MBR, Sergey
On 12/17/23 4:22 PM, claudiu beznea wrote: [...] >>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> >>> Keep clock request operations grouped togeter to have all clock-related >>> code in a single place. This makes the code simpler to follow. >>> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> --- >>> >>> Changes in v2: >>> - none; this patch is new >>> >>> drivers/net/ethernet/renesas/ravb_main.c | 28 ++++++++++++------------ >>> 1 file changed, 14 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>> index 38999ef1ea85..a2a64c22ec41 100644 >>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>> @@ -2768,6 +2768,20 @@ static int ravb_probe(struct platform_device *pdev) >>> if (error) >>> goto out_reset_assert; >>> >>> + priv->clk = devm_clk_get(&pdev->dev, NULL); >>> + if (IS_ERR(priv->clk)) { >>> + error = PTR_ERR(priv->clk); >>> + goto out_reset_assert; >>> + } >>> + >>> + if (info->gptp_ref_clk) { >>> + priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); >>> + if (IS_ERR(priv->gptp_clk)) { >>> + error = PTR_ERR(priv->gptp_clk); >>> + goto out_reset_assert; >>> + } >>> + } >>> + >>> priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); >>> if (IS_ERR(priv->refclk)) { >>> error = PTR_ERR(priv->refclk); >> >> Hmm... I think we currently have all these calls in one place. >> Perhaps you just shouldn't have moved this code around? > > refclk have been moved at this point due to runtime PM. As refclk was > changed to be part of driver's runtime PM APIs we need to have it requested > (and prepared) before pm_runtime_resume_and_get(). Calling > pm_runtime_resume_and_get() will call driver's runtime PM resume. > > The idea with this patch was to have all clock requests (clk, gptp, refclk) > in a single place (it's easier to follow the code this way, in my opinion). > If you prefer I can squash this patch with patch 07/21 "net: ravb: Move > reference clock enable/disable on runtime PM APIs". Please, let me know > what do you think. Yes, please move all 3 clocks at once. MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 38999ef1ea85..a2a64c22ec41 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2768,6 +2768,20 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_reset_assert; + priv->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) { + error = PTR_ERR(priv->clk); + goto out_reset_assert; + } + + if (info->gptp_ref_clk) { + priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); + if (IS_ERR(priv->gptp_clk)) { + error = PTR_ERR(priv->gptp_clk); + goto out_reset_assert; + } + } + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); if (IS_ERR(priv->refclk)) { error = PTR_ERR(priv->refclk); @@ -2801,20 +2815,6 @@ static int ravb_probe(struct platform_device *pdev) priv->avb_link_active_low = of_property_read_bool(np, "renesas,ether-link-active-low"); - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) { - error = PTR_ERR(priv->clk); - goto out_rpm_put; - } - - if (info->gptp_ref_clk) { - priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); - if (IS_ERR(priv->gptp_clk)) { - error = PTR_ERR(priv->gptp_clk); - goto out_rpm_put; - } - } - ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); ndev->min_mtu = ETH_MIN_MTU;