Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp674494rdf; Tue, 21 Nov 2023 13:10:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8a006lSHXjHgD1pNfDSe94MnAjwEmG+z6JvwcMK7dc6qkwgU9b341YlcyJoUvE9UapfAm X-Received: by 2002:a17:903:41c7:b0:1cc:6fa6:ab62 with SMTP id u7-20020a17090341c700b001cc6fa6ab62mr452447ple.29.1700601017700; Tue, 21 Nov 2023 13:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700601017; cv=none; d=google.com; s=arc-20160816; b=JwP2lgHOZhp9MEiZJ0+L3DuYRpcFzW6UJOnNxWaJhNh3dv6+Ax9MyXZX18MtwLugVx W4ZGGl2r67JYIhXh2AnR5VMr2NJj0+xa8PEpuNqF+AmQm66JDMEe7u3EUQCMGBc6Zlqj ZxVYxjb6UW9lCvH0ETw5bARcehjeQHe4n47DOeCGg3NHME8qzm+G8prxo1pnMSuO6/iU Ry1mARjBuMp9wivDdM4F98RDS9nk01teeQUo+DVTrH6757nupfQc/w/PDDxSaEoOMkSZ P9XnyCLZFJw8TQsxcJEkmAM0OHEonUs86tbk7j07Phkx+80zSG68M35CaasoA7expxl5 rfrQ== 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=DzcPPHS9PLZPTA2qr9UA335fHiFxWMFmb2QEUprvcuU=; fh=nGBoZt4+kP3+rfkGrTC/iVeVVkp7LZlm3MgVwF0znI0=; b=ws1lhBYKsuqoXgkJytWbhlPnBQRLA3b/LMaVqy36fq+87PW0PJcUtbaA3YTvoBFwF2 5iKA3povb75y1gdcNQui29Z4VJo3yaeLdfofLkohyMets7dQinjEDoSZHRchE84k0b72 8dpxI0a9Gh8jnvxCxfA/Ha9y6NBD6XOu0hzO+rKbNtxQDj1kohtT9w8IuX+bEqkG8iN8 nt8h7v2+79DM/DRT2YbIdVY0MWelfnw5JnvMIHDgFpWD5tSS8RmPeCnBlAmtzK8fFet+ e4CWBqtexS7wtZyZDskSqcXPCPs9U+dgRm9OL8Lr/FzA6NcEuN80JHL9C1Blpk+dLiiP cs6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=gaKjawyR; 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 i14-20020a17090332ce00b001c9e75f87edsi11678123plr.152.2023.11.21.13.10.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 13:10:17 -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; dkim=pass header.i=@tuxon.dev header.s=google header.b=gaKjawyR; 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 C8DED80AD12A; Mon, 20 Nov 2023 00:47:37 -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 S232564AbjKTIqz (ORCPT + 99 others); Mon, 20 Nov 2023 03:46:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232438AbjKTIql (ORCPT ); Mon, 20 Nov 2023 03:46:41 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D039A1BB for ; Mon, 20 Nov 2023 00:46:36 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso2663856f8f.2 for ; Mon, 20 Nov 2023 00:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469995; x=1701074795; 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=DzcPPHS9PLZPTA2qr9UA335fHiFxWMFmb2QEUprvcuU=; b=gaKjawyRvmtWnZzaIkrr/naPRCwvlX6RMI7pboiXv+Xlu9jpOf2qDPqa/iAP/mcCCg gcZqSEViPByiRa1mXqf5dlBYbBmbNJpGJG82zhh+jYo+UqPRQJG113UWYdTYq6MmdbJ7 XKzmeOtBLweueCJvbPfJV62qraBNvhYh5/IOmO9OoFrZoa+VLubipm+3R9fACJL4LmFb kv0HEI+/fR2dbQ3aWCtmJkViPyvkVhco9A392QB2imrPPwQ+QT2qKKBe2c+Phocxqwe5 VBdTGnpIk/MJQ96t51EuKW9TQXAqaHjDbM+fMZesFXlK2QbGL0j/ncXJNu6Ek7QNCTZ9 9xiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469995; x=1701074795; 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=DzcPPHS9PLZPTA2qr9UA335fHiFxWMFmb2QEUprvcuU=; b=ZtFFXzWQ1JcjX0tycQVqQH1sGTt5yNypUZNBUNvR1G1Bs6AbxFvlx5Kj+UNIG0pdHe Hbmg7dYVfYu34MKKSnJ8Z3vMiYYxkc7/FE1D9klA8N4myXv05zI5FUA1p7SQSthAaDj/ 44IcPr3TRYu2LbdHRYYDKK8MhTMKEojtjAqSWQxQk902HOqhnhIS53tX5RMbs6eJIBJq 2Lv964xvMH5XWcEUvTzkq5hfYHkynjg6uQ7+VW3Bk8DK6rE0eT9UAAXeEu1wMbYGttIW qbK5PSXsKLcuPkH5oAA4q0Sjy7Rvufj7TzYNK73YgXPcSry4BU73KqWjIUOyDay3qrEN F/qA== X-Gm-Message-State: AOJu0YxFrIInKhsEAESRDeIW4JIKKisY3pQ1ISkL83/NNScAibabMGIs rvARXAP2PVwQdCAYGjPm9x0awg== X-Received: by 2002:a05:6000:a8f:b0:32f:7867:112 with SMTP id dh15-20020a0560000a8f00b0032f78670112mr4914227wrb.13.1700469995379; Mon, 20 Nov 2023 00:46:35 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:35 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: 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, geert+renesas@glider.be, 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 Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 08/13] net: ravb: Rely on PM domain to enable refclk Date: Mon, 20 Nov 2023 10:46:01 +0200 Message-Id: <20231120084606.4083194-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-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 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]); Mon, 20 Nov 2023 00:47:37 -0800 (PST) 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) 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 --- drivers/net/ethernet/renesas/ravb.h | 1 + drivers/net/ethernet/renesas/ravb_main.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index e0f8276cffed..c2d8d890031f 100644 --- 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); 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); -- 2.39.2