Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3663322pxb; Mon, 24 Jan 2022 14:47:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdWkfuYfAjimV/+hyqB47QWEwN0eLrfBNc0NwfH7m+yhXMLb20Y5edCvmvUnixfgPaTvin X-Received: by 2002:a05:6a00:15d1:b0:4c1:e1d2:347c with SMTP id o17-20020a056a0015d100b004c1e1d2347cmr15887892pfu.29.1643064450563; Mon, 24 Jan 2022 14:47:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064450; cv=none; d=google.com; s=arc-20160816; b=kWzeXYXDy3DH2LhLJhjV04j9NpQdhnprqzhFofN3MZ39TPGUth3Srn8ISioYagxJAm vbhhR+lbRRDrEoZb/1UZbC7rPyIqRx1HDmp7SL8Xask4TBUDonl8AB3Z3MN9bKnO2f5b QuoG9q4dS/DvFjm59q7IvvVDqLLJ3ghJ+rBZCppLfdjuwsm/ZWBESaToCI3jcQunq7Vg HcGLrvFwovHeH/7ibkDVboCI3Ny9tmQp6Y7ONcwoy/R6sYbWmSdRYRr0NGzOMHeEsQSB RvrO9sc2GW9j+LIyk38c0xHR7RL+f/MIks6Y7MuLvmAsSyLSZn+HBX1teItX7X1iN2wD OQdg== 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=xb9NzBmbnJmV6qQwMQQYhG8y8EdI3GDRVe8TYNiMkL9sDCbW7m0VwPvXv4y7TdZ8f6 C9ubXrq8riFsaWjS29ZeGmSIp6VI7w/H3dG3xMcacfn0c4Dtg0X3JXTpER9eehcifHh5 djjjjg5abGjNd2+mLU+muWbJmAvUpUNj4+QPHjNGon9Z1lKZarORkYNVXEI3jvn9tAV4 0/OYm/yvsgifK3v02vbgJ6zHbdzM0RGnGZw06H3eOwxdGX/4j00e1mHXW4rQzhTYi1KO fpJJLgCG3QT7/F/JG1kiQ8Cuh78gpQ8X0JK3pHmhmkQhIA987elZWLF0xip7Pi+28Q6+ 6s6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GdO2GWew; 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 l1si523374pjm.50.2022.01.24.14.47.18; Mon, 24 Jan 2022 14:47:30 -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=GdO2GWew; 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 S1836757AbiAXWkp (ORCPT + 99 others); Mon, 24 Jan 2022 17:40:45 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59772 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457483AbiAXVln (ORCPT ); Mon, 24 Jan 2022 16:41:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 11C7C61526; Mon, 24 Jan 2022 21:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED0F0C340E4; Mon, 24 Jan 2022 21:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060502; bh=hgTMhcKXn0qipvk81yvlR5VaiWMS55P9EIckJyt9sxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdO2GWewTxxGm2rMqqELfQ++O/fS7YKP2+9gy+z4GMFfM1bC1ndCrbJFalFlXQxaf mgDl8rA+MRwmY7mQNv8PiQo3ZnqdBlLuIh/HohkOHZfp1GDZ9TmREilxVJVizORs4B dFdZQC4wB0mLeNIkgaGtAorpp+TATUbhs9Ih8If4= 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 0968/1039] net: axienet: Wait for PhyRstCmplt after core reset Date: Mon, 24 Jan 2022 19:45:57 +0100 Message-Id: <20220124184157.828788785@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 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; }