Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3618744pxb; Mon, 24 Jan 2022 13:38:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz15+XXyFEnQENi3soFFMn2FtB/FyMjNiF04EwzdXJkSjn24Yz5qJ99gyXf7w2mZcUZxDTY X-Received: by 2002:a17:90a:d585:: with SMTP id v5mr294686pju.124.1643060333842; Mon, 24 Jan 2022 13:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060333; cv=none; d=google.com; s=arc-20160816; b=H9x2wnJoY+Fv4faRdxSNviEk11laLyhinkfvLaU25O30GDF9rOxryHRqhU4UaHwpcc 1yW9GTP97wCNw/6MjCwDtwdKM1vMH5izUmH5cZICI7IFOa6lUBexpu2jgL00SADzvc6k uFOlbQubRPZ7xfCBGL8w2p+OM+Kw0Z3Ietb7jL5KB90GsBAGipnkdsbyazeTb0iw47TZ vGHenWtU/Fg0t8tSxR8ET0DlDeyibraxzJjXP5PGEIjHPEStMyRCrzMvu5+BFznAugAq GFBIe3fhmY3v6fJ+/SrzIK0e5BaLPOvUB/9acGao45SqPjZfNrI2dehpH8yEKmay+0SE 4eLQ== 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=0cjxlWknyeLVv1lgV2At77WbAvomtAen6xONH7+x4MVoMhPqQq6DyjBrBlFB5XJVrC sbqx0BI9k22DyhranCEQDrmHs6Lj6sefNNjRPXMNCn9KmSrZQQjYNEJodQGWBF4F2BLc zLN0PzOYDr20jNk+YCfGjl6CCmeykUB5yotmEzhkju+VaDc2ZW3WO/q/DA4K4BXBtguO WdTNpi/Qt6/HiZSMijjMeKz9TRkg77WsGz7hgfedUrjutX0QPBhHBNETTAm97Fk3fFN4 CI22kyf4uZYkg/qOub0hTMmrxdNjiJggac9oplXxd+5YPIGWX0Y66a/MPkrJjz0es1V+ h0jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1txdVApD; 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 q6si1676908plr.359.2022.01.24.13.38.41; Mon, 24 Jan 2022 13:38:53 -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=1txdVApD; 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 S1450214AbiAXVUA (ORCPT + 99 others); Mon, 24 Jan 2022 16:20:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48374 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392457AbiAXUvP (ORCPT ); Mon, 24 Jan 2022 15:51:15 -0500 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 CCAE7B81063; Mon, 24 Jan 2022 20:51:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E517C340E5; Mon, 24 Jan 2022 20:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057473; bh=QQYbblQ35leF5mIDeINDGQFfwan87gWS7LaQi2QXxZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1txdVApDkGrpbneHEwbmecVV/7h9wD+k/cfuz1S5Ite1zEig/hxC8LwRJ6zjE27s/ 3fGug7zYhUEzVq4lqE0Fp6ycsrnK4x36orq8VSsuBKK4yVJmNypdCl2rq3UEb0b77O DouaohQRQul+68gWfGadraAib+/NnaIgwGNEyN8Q= 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.15 791/846] net: axienet: increase reset timeout Date: Mon, 24 Jan 2022 19:45:08 +0100 Message-Id: <20220124184128.245066759@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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;