Message ID | 20230622175200.74033-1-fido_max@inbox.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5257337vqr; Thu, 22 Jun 2023 11:20:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sDCok/LLs+WMbGxphrKhsVnNhWfkz5dQJozEUecNrqjewDO0tXhZ66K8Hz1SZ1WSrffK5 X-Received: by 2002:a05:6a00:10cf:b0:668:681f:ca98 with SMTP id d15-20020a056a0010cf00b00668681fca98mr13896494pfu.27.1687458036175; Thu, 22 Jun 2023 11:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687458036; cv=none; d=google.com; s=arc-20160816; b=MZsvNgdJ7An4oczlcYDjhkGy9a2g6j1REJmZu3P2uZtmm9xFJPvLchWVrq7soxs06e 5MKmhY4vgi49YTq/ZkVmEHutYQIp9ClhfnR2A6jvA/FuYE7+c/KZVgSaDfBAJz8Ph4dk pAZps9hDcNy6UeYkNF8IHgg2T2gkRVD/GBBhPUt/GlWjW5E420o1EPiwhFDWfgGkFIlg WZVGgbyxiSUWHVqHL2lCYJ7WRgkXX62Z2o3z3IdxnaRfWqjSmfb1dlKdAL63ZTIYZ9qT PTYI3cWORP4rPXwdaM2Lh8btUdd6Zglrvi/2lVLq9OAEUoUmH6m5wBEEqrus/CgB6yWB imAA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=zXjoDRbVXMU6vb06CWzK6yq3hVHeHFiXaIRJZFK7fbU=; b=JnCmnUt6FeaVei4g5jx8Y0FXC26dHo4E27OW0HUhmkgE7/bVSXhu+Mysk4fDYRta0C Sxx9Q6VWs9ieksoA5VinL+/GUU9g7eDjy3aDH6UWXwwE3mZfj7X3nGp8gkfyOge/Ei64 XXUt0DdYpuzL/4MqYX4CsaASxzI+Xs4YtDwP9YwR/S2hPlDfuKHORizR7hO5ax+88Zpw Fu0T7IffnZZnDDuyKy/oyYdrbUVl9CVFlfNvnMeRGqxfOhe1xsLmdMxO9IYcvgLMz2Pt yQErYROY6mVqebFlbiiD+JtwnTJRSwiNEUlGb0IhDEPgosbb4XfSvzow1i8fYWOyjgaX Nzsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inbox.ru header.s=mail4 header.b=A3bRCrGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=inbox.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020aa79e4b000000b0063b8f3a4d42si6835407pfq.163.2023.06.22.11.20.23; Thu, 22 Jun 2023 11:20:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inbox.ru header.s=mail4 header.b=A3bRCrGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=inbox.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbjFVRwW (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 22 Jun 2023 13:52:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231418AbjFVRwU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Jun 2023 13:52:20 -0400 X-Greylist: delayed 109523 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 22 Jun 2023 10:52:14 PDT Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD2B210E; Thu, 22 Jun 2023 10:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail4; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=zXjoDRbVXMU6vb06CWzK6yq3hVHeHFiXaIRJZFK7fbU=; t=1687456334;x=1687546334; b=A3bRCrGZSyaU7yTanXj5jsWR+IfCFg8tLOheLqAz273Y3RzSEfFAywU19wI42cyovTy2EICll3tpwthFw5K2uJZ6NLyXMSZwQxBIgto4QZT+smueWfRnCJlS02OA46lJW239p0RLvPV7PEvTM3Ghx/rBmjobosWwXcTjukLUCL70U2t5vPq9u4UEGjuQ7chsK7jhM5aRwKgqeJ7n1LXFr2c0u5glXbOz9ZhzBNrW8eY1iz7TngehpYaHWNX3seW2svu/VEI/J0y0d9/C2ca/nCYdj5ovfZ5L3iaiz2oePwlgE5VtPDoe9RSqVd/7kpEk+uIz48w415sBLpTHaxDikg==; Received: by smtpng1.m.smailru.net with esmtpa (envelope-from <fido_max@inbox.ru>) id 1qCOTa-0007nX-6I; Thu, 22 Jun 2023 20:52:10 +0300 From: Maxim Kochetkov <fido_max@inbox.ru> To: netdev@vger.kernel.org Cc: Maxim Kochetkov <fido_max@inbox.ru>, Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Michal Simek <michal.simek@amd.com>, Andrew Lunn <andrew@lunn.ch>, Robert Hancock <robert.hancock@calian.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] net: axienet: Move reset before DMA detection Date: Thu, 22 Jun 2023 20:52:00 +0300 Message-Id: <20230622175200.74033-1-fido_max@inbox.ru> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtpng1.m.smailru.net; auth=pass smtp.auth=fido_max@inbox.ru smtp.mailfrom=fido_max@inbox.ru X-Mailru-Src: smtp X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95D99986233CC4DDC426F77D841B18B42694044EA105F6AAD182A05F5380850400B44E5DFD61226C9C164A172F770E7E1DA5BCD2A2C70F13C704E025EC0715AAF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BB17EE3498E810FEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AAEFEF2B38A4D0058638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8D42730F99B4A620FC0CB81695E71B88E6F9789CCF6C18C3F8528715B7D10C86878DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D9E625A9149C048EE1E561CDFBCA1751FF04B652EEC242312D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B3238885582065B7B389733CBF5DBD5E9B5C8C57E37DE458B9E9CE733340B9D5F3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735D2D576BCF940C736C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5AD745CCC44C3CF219B89CBA18E19EEEC570D8D2E4A392975F87CCE6106E1FC07E67D4AC08A07B9B062B3BD3CC35DA5889C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFC1113EE3D37281C80ABCF84072D8F5A13505A1F3356E4527FD752AB42C1274D4F85183ADB301C8A8B05B57073EAFDF970A0C62A06E3D37BB78FE44A23B5A427121BEC6C0C71ED4F84C41F94D744909CEE921556F0E976A29E6EC0772259F8F8F8815B87D7EC76CB9 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojB41c+mu8Ac+/kSHgJhDwrg== X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986B862EE9EDEFF493C6A39EF55076659A0A98CC072019C18A892CA7F8C7C9492E1F2F5E575105D0B01ADBE2EF17B331888EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769427997736921775?= X-GMAIL-MSGID: =?utf-8?q?1769427997736921775?= |
Series |
[v2,1/1] net: axienet: Move reset before DMA detection
|
|
Commit Message
Maxim Kochetkov
June 22, 2023, 5:52 p.m. UTC
DMA detection will fail if axinet was started before (by boot loader,
boot ROM, etc). In this state axinet will not start properly.
XAXIDMA_TX_CDESC_OFFSET + 4 register (MM2S_CURDESC_MSB) is used to detect
64 DMA capability here. But datasheet says: When DMACR.RS is 1
(axinet is in enabled state), CURDESC_PTR becomes Read Only (RO) and
is used to fetch the first descriptor. So iowrite32()/ioread32() trick
to this register to detect DMA will not work.
So move axinet reset before DMA detection.
Fixes: 04cc2da39698 ("net: axienet: reset core on initialization prior to MDIO access")
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
On Thu, 2023-06-22 at 20:52 +0300, Maxim Kochetkov wrote: > DMA detection will fail if axinet was started before (by boot loader, > boot ROM, etc). In this state axinet will not start properly. > XAXIDMA_TX_CDESC_OFFSET + 4 register (MM2S_CURDESC_MSB) is used to > detect > 64 DMA capability here. But datasheet says: When DMACR.RS is 1 > (axinet is in enabled state), CURDESC_PTR becomes Read Only (RO) and > is used to fetch the first descriptor. So iowrite32()/ioread32() > trick > to this register to detect DMA will not work. > So move axinet reset before DMA detection. > > Fixes: 04cc2da39698 ("net: axienet: reset core on initialization > prior to MDIO access") > Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> > Reviewed-by: Robert Hancock <robert.hancock@calian.com> > --- > drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > index 3e310b55bce2..734822321e0a 100644 > --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > @@ -2042,6 +2042,11 @@ static int axienet_probe(struct > platform_device *pdev) > goto cleanup_clk; > } > > + /* Reset core now that clocks are enabled, prior to accessing > MDIO */ > + ret = __axienet_device_reset(lp); > + if (ret) > + goto cleanup_clk; > + > /* Autodetect the need for 64-bit DMA pointers. > * When the IP is configured for a bus width bigger than 32 > bits, > * writing the MSB registers is mandatory, even if they are > all 0. > @@ -2096,11 +2101,6 @@ static int axienet_probe(struct > platform_device *pdev) > lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; > lp->coalesce_usec_tx = XAXIDMA_DFT_TX_USEC; > > - /* Reset core now that clocks are enabled, prior to accessing > MDIO */ > - ret = __axienet_device_reset(lp); > - if (ret) > - goto cleanup_clk; > - > ret = axienet_mdio_setup(lp); > if (ret) > dev_warn(&pdev->dev, > -- > 2.40.1 >
> -----Original Message----- > From: Maxim Kochetkov <fido_max@inbox.ru> > Sent: Thursday, June 22, 2023 11:22 PM > To: netdev@vger.kernel.org > Cc: Maxim Kochetkov <fido_max@inbox.ru>; Pandey, Radhey Shyam > <radhey.shyam.pandey@amd.com>; David S. Miller > <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub > Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Simek, > Michal <michal.simek@amd.com>; Andrew Lunn <andrew@lunn.ch>; Robert > Hancock <robert.hancock@calian.com>; linux-arm- > kernel@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: [PATCH v2 1/1] net: axienet: Move reset before DMA detection > > DMA detection will fail if axinet was started before (by boot loader, :%s/axinet/axienet/g > boot ROM, etc). In this state axinet will not start properly. > XAXIDMA_TX_CDESC_OFFSET + 4 register (MM2S_CURDESC_MSB) is used to > detect > 64 DMA capability here. But datasheet says: When DMACR.RS is 1 > (axinet is in enabled state), CURDESC_PTR becomes Read Only (RO) and > is used to fetch the first descriptor. So iowrite32()/ioread32() trick > to this register to detect DMA will not work. > So move axinet reset before DMA detection. > > Fixes: 04cc2da39698 ("net: axienet: reset core on initialization prior to MDIO Is this fixes tag correct ? I think the failure is introduced after f735c40ed93c net: axienet: Autodetect 64-bit DMA capability? > access") > Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru> > --- > drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > index 3e310b55bce2..734822321e0a 100644 > --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c > @@ -2042,6 +2042,11 @@ static int axienet_probe(struct platform_device > *pdev) > goto cleanup_clk; > } > > + /* Reset core now that clocks are enabled, prior to accessing MDIO > */ > + ret = __axienet_device_reset(lp); > + if (ret) > + goto cleanup_clk; > + > /* Autodetect the need for 64-bit DMA pointers. > * When the IP is configured for a bus width bigger than 32 bits, > * writing the MSB registers is mandatory, even if they are all 0. > @@ -2096,11 +2101,6 @@ static int axienet_probe(struct platform_device > *pdev) > lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; > lp->coalesce_usec_tx = XAXIDMA_DFT_TX_USEC; > > - /* Reset core now that clocks are enabled, prior to accessing MDIO > */ > - ret = __axienet_device_reset(lp); > - if (ret) > - goto cleanup_clk; > - > ret = axienet_mdio_setup(lp); > if (ret) > dev_warn(&pdev->dev, > -- > 2.40.1
On 22.06.2023 21:43, Pandey, Radhey Shyam wrote: >> DMA detection will fail if axinet was started before (by boot loader, > > :%s/axinet/axienet/g Sorry about that. I will fix it in v3. > >> boot ROM, etc). In this state axinet will not start properly. >> XAXIDMA_TX_CDESC_OFFSET + 4 register (MM2S_CURDESC_MSB) is used to >> detect >> 64 DMA capability here. But datasheet says: When DMACR.RS is 1 >> (axinet is in enabled state), CURDESC_PTR becomes Read Only (RO) and >> is used to fetch the first descriptor. So iowrite32()/ioread32() trick >> to this register to detect DMA will not work. >> So move axinet reset before DMA detection. >> >> Fixes: 04cc2da39698 ("net: axienet: reset core on initialization prior to MDIO > > Is this fixes tag correct ? I think the failure is introduced after > f735c40ed93c net: axienet: Autodetect 64-bit DMA capability? Yes of course. I will fix it in v3.
> + /* Reset core now that clocks are enabled, prior to accessing MDIO */ > + ret = __axienet_device_reset(lp); > + if (ret) > + goto cleanup_clk; > + > /* Autodetect the need for 64-bit DMA pointers. I would say the comment is now not fully correct. It probably should be extended to include 64 bit DMA. Andrew
On 22.06.2023 22:18, Andrew Lunn wrote: >> + /* Reset core now that clocks are enabled, prior to accessing MDIO */ >> + ret = __axienet_device_reset(lp); >> + if (ret) >> + goto cleanup_clk; >> + >> /* Autodetect the need for 64-bit DMA pointers. > > I would say the comment is now not fully correct. It probably should > be extended to include 64 bit DMA. Fixed in v4
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 3e310b55bce2..734822321e0a 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2042,6 +2042,11 @@ static int axienet_probe(struct platform_device *pdev) goto cleanup_clk; } + /* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret = __axienet_device_reset(lp); + if (ret) + goto cleanup_clk; + /* Autodetect the need for 64-bit DMA pointers. * When the IP is configured for a bus width bigger than 32 bits, * writing the MSB registers is mandatory, even if they are all 0. @@ -2096,11 +2101,6 @@ static int axienet_probe(struct platform_device *pdev) lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; lp->coalesce_usec_tx = XAXIDMA_DFT_TX_USEC; - /* Reset core now that clocks are enabled, prior to accessing MDIO */ - ret = __axienet_device_reset(lp); - if (ret) - goto cleanup_clk; - ret = axienet_mdio_setup(lp); if (ret) dev_warn(&pdev->dev,