Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3982394pxb; Tue, 25 Jan 2022 00:37:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhy0AwHJSqR99LLhZujMGEboB2j9OCIp0MKnn/OAwaulGB1yrogCJw34Kwv5uG/PoP5AUu X-Received: by 2002:aa7:c546:: with SMTP id s6mr19369804edr.1.1643099841073; Tue, 25 Jan 2022 00:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099841; cv=none; d=google.com; s=arc-20160816; b=WU2Ja0Gz7kH5XRE8ECAxw+XDxxMrkpwqX9L+0LzbQ4WmAaZKwNGPMJNa0YIJ/7qnX4 0Iemh3iC5zwehssiHMUmz542WhXY7uR8qkKuknflkbl1vn/NJCrmercFEWtAjOG0o2+8 05kTYD4TV1ifNLHc542fCkuTaL3HKTgFqKV2yJzB6H2V3pXTBeCRNrwdVv2shKN9p0jI Er1yF0M3taz7x9X+AJ59b7f3teU5R06rQXml/NTHlEByIuSPInRBKwr2ZZN839CBcsd4 pss2mZbYEWxLZ0wbaXs7sh/P1gduh0/zfJj/SGAJMwPbGNCAQO0XsN40rM4NUn6h19LW CWBw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4MTk6ANjZYmFSdq+0/4b82h+SUaCLzC1gAytvBsFVU4=; b=KZ0wJdU+JWGqZi3f1o0NO3tRT0CvtnVTewX2BuQgCI2UKQje1CCAijxf1mwjXZS+PP ++y9TLeW4Gmjva41lYgWWr9zzeQkwsRm/R4QECFNdpgqUfaBXtYi1dyesxsVn/As+jAQ E55gxMs3mOH3OmtR5MoRBfU9jNwhySDm6tLHH+Xs1y080bLJv06dSAg9auHF1qK9n9DP PwWSBf9bTdrSK04AlJK48xq2hT4mPLDZvnLM8+zY2c5J5hW4owRQ8HmFo5oWDb8Ka0VA xcEBmNMSLcKTbWBOE3niCu3nEYafIynW73QjZmSYFa6abSZH70gn0Y56dnK2Fy//e6yz E9PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xT0ymktv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si9522584ejt.449.2022.01.25.00.36.34; Tue, 25 Jan 2022 00:37:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xT0ymktv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1315328AbiAYCxN (ORCPT + 99 others); Mon, 24 Jan 2022 21:53:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446089AbiAXVGn (ORCPT ); Mon, 24 Jan 2022 16:06:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FEAC06136B; Mon, 24 Jan 2022 12:07:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F842B810BD; Mon, 24 Jan 2022 20:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E728C340E5; Mon, 24 Jan 2022 20:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054840; bh=QQYbblQ35leF5mIDeINDGQFfwan87gWS7LaQi2QXxZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xT0ymktvrfA6sG0TT+iKfB8fTas5BsE3O//P2oWzUAxsIw7JxYDdOjCqLJtqVCYbt H/UxeblPCOwzfmO9UNNykZ7mvvQpPzFMQihhm7qmC5VxNAmPSxHkO5qMM9TZt/tWfj Aiql5XJeIMAB4ZGnBnTT3lEVufgPnCUhCqfjABVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.10 520/563] net: axienet: increase reset timeout Date: Mon, 24 Jan 2022 19:44:45 +0100 Message-Id: <20220124184042.421883072@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Hancock commit 2e5644b1bab2ccea9cfc7a9520af95b94eb0dbf1 upstream. The previous timeout of 1ms was too short to handle some cases where the core is reset just after the input clocks were started, which will be introduced in an upcoming patch. Increase the timeout to 50ms. Also simplify the reset timeout checking to use read_poll_timeout. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -496,7 +496,8 @@ static void axienet_setoptions(struct ne static int __axienet_device_reset(struct axienet_local *lp) { - u32 timeout; + u32 value; + int ret; /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending @@ -506,15 +507,13 @@ static int __axienet_device_reset(struct * they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, XAXIDMA_CR_RESET_MASK); - timeout = DELAY_OF_ONE_MILLISEC; - while (axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET) & - XAXIDMA_CR_RESET_MASK) { - udelay(1); - if (--timeout == 0) { - netdev_err(lp->ndev, "%s: DMA reset timeout!\n", - __func__); - return -ETIMEDOUT; - } + ret = read_poll_timeout(axienet_dma_in32, value, + !(value & XAXIDMA_CR_RESET_MASK), + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAXIDMA_TX_CR_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: DMA reset timeout!\n", __func__); + return ret; } return 0;