From patchwork Thu Jun 22 19:22:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 111796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5307652vqr; Thu, 22 Jun 2023 12:55:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5g+oUSdV8pMECHi4BriPxP8quGvyxwwF4DRltg5h6x4bDXkQIFGrrQ4vkBVecvLlAKNjFt X-Received: by 2002:a05:6a20:8f17:b0:11f:691d:2333 with SMTP id b23-20020a056a208f1700b0011f691d2333mr16938539pzk.54.1687463754757; Thu, 22 Jun 2023 12:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687463754; cv=none; d=google.com; s=arc-20160816; b=L8LnQQy1O3mQJakJxRV+bgV777OK5jpY7JJvUWvBEKXxL9BVQeeHQWr7TiJqVsPh5o D48Zvk3voOa9MEDlt+uzQrhLhT3EX+YbIzOE+SM36B8TBPWcDdi/AJY6zzY53ynPMN/+ 3vuN2bP4IX0muo7ekY7N98i45tj5tOFEqnmDrQ7TNxl2OJYQfZD97ip4bMIkQzJCtQoN +sXXAu6IimIBfr2JZ6pMDLCLI80yMQC/ruGcOUKNUWozR+Ss3+5Bq/+AycRASsyjzira xvZNbiuu84xJWO5ZSrlXZkqkZa9D9QcsUzNruKd4Pn6WdCFpXgkENqfvgqS/MflVnYpf 2+5w== 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=DP2aFJtkmkPxyLzd3TP0gmVk+NDndbi0hOnw9eCQjcA=; b=W/0g+Or46sELNKEsQpxrfw5FbZ+DGyK05vJp+2FicGz4rv65Qwz+pLrGXQ6tKifodN +J7kVvepqphRdovgKVsLfN0XzHEYmCeQwfKRUZYXtN6XIeT0t6GQW2H+wWk0/63cDzXA 4eKFyw4RTXQMQYCpeMbxzkHoEQEFseCfJeqF4MsXn0kjj9f9pRxiW9c3x7uUJ/rVcUpw YHxe7dSOu9QDexjQiLECCxnt8wlPbHGDAhEhOE54Ce/Hz/EnDkt0LfR2yK83u0TqaolF WHl0LvIaqdDbSotGl+SyBy80tpTkvqvqbGhRV1d9G1CHV5zPNdEqmVDlT3bu4eeFGLZ9 Fh/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inbox.ru header.s=mail4 header.b="FTTx7r/Z"; 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 k3-20020a170902f28300b001ab0c00aec4si6788361plc.482.2023.06.22.12.55.42; Thu, 22 Jun 2023 12:55:54 -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="FTTx7r/Z"; 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 S231522AbjFVTWz (ORCPT + 99 others); Thu, 22 Jun 2023 15:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjFVTWx (ORCPT ); Thu, 22 Jun 2023 15:22:53 -0400 Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B23441A3; Thu, 22 Jun 2023 12:22:50 -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=DP2aFJtkmkPxyLzd3TP0gmVk+NDndbi0hOnw9eCQjcA=; t=1687461770;x=1687551770; b=FTTx7r/ZThWpG/LoGp+TFmzz2PcUeAwX9VmldpVsdsN9mtOcv5O7l1cCyfZdZrSeSvH2cvSCr4mWcGr0jDLFM7TKgg3/Vfp/MG/RJABAmbx/3dfk7wUB+aVWi077A4d3+TqBe5bWbq5gMIWcOl551WsQ5nf49gdfh5djogvONKqMVmXtv2+nFNxAt+pHIavuZSxpdBO7c8Py9D9lT9rL4luKsNXaZ2Gcss3UFjuXsA4jpZHlXy5BvVFkGeJaIGDeFPOYaOoGWH7EhIS7jo4EgReAWMsT2LPTWLfFnHXIqLOqEC8eOVCfYlSCGbwyAU4EbaKP5QBMYDcc0c/X4dr7uA==; Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1qCPtI-000166-9f; Thu, 22 Jun 2023 22:22:48 +0300 From: Maxim Kochetkov To: netdev@vger.kernel.org Cc: Maxim Kochetkov , Robert Hancock , Radhey Shyam Pandey , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michal Simek , Andre Przywara , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/1] net: axienet: Move reset before 64-bit DMA detection Date: Thu, 22 Jun 2023 22:22:45 +0300 Message-Id: <20230622192245.116864-1-fido_max@inbox.ru> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Authentication-Results: smtpng3.m.smailru.net; auth=pass smtp.auth=fido_max@inbox.ru smtp.mailfrom=fido_max@inbox.ru X-Mailru-Src: smtp X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95D99986233CC4DDCD825FF3AA070ECA3C2EE242F31DB0C21182A05F538085040073D0E8D12A2D78F4B42AA8A878AB305792FE63BB0E7FDDDC9ADD231A8CD152C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78C6616F30072131EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E724D704EAF55A818638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E8A6527D39C418ACBD59F620FC74EEC56F9789CCF6C18C3F8528715B7D10C86878DA827A17800CE767883B903EA3BAEA9FA2833FD35BB23D9E625A9149C048EE1E561CDFBCA1751FBDFBBEFFF4125B51D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B89C3E995CBB71A93A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C468D16C903838CAB43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A56BA840BED89C6299901EC1DEE3F3305E17CBEFDF7E0A7940F87CCE6106E1FC07E67D4AC08A07B9B0A6C7FFFE744CA7FB9C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFB8B6392F04A2BEA40076E750EE125CC8FA124D79BBB7AFE643172A17CB2DB903A30287D0F4871F18B05B57073EAFDF97EBCADA21C28D8569D75048356C5CA95821BEC6C0C71ED4F84C41F94D744909CEE921556F0E976A29E6EC0772259F8F8F8815B87D7EC76CB9 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojB41c+mu8Ac9oQf9MPmksBw== X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986B854CA481D18055A7E573327C5F59393698CC072019C18A892CA7F8C7C9492E1F2F5E575105D0B01ADBE2EF17B331888EEAB4BC95F72C04283CDA0F3B3F5B9367 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769433994012600489?= X-GMAIL-MSGID: =?utf-8?q?1769433994012600489?= 64-bit DMA detection will fail if axienet was started before (by boot loader, boot ROM, etc). In this state axienet will not start properly. XAXIDMA_TX_CDESC_OFFSET + 4 register (MM2S_CURDESC_MSB) is used to detect 64-bit DMA capability here. But datasheet says: When DMACR.RS is 1 (axienet 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 64-bit DMA will not work. So move axienet reset before 64-bit DMA detection. Fixes: f735c40ed93c ("net: axienet: Autodetect 64-bit DMA capability") Signed-off-by: Maxim Kochetkov Reviewed-by: Robert Hancock Reviewed-by: Radhey Shyam Pandey --- 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,