Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6610793rdb; Fri, 15 Dec 2023 03:48:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOCCUl1FibzylTysM54RJudLeVnhUv3LhPpf84EgDtOlpkf4Cxx2xehQtIF/fwGLBSXelC X-Received: by 2002:a05:6e02:1e0b:b0:35f:7314:2c63 with SMTP id g11-20020a056e021e0b00b0035f73142c63mr6572205ila.9.1702640887199; Fri, 15 Dec 2023 03:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702640887; cv=none; d=google.com; s=arc-20160816; b=HIq6CHAmn0Ag6tKlFqjAWXzeJ0wO0qul5RKooxCQ392iQubGc4j31UQj4IQt3/UPor 9DbIzlkumqlJl6BRVj0bBfaqzzzmWR2nG4pQh8KRMnwqpP90tYPpROk7MsYYPM6QgRMQ sTYuyx4q2v1MJ5zBNefN5eEI2GKaWb3SQwtk1TQclugHYMdBkhGDBSnFeGl7bDuOq7TO UFPOJCbqmZl3gWUgtkIvb9jXXgLToE74RemaCTU6O52Aq717IDhKeIgnewBlJoqKPN+L 1hMBOzFGutRMkIjkPnYmCjozbnoynqMaYaeRfw/8qqzICpWWYJwwnemm+hLwtk44WF1z 5dew== 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=e1OUji9wCp+dAckpdOqeAMpojOUtVbEPR5TgenY6gOI=; fh=JRNH3R6BkbckLgmyv72Fq6g69IcAiTiL2Sp+o8fsz+8=; b=xaHoycfQp2mfM2V4TiXwsZOoQLrUrJOCmZUyzHI1x/bCvHRINrP7Yzo1n0u2LQHZCp sPcLXttpEJKa2m1xYBWLd3PRUDycV6Zy2oOnzC3Aa0XUfuE7B/X+mdp8Ws7lbB/DgiXk fZ+VsqVJixTjweeoUBwHOUCySHgH1Wlqwpt7FwCrALhojjwWBy82NSZF83l4K7/znv32 sWncL06amOkeguT3l2VMNH75vm1Nqai1Ss2KAVzXcSbCONxJPBOtm68BVmRcZPzoapXm q7dmXY8PjGJZAj1TvYqFDoRLBJsgwUGgVIGWESFhkhhwzuISvQ/nnfd7K4FfeaF+y87D Pq8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ooVfqKUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b5-20020a63eb45000000b005bd85b32495si13526344pgk.685.2023.12.15.03.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:48:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ooVfqKUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 33C7880267E5; Thu, 14 Dec 2023 03:47:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444303AbjLNLrM (ORCPT + 99 others); Thu, 14 Dec 2023 06:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444224AbjLNLqp (ORCPT ); Thu, 14 Dec 2023 06:46:45 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53DE11B5 for ; Thu, 14 Dec 2023 03:46:36 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a1f8a1e9637so102533966b.1 for ; Thu, 14 Dec 2023 03:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702554394; x=1703159194; 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=e1OUji9wCp+dAckpdOqeAMpojOUtVbEPR5TgenY6gOI=; b=ooVfqKUklJlxQoHrqNicnWYxMgvGyQHIKGfKpVWUcejGNBMGhz0Xqk67jOZ8HMF+Em busJOk1edJAoH8ivjjr4DnpRY6LodWH+jyn8kwygrirP8JNOHIszNF61rtn0qEOmcTIW S2QwAQsh3m6rrxDfSKv8ffFm9kYHxSrrp3skRmd7wVJL4NFvjE1ZwSYm+cS6ted1C3KC BeY8hZoU05LeXGXSPZyAJVmbbvyXlXyR89er3uAlhXkcSOIW8DvZcWUkWVhIgywEykis IxJLHd4lSM9cTS1bdzwGY9In++0axBUwa5Tcbtafht4tfzrqjc+emo4Ci4CIVSgwrd65 CBHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702554394; x=1703159194; 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=e1OUji9wCp+dAckpdOqeAMpojOUtVbEPR5TgenY6gOI=; b=Uj8USMTrliN7+9aNNtulEhggeYg8QIOdHQTUAqzrvxm8Jpg5pcb9E+AeVkzqGc5V69 Y7O9ymLewz8JrdkF1xN3cFQ87NY2NiXESfZkL0ToNkrTAVfiO2ETIht2rvBhhSzXdAVM 7xk0zQF/bmhuGYWJKUgcT46Iy8oF16s4icwV+QZ13BA17dCkyT+nIvQqCZjIV79heeM8 WcOOc3bF0/Cu7dVw+nEKH1buqRp54VkmxLIoY/SUhvNrkgZGHOlH9onTdJGikThdMSXI 51aLxY/SHCwq2/jTsuaW4qMS4N0i4tUMp1FpGmcOboe2nFsC9hmfztBpJfxp5t9JwHy1 /DJA== X-Gm-Message-State: AOJu0Yy41ayeZgvgRvWLUupb9j4MEpB7WkXsw++KFMUHJJ1EVlIYODYb 5pTas6Bu82are7xnC7ucCR7xIg== X-Received: by 2002:a17:907:9729:b0:a1e:eebd:ecd with SMTP id jg41-20020a170907972900b00a1eeebd0ecdmr11378221ejc.32.1702554394749; Thu, 14 Dec 2023 03:46:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:46:34 -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, 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 Subject: [PATCH net-next v2 10/21] net: ravb: Move delay mode set in the driver's ndo_open API Date: Thu, 14 Dec 2023 13:45:49 +0200 Message-Id: <20231214114600.2451162-11-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:47:39 -0800 (PST) From: Claudiu Beznea Delay parse and set were done in the driver's probe API. As some IP variants switch to reset mode (and thus registers' content is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM keep the delay parsing in the driver's probe function and move the delay apply function to the driver's ndo_open API. Signed-off-by: Claudiu Beznea --- Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 37 ++++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 5e01e03e1b43..04eaa1967651 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1795,6 +1795,21 @@ static int ravb_compute_gti(struct net_device *ndev) return 0; } +static void ravb_set_delay_mode(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + u32 set = 0; + + if (!priv->info->internal_delay) + return; + + if (priv->rxcidm) + set |= APSR_RDM; + if (priv->txcidm) + set |= APSR_TDM; + ravb_modify(ndev, APSR, APSR_RDM | APSR_TDM, set); +} + /* Network device open function for Ethernet AVB */ static int ravb_open(struct net_device *ndev) { @@ -1806,6 +1821,8 @@ static int ravb_open(struct net_device *ndev) if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); + ravb_set_delay_mode(ndev); + /* Device init */ error = ravb_dmac_init(ndev); if (error) @@ -2530,6 +2547,9 @@ static void ravb_parse_delay_mode(struct device_node *np, struct net_device *nde bool explicit_delay = false; u32 delay; + if (!priv->info->internal_delay) + return; + if (!of_property_read_u32(np, "rx-internal-delay-ps", &delay)) { /* Valid values are 0 and 1800, according to DT bindings */ priv->rxcidm = !!delay; @@ -2679,18 +2699,6 @@ static int ravb_request_irqs(struct ravb_private *priv) ndev, dev, "mgmt_a"); } -static void ravb_set_delay_mode(struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - u32 set = 0; - - if (priv->rxcidm) - set |= APSR_RDM; - if (priv->txcidm) - set |= APSR_TDM; - ravb_modify(ndev, APSR, APSR_RDM | APSR_TDM, set); -} - static int ravb_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -2818,10 +2826,7 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_rpm_put; - if (info->internal_delay) { - ravb_parse_delay_mode(np, ndev); - ravb_set_delay_mode(ndev); - } + ravb_parse_delay_mode(np, ndev); /* Allocate descriptor base address table */ priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM; -- 2.39.2