[net-next,v2,11/21] net: ravb: Move DBAT configuration to the driver's ndo_open API
Message ID | 20231214114600.2451162-12-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:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9213866dys; Fri, 15 Dec 2023 03:57:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVE82hCVMmoNPFg26YbcjLYb5YpUIvAnI0rvzN+9pvfdLy1/uqXWJSIQsc3CB4lO4FRcDn X-Received: by 2002:a05:6e02:1485:b0:35f:8354:a139 with SMTP id n5-20020a056e02148500b0035f8354a139mr2383889ilk.9.1702641432631; Fri, 15 Dec 2023 03:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702641432; cv=none; d=google.com; s=arc-20160816; b=0dGYNx67cpG86XB6cDAuCTc3x2E1gGKErMkdVYFOxve/+osLB8X+UVS8hWvrqEUtrg 2F7HZ29mXcV9Jr2gdJPY9/SSxwuU5/mf+qG5G1DIprHH2GXgwLMHkhA3nmKe8JEIJpOa wrLifijgJgZtG93s5SMdFwHVWvIzhragfoC4HA51Od/H78BMzsK1hi5Pq6aOYFcs1hwa hxvwb1ApScLIfRIfI8f9eu39/EVASwNUPWdKuU8xnfA7l7qT/qaAFVHvr/QK25QjK2J7 XK2GYkthC3SVZahwL3YsrjZB4RiMGm0Yej2c88eVQAYpjCLXp6b6/wq5X2sjxSJsKjKs AKPA== 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=lR5Cjb3g5JwSTu3j/K8ArNRp5NJou/sw/M1aYXvPkhE=; fh=JRNH3R6BkbckLgmyv72Fq6g69IcAiTiL2Sp+o8fsz+8=; b=DKSzO+uBaF8R/F7GDxOuba+T73tmDiqjN7j+RgrU0SA1tBZ69lg3nnnjEugcskP0sQ j+P7t76h0XTrj+V5BAY9UlD8HwYLoIRbpXtGhLH7dIm58OnvZSgwnNPDkgc8Lp7VD2hv 8/tnjy2z8VenzGPdvR+GVi9zf/tejBMEK1kY0gIlTsABEQ9AtcQe4BdVT+Vcf69lGfAw pY/K6yn6pduX+lMqr60XPViZtuQpPgln9sy0QA5tkNKVtXzdPPH1j0Tc6x/HHRF8Cozd 5GeXF89EcvhZGSWfctFv2Kwst0Z4E6mNDxPhDP8JFkjbrtOYinknmzu5LQuVBN81JwKX jikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=gryyX4Y6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id i3-20020a6551c3000000b005c6977f9c0dsi12863304pgq.214.2023.12.15.03.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:57:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=gryyX4Y6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 99C598075033; Thu, 14 Dec 2023 03:47:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444252AbjLNLrP (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 06:47:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444234AbjLNLqp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); 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 E2F9A121 for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:46:37 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a1e2ded3d9fso967649866b.0 for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702554396; x=1703159196; 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=lR5Cjb3g5JwSTu3j/K8ArNRp5NJou/sw/M1aYXvPkhE=; b=gryyX4Y6UY59iIdoIvoVNQbrEJ94YU9HfU3wjgLIP/OpjCse6cSY9v0Q1yvikxxU58 AtAFQJ78WRBndmjC0tLCBLt71fUZTVcODl9BRyM2CSNgYw6NkT1x7WhTssQMH9S0pvXw xXG4Z56d79I9g5kGyBJXgwN5T3LxmQUi2ROk8n4y3JgH0Xbl4kGIAdqMnP8QEhOSwbal xmiN77e4n1g19FI3SRkPV0ZNB9pAY6IlhTj2vxoOTb4RKeLOY1qccznWHhQ1IZ+h1dwZ 7GldsMsUw9wHI1lgQ9mpbgCO8LA1HiBnRr+8yclOH2tqNbUcq+haASEVPTu0OHeAZWZy f87A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702554396; x=1703159196; 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=lR5Cjb3g5JwSTu3j/K8ArNRp5NJou/sw/M1aYXvPkhE=; b=lX9TFSorpA71C84pqRpKoqxASSHk9DblEL1sq/jrMfRyzgqUdp045soKksGSU5QDho F2dSjBJxj8SOm6Vyr528JJY3TOROktqcvuWlUe0VUxmf2+NdqQHWak08QNhj8ekTA3l5 lvzU4feJ6nEESEBbN2lnEov9Ndut/iaJX5MWuwcRGBRm3WPvciRhO3xMYDCXZlI+jDNJ FkF0q/kUpOxW0wWeMxwFwF5Vs1JEUFLseWRva4jOEsPTlqSc9stFP6kuWknEz63YoYgU RN1UfHs+O3e7RqU389bZNvuLtnw3gLmufCUDi1vlZa+YlaEqzPMoaOoXbWxW2qt0Ljus y+Rg== X-Gm-Message-State: AOJu0Yw7OmZ7e+b3nw7nEyYvuPMXQ5QXLD5iuhNak4ZnwfGgjafAZRZX MpYrUl1EIqgrBUrwc8nPtNXk0g== X-Received: by 2002:a17:906:53:b0:a22:fc0f:9878 with SMTP id 19-20020a170906005300b00a22fc0f9878mr1424003ejg.16.1702554396449; Thu, 14 Dec 2023 03:46:36 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:46:36 -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 11/21] net: ravb: Move DBAT configuration to the driver's ndo_open API Date: Thu, 14 Dec 2023 13:45:50 +0200 Message-Id: <20231214114600.2451162-12-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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:47:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785292792377755477 X-GMAIL-MSGID: 1785348943241243654 |
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> DBAT setup was 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 move the DBAT configuration in the driver's ndo_open API. This commit prepares the code for the addition of runtime PM. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 12/15/23 12:03 AM, Sergey Shtylyov wrote: [...] >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> >> DBAT setup was 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 >> move the DBAT configuration in the driver's ndo_open API. >> >> This commit prepares the code for the addition of runtime PM. >> >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > [...] >> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >> index 04eaa1967651..6b8ca08be35e 100644 >> --- a/drivers/net/ethernet/renesas/ravb_main.c >> +++ b/drivers/net/ethernet/renesas/ravb_main.c >> @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) >> napi_enable(&priv->napi[RAVB_NC]); >> >> ravb_set_delay_mode(ndev); >> + ravb_write(ndev, priv->desc_bat_dma, DBAT); Looking at it again, I suspect this belong in ravb_dmac_init()... >> >> /* Device init */ >> error = ravb_dmac_init(ndev); [...] MBR, Sergey
On 15.12.2023 22:01, Sergey Shtylyov wrote: > On 12/15/23 12:03 AM, Sergey Shtylyov wrote: > [...] > >>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> >>> DBAT setup was 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 >>> move the DBAT configuration in the driver's ndo_open API. >>> >>> This commit prepares the code for the addition of runtime PM. >>> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> >> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> >> >> [...] >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>> index 04eaa1967651..6b8ca08be35e 100644 >>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>> @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) >>> napi_enable(&priv->napi[RAVB_NC]); >>> >>> ravb_set_delay_mode(ndev); >>> + ravb_write(ndev, priv->desc_bat_dma, DBAT); > > Looking at it again, I suspect this belong in ravb_dmac_init()... ravb_dmac_init() is called from multiple places in this driver, e.g., ravb_set_ringparam(), ravb_tx_timeout_work(). I'm afraid we may broke the behavior of these if DBAT setup is moved in ravb_dmac_init(). This is also valid for setting delay (see patch 10/12). > >>> >>> /* Device init */ >>> error = ravb_dmac_init(ndev); > [...] > > MBR, Sergey
On 12/17/23 3:54 PM, claudiu beznea wrote: [...] >>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>> >>>> DBAT setup was 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 >>>> move the DBAT configuration in the driver's ndo_open API. >>>> >>>> This commit prepares the code for the addition of runtime PM. >>>> >>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> >>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> >>> >>> [...] >>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>>> index 04eaa1967651..6b8ca08be35e 100644 >>>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>>> @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) >>>> napi_enable(&priv->napi[RAVB_NC]); >>>> >>>> ravb_set_delay_mode(ndev); >>>> + ravb_write(ndev, priv->desc_bat_dma, DBAT); >> >> Looking at it again, I suspect this belong in ravb_dmac_init()... > > ravb_dmac_init() is called from multiple places in this driver, e.g., It's purpose is to configure AVB-DMAC and DBAT is the AVB-DMAC register, right? > ravb_set_ringparam(), ravb_tx_timeout_work(). I know. Its value is only calculated once, in ravb_probe(), right? > I'm afraid we may broke the behavior of these if DBAT setup is moved Do not be afraid! :-) > in ravb_dmac_init(). This is also > valid for setting delay (see patch 10/12). I don't think there will be a problem either... but maybe we should call it in ravb_emac_init() indeed. [...] MBR, Sergey
On 19.12.2023 20:54, Sergey Shtylyov wrote: > On 12/17/23 3:54 PM, claudiu beznea wrote: > > [...] > >>>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>>> >>>>> DBAT setup was 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 >>>>> move the DBAT configuration in the driver's ndo_open API. >>>>> >>>>> This commit prepares the code for the addition of runtime PM. >>>>> >>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>> >>>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> >>>> >>>> [...] >>>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>>>> index 04eaa1967651..6b8ca08be35e 100644 >>>>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>>>> @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) >>>>> napi_enable(&priv->napi[RAVB_NC]); >>>>> >>>>> ravb_set_delay_mode(ndev); >>>>> + ravb_write(ndev, priv->desc_bat_dma, DBAT); >>> >>> Looking at it again, I suspect this belong in ravb_dmac_init()... >> >> ravb_dmac_init() is called from multiple places in this driver, e.g., > > It's purpose is to configure AVB-DMAC and DBAT is the AVB-DMAC register, > right? It is. But it is pointless to configure it more than one time after ravb_open() has been called as the register content is not changed until IP enters reset mode (though ravb_close() now). > >> ravb_set_ringparam(), ravb_tx_timeout_work(). > > I know. Its value is only calculated once, in ravb_probe(), right? right > >> I'm afraid we may broke the behavior of these if DBAT setup is moved I was wrong here. DBAT is not changed by IP while TX/RX is working. > > Do not be afraid! :-) > >> in ravb_dmac_init(). This is also >> valid for setting delay (see patch 10/12). > > I don't think there will be a problem either... but maybe we > should call it in ravb_emac_init() indeed. > > [...] > > MBR, Sergey
On 12/20/23 2:41 PM, claudiu beznea wrote: [...] >>>>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>>>> >>>>>> DBAT setup was 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 >>>>>> move the DBAT configuration in the driver's ndo_open API. >>>>>> >>>>>> This commit prepares the code for the addition of runtime PM. >>>>>> >>>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>>> >>>>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> >>>>> >>>>> [...] >>>>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >>>>>> index 04eaa1967651..6b8ca08be35e 100644 >>>>>> --- a/drivers/net/ethernet/renesas/ravb_main.c >>>>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c >>>>>> @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) >>>>>> napi_enable(&priv->napi[RAVB_NC]); >>>>>> >>>>>> ravb_set_delay_mode(ndev); >>>>>> + ravb_write(ndev, priv->desc_bat_dma, DBAT); >>>> >>>> Looking at it again, I suspect this belong in ravb_dmac_init()... >>> >>> ravb_dmac_init() is called from multiple places in this driver, e.g., >> >> It's purpose is to configure AVB-DMAC and DBAT is the AVB-DMAC register, >> right? > > It is. But it is pointless to configure it more than one time after > ravb_open() has been called as the register content is not changed until IP > enters reset mode (though ravb_close() now). The same is true for the most registers set by ravb_dmac_init()! [...] MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 04eaa1967651..6b8ca08be35e 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1822,6 +1822,7 @@ static int ravb_open(struct net_device *ndev) napi_enable(&priv->napi[RAVB_NC]); ravb_set_delay_mode(ndev); + ravb_write(ndev, priv->desc_bat_dma, DBAT); /* Device init */ error = ravb_dmac_init(ndev); @@ -2841,7 +2842,6 @@ static int ravb_probe(struct platform_device *pdev) } for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++) priv->desc_bat[q].die_dt = DT_EOS; - ravb_write(ndev, priv->desc_bat_dma, DBAT); /* Initialise HW timestamp list */ INIT_LIST_HEAD(&priv->ts_skb_list);