Message ID | 20231214113137.2450292-3-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 c4csp8475115dys; Thu, 14 Dec 2023 03:35:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFb7q62Q5sFl9cxeB0QmrDMg9J6FH5ZUDUIx2gLrLkQ2W+kK9/ltuOkAm32eejhQ6UfhRA0 X-Received: by 2002:a9d:7c95:0:b0:6d9:d815:f399 with SMTP id q21-20020a9d7c95000000b006d9d815f399mr9038816otn.66.1702553736495; Thu, 14 Dec 2023 03:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702553736; cv=none; d=google.com; s=arc-20160816; b=G+SI/SpxSnoZ77kOvongIHgpCa23m2Rr13v5VEylwidXTKSuPRiKKryC4Qj/rd153Q 42zE+0yp0/skrhNutchLDJSTOQsDmLjzFaDPJIIFVXssFTGXy6RM1p4wIgppfErzqRhf ZWcjs+GHEAd+A1irrYZ7SNfg6p5OYQ8QYqQnj343GcoWSIa5tNfwTEjp1zQKectyrakB O0dHw3DnmOU7MH8dX5DzwF3Few6mKGT3m1gmOwCRYelD1mktV6D5pDmWfSmPQSilA7e5 FZBu1EVMHt0UmGWGzNRJUh4B4JhWEoVaSK3PmpAjoIiFpEGuRLzoYPl/eIiu7vIxT7wt OpPA== 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=jKjeAY34llcGOWUq2lKYylvmKvhjwRpxdh2PzgtUzQM=; fh=+F3zNmKl1GdtaaQHdayf+Mqd3e1G3WLK7KLudAYF/QY=; b=AbiiO3mncxhLEeLdcg16ING2ZPxBYbOUU6n0HUULXeByxPCs+PGRcbCXR09H1Qc+1A TZHOF3/ont/cYf6qhNL7QcR44vO5lb7pxxzvetXrJdX/sCTJV9e2wiDmjgQT9++3l+31 hGBfitSWTepaNvnq7DzEenakE+/IAFC+grm1lqjz0No2H1K/P7E+k+ObCaJbyH2cm2Zm dS682nYBRIbYn23D6rvNmkE6Ne9EhUlIgokOtREgwb0PSzWMIm9huZtzDC6ANzRxzfQD eQAm3EpJmK1j7BfbkH3dXzqLdE9J80tFKIFFrxNm9GoDoc7t9vEssYgiZjvwBHdC0DGI l0jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=XlBkhy2X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v18-20020a631512000000b005b884a11fdcsi11176948pgl.28.2023.12.14.03.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:35:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=XlBkhy2X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 0912C8369F51; Thu, 14 Dec 2023 03:35:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443993AbjLNLfX (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 06:35:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443988AbjLNLfQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 06:35:16 -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 1A19B116 for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:35:23 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a22f2a28c16so314487966b.0 for <linux-kernel@vger.kernel.org>; Thu, 14 Dec 2023 03:35:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702553721; x=1703158521; 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=jKjeAY34llcGOWUq2lKYylvmKvhjwRpxdh2PzgtUzQM=; b=XlBkhy2XpWw9PEY6gUXcvcKOS9DJWtbpAMhBhU++2Y0Vter51xEydZEZwK/AMP09sj VdHjisE8wFD3q/UbyArxhR9/QojwJju5Q+hHj+g7SlUBiFUhUOb5c0tGFEyrXlN3hb5O n3iIeGWN/7VoDIk0E4hCqNO0AlT9LrEs7j+ILM31SqRYsx2ltVkFPdQbzX3SxFlFssXQ h0hfUGo8n5Y9N/xGcd1XZp3HFvE7QVHftcjiLF4f5muXccPWBqpO1IBn34r3DwjTehNE 0a2dR8kxCN79/e0LzF5PWtKoCHH3hb/TlErmqGLj13aRDcvASBG9Mtbu92xupkYvxIe5 U4qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702553721; x=1703158521; 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=jKjeAY34llcGOWUq2lKYylvmKvhjwRpxdh2PzgtUzQM=; b=T2Fuu/CxOqQj3xi6OFSh/sCh+xfuzMN8RXCY7TNlGeFC1+zsgXtvrfNyQn2ku1xF1M u6MCcwRbAXUKn5mPSL+oPQ1JH9hZ+RuZNB3TA1C7+uI0BhH4E1RI1bv5LdRRyNe9SxrT Tj+drUTWJ+P2ox9YXPwcB4woKKdJn/GNfejmXH/c5b0lwrBaTN4KhYsaGdak5nGHyFaR sfoAjousQyyzzAdLD18yEEoeLslTk92a4l/4/ed3AOqNSUnHWHJDjIZdGKEASxinuuxH OoZvtDPOrMyVQxmw5xWSG5diGnUqG92U9owipZkpRq+0ZT1KNpYBWNIushwsxfQ9Wa6w 4Zdg== X-Gm-Message-State: AOJu0Yz+xk8EABtue2uMaOGDCqVlGFzPIHAWBPYGAiSjxWVm838DpbgA 4lrlbHH9dG89AHNpw1csklXWgQ== X-Received: by 2002:a17:907:2da1:b0:a0d:39c6:1f67 with SMTP id gt33-20020a1709072da100b00a0d39c61f67mr3996296ejc.76.1702553721371; Thu, 14 Dec 2023 03:35:21 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.103]) by smtp.gmail.com with ESMTPSA id vx12-20020a170907a78c00b00a1ddb5a2f7esm9290656ejc.60.2023.12.14.03.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:35:21 -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, claudiu.beznea.uj@bp.renesas.com, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com, niklas.soderlund+renesas@ragnatech.se, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, mitsuhiro.kimura.kc@renesas.com, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: ravb: Check that GTI loading request is done Date: Thu, 14 Dec 2023 13:31:37 +0200 Message-Id: <20231214113137.2450292-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214113137.2450292-1-claudiu.beznea.uj@bp.renesas.com> References: <20231214113137.2450292-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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:35:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785256986775908618 X-GMAIL-MSGID: 1785256986775908618 |
Series |
net: ravb: fixes for the ravb driver
|
|
Commit Message
claudiu beznea
Dec. 14, 2023, 11:31 a.m. UTC
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Hardware manual specifies the following for GCCR.LTI bit: 0: Setting completed 1: When written: Issue a configuration request. When read: Completion of settings is pending Thus, check the completion status when setting 1 to GCCR.LTI. Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L") Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code") Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support") Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> --- drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
Hi Claudiu, Thanks for your work. On 2023-12-14 13:31:37 +0200, Claudiu wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Hardware manual specifies the following for GCCR.LTI bit: > 0: Setting completed > 1: When written: Issue a configuration request. > When read: Completion of settings is pending This is hard to parse at first glance, the last row have odd indentation and the mixing of read and write info is odd. I know this reflects how it's written in the datasheet, but at least there the indentation is correct. Also missing here is the fact that only 1 can be written to the bit. > > Thus, check the completion status when setting 1 to GCCR.LTI. Can you describe in the commit why this fix is needed. I agree it is, but would be nice to record why. As this have a fixes tags have you hit an issue? Or are you correcting the driver based on the datasheet? Maybe a more informative commit message could be to describe the change and why it's needed instead of the register layout? The driver do not wait for the confirmation of the configuring request of the gPTP timer increment before moving on. Add a check to make sure the request completes successfully. > > Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L") > Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code") > Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support") > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- > drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index ce95eb5af354..1c253403a297 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -2819,6 +2819,10 @@ static int ravb_probe(struct platform_device *pdev) > > /* Request GTI loading */ > ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); > + /* Check completion status. */ > + error = ravb_wait(ndev, GCCR, GCCR_LTI, 0); > + if (error) > + goto out_disable_refclk; nit: Maybe create a helper for this so future fixes only need to be addressed in one location? > } > > if (info->internal_delay) { > @@ -3041,6 +3045,10 @@ static int __maybe_unused ravb_resume(struct device *dev) > > /* Request GTI loading */ > ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); > + /* Check completion status. */ > + ret = ravb_wait(ndev, GCCR, GCCR_LTI, 0); > + if (ret) > + return ret; > } > > if (info->internal_delay) > -- > 2.39.2 >
On 14.12.2023 14:33, Niklas Söderlund wrote: > Hi Claudiu, > > Thanks for your work. > > On 2023-12-14 13:31:37 +0200, Claudiu wrote: >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> >> Hardware manual specifies the following for GCCR.LTI bit: >> 0: Setting completed >> 1: When written: Issue a configuration request. >> When read: Completion of settings is pending > > This is hard to parse at first glance, the last row have odd indentation > and the mixing of read and write info is odd. I know this reflects how > it's written in the datasheet, but at least there the indentation is > correct. Also missing here is the fact that only 1 can be written to the > bit. > >> >> Thus, check the completion status when setting 1 to GCCR.LTI. > > Can you describe in the commit why this fix is needed. I agree it is, > but would be nice to record why. As this have a fixes tags have you hit > an issue? Or are you correcting the driver based on the datasheet? Yes, this is a issue I faced while working on runtime PM support for this driver. > > Maybe a more informative commit message could be to describe the change > and why it's needed instead of the register layout? ok > > The driver do not wait for the confirmation of the configuring request > of the gPTP timer increment before moving on. Add a check to make sure > the request completes successfully. > >> >> Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L") >> Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code") >> Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support") >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> --- >> drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c >> index ce95eb5af354..1c253403a297 100644 >> --- a/drivers/net/ethernet/renesas/ravb_main.c >> +++ b/drivers/net/ethernet/renesas/ravb_main.c >> @@ -2819,6 +2819,10 @@ static int ravb_probe(struct platform_device *pdev) >> >> /* Request GTI loading */ >> ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); >> + /* Check completion status. */ >> + error = ravb_wait(ndev, GCCR, GCCR_LTI, 0); >> + if (error) >> + goto out_disable_refclk; > > nit: Maybe create a helper for this so future fixes only need to be > addressed in one location? The code intended for runtime PM support addresses this. > >> } >> >> if (info->internal_delay) { >> @@ -3041,6 +3045,10 @@ static int __maybe_unused ravb_resume(struct device *dev) >> >> /* Request GTI loading */ >> ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); >> + /* Check completion status. */ >> + ret = ravb_wait(ndev, GCCR, GCCR_LTI, 0); >> + if (ret) >> + return ret; >> } >> >> if (info->internal_delay) >> -- >> 2.39.2 >> >
On 12/14/23 2:31 PM, Claudiu wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Hardware manual specifies the following for GCCR.LTI bit: > 0: Setting completed > 1: When written: Issue a configuration request. > When read: Completion of settings is pending > > Thus, check the completion status when setting 1 to GCCR.LTI. But do we really need to? Seems quite dubious... currently we just let it the loading complete asynchronously... > Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L") > Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code") > Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support") > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- > drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index ce95eb5af354..1c253403a297 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -2819,6 +2819,10 @@ static int ravb_probe(struct platform_device *pdev) > > /* Request GTI loading */ > ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); > + /* Check completion status. */ > + error = ravb_wait(ndev, GCCR, GCCR_LTI, 0); > + if (error) > + goto out_disable_refclk; > } > > if (info->internal_delay) { > @@ -3041,6 +3045,10 @@ static int __maybe_unused ravb_resume(struct device *dev) > > /* Request GTI loading */ > ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); > + /* Check completion status. */ > + ret = ravb_wait(ndev, GCCR, GCCR_LTI, 0); > + if (ret) > + return ret; > } > > if (info->internal_delay) > BTW, seems worth factoring out into a separate function... MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index ce95eb5af354..1c253403a297 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2819,6 +2819,10 @@ static int ravb_probe(struct platform_device *pdev) /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); + /* Check completion status. */ + error = ravb_wait(ndev, GCCR, GCCR_LTI, 0); + if (error) + goto out_disable_refclk; } if (info->internal_delay) { @@ -3041,6 +3045,10 @@ static int __maybe_unused ravb_resume(struct device *dev) /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); + /* Check completion status. */ + ret = ravb_wait(ndev, GCCR, GCCR_LTI, 0); + if (ret) + return ret; } if (info->internal_delay)