Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3684816pxb; Mon, 24 Jan 2022 15:18:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkpLwMS6zo+eBzk6QdHWNEXeURXPOmSU28meTHmzcgktzi9MXHgJpY4hOB0GdxiO8ipdix X-Received: by 2002:a17:902:7681:b0:149:bb15:c53f with SMTP id m1-20020a170902768100b00149bb15c53fmr16399745pll.159.1643066288329; Mon, 24 Jan 2022 15:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066288; cv=none; d=google.com; s=arc-20160816; b=pOjn3S+9CeouUBgTLGQ6knwxuMNLoAO1Ixdzwa4ewSKevcJ46dVTXWiBEfKXF5HPlm epYLf7aFq8qieYkkb62fdd9rkXRWnCvuPtN4jG5LBqi2Fs/ME8PoGrqM65Ja01arenDE 8agaf5r0OgCPE71cXAXmIFQ91RxS34n5Vi+SfHk90TjCOvnKJpuhHNRvbbc8J4cF81sc kcw9iuEGDPTwcGqtVV2NqJjnAmmb3UFUM3tzW3rh1r0pmEkpGe8SpRVVkL3g67LeGAvr Cf9foE+xSV3DWj1JzXzJJs+bjFKg/JwpTb6BP/Hef9CI/mFmS66xpVS8jVqtZ3zDfH4c +5wQ== 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=4UL9L5qfcaV4fowKDFsQ+BFsHFPEp1N4TQUEevnSXFw=; b=JAQTfrDUIR+o0bR94JxNdhLM2jX2pQpTPBOMSqrhOB3uwtyAOfTkBH0ycJ/SDu2M9X Z0Cxc7GmV4Et82L8MjyAkDxBx2QfArgwA1SgVbOEmytWydXZqmlgHtJIoRuGBJva+XPg i5bv5JRvwohtOuvBRkxGYo+BPiSwBjEcQ1pWtVFMIdx++mUgr5lSCJZZ7OlTvyidrJX3 feVNSs5jWP0iAtS15EcC8NtyK9Sohn4yNwckmrfgz1yM67wiqsrTtIJmAip1P88d2lLK NxMcNUaTwkFC4+Vyrbtj9aN5o3S7s4irUex9J0hMQNcro3UBCflrIikZHQ01BEZQ/Qvn eTPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cVzk2u0P; 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 q11si9130203plx.96.2022.01.24.15.17.56; Mon, 24 Jan 2022 15:18:08 -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=cVzk2u0P; 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 S1845243AbiAXXLy (ORCPT + 99 others); Mon, 24 Jan 2022 18:11:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1584568AbiAXWVZ (ORCPT ); Mon, 24 Jan 2022 17:21:25 -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 1EF01C0424DD; Mon, 24 Jan 2022 12:51:19 -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 D9CE2B81061; Mon, 24 Jan 2022 20:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB04C340E5; Mon, 24 Jan 2022 20:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057476; bh=hgTMhcKXn0qipvk81yvlR5VaiWMS55P9EIckJyt9sxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cVzk2u0PzY/98LBanGWPMOzv1bTlqE3M/mr39WgW6gr5gczzP9eQgkos1e5IoE7iq 1wUk9hp4qj+AcJl+bbxGPrImjPg07AlevbR9tSuSVyaqTRd6ok+EPtw8v2pivPOix5 gH6D0f2XPnwU7Bul/Eld3NB8Fgvrl+oHC7lBYWLU= 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 792/846] net: axienet: Wait for PhyRstCmplt after core reset Date: Mon, 24 Jan 2022 19:45:09 +0100 Message-Id: <20220124184128.274931321@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 b400c2f4f4c53c86594dd57098970d97d488bfde upstream. When resetting the device, wait for the PhyRstCmplt bit to be set in the interrupt status register before continuing initialization, to ensure that the core is actually ready. When using an external PHY, this also ensures we do not start trying to access the PHY while it is still in reset. The PHY reset is initiated by the core reset which is triggered just above, but remains asserted for 5ms after the core is reset according to the documentation. The MgtRdy bit could also be waited for, but unfortunately when using 7-series devices, the bit does not appear to work as documented (it seems to behave as some sort of link state indication and not just an indication the transceiver is ready) so it can't really be relied on for this purpose. 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -516,6 +516,16 @@ static int __axienet_device_reset(struct return ret; } + /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ + ret = read_poll_timeout(axienet_ior, value, + value & XAE_INT_PHYRSTCMPLT_MASK, + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAE_IS_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); + return ret; + } + return 0; }