Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3660651pxb; Mon, 24 Jan 2022 14:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4AAnXujAT/Tjq5GscKxZ52rGAZy4AKJ2YZk6m376kPabiEQ4Zy1H6DMBx91IH7sgcc6to X-Received: by 2002:a17:90a:7444:: with SMTP id o4mr430179pjk.65.1643064181851; Mon, 24 Jan 2022 14:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064181; cv=none; d=google.com; s=arc-20160816; b=MzitPYANMf6BggtxlNm1giZjl3ert98iJbI78+BCHn/MPXqPWvGD4YKzaKqo2QvzsW /OAUSok5Fx1WkF7pW5p6rRMFhYUI/c1x+TexnbqdD/kmepTHe354LBpvwz+Zz0luV6+p wIINL7wWxKzKcNjkotKHycq6QWJQMZMVk/Ll0wz7gWIZR4STxsYwo02qqL92WDZlhFSm pxXegitXIdrSyJHnu5bkJYcvgghKKfl4gnAOKTDLW0MUKp8mwfJCcH2nlToYf3Q4eROK LeCq8YbtrCaKncB3sptSOM8plcCuUEVKfSZdNzFuMTGaHPT122aOTuMGQoa7vCattJHc s0Nw== 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=C1B3bpbZe50pbNbbyj4QW4vlzdUwJvTPut8Xy3dJUZLU0jjCAEGBiWMFQIuRN0jg9m ONr9d7ZeVEJFCUTmyR1ehRYkGiyA7peohZr2pHivNDqh7BYQTIDPjDTGmuAvmNO65jQ/ EjxppRARAPsotH4bmj2F1BPNsgEc/1sateD7oJxXqc6RTm8EFVnOJf5ZjN1GPN2oW/WT tl4k6HxaDHvewZTvcrbYCWUEjJNmpjsl17D6gzQ6veOd9ZItE6nPaapIRiRNudzZAkhC kEF41FuZ7Boqs/Y5AK4wXnmdP77B/45kDEDAkGSc+BwRq8qhmPzS6LDssnxmmFfZ9is2 P1hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xC5WVIK8; 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 oc10si588842pjb.183.2022.01.24.14.42.50; Mon, 24 Jan 2022 14:43:01 -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=xC5WVIK8; 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 S1836604AbiAXWkS (ORCPT + 99 others); Mon, 24 Jan 2022 17:40:18 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52096 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457434AbiAXVlj (ORCPT ); Mon, 24 Jan 2022 16:41:39 -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 EC971B8121C; Mon, 24 Jan 2022 21:41:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FE3C340E4; Mon, 24 Jan 2022 21:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060496; bh=QQYbblQ35leF5mIDeINDGQFfwan87gWS7LaQi2QXxZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xC5WVIK8pP/qk/JZV2filScwsAFq1NL7Ail9Nbm0hdyks/GUzkUEO1yvJfF0DEctd RnNqfyffKmu8/2QS1GMhbpuNhYcKtqzUHu4rBnKDaRj1SC0wd9askaPFiclmnLv5Z0 RpRNjv+KK6jDVsLOEjR2T548foj+VSYRJQ3q2W14= 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.16 0967/1039] net: axienet: increase reset timeout Date: Mon, 24 Jan 2022 19:45:56 +0100 Message-Id: <20220124184157.789743232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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;