From patchwork Fri Mar 13 13:39:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 222551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60C9BC10DCE for ; Fri, 13 Mar 2020 13:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39BB32074A for ; Fri, 13 Mar 2020 13:40:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="cLQ/sosc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbgCMNkM (ORCPT ); Fri, 13 Mar 2020 09:40:12 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:59794 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726683AbgCMNkL (ORCPT ); Fri, 13 Mar 2020 09:40:11 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 13428C0FAB; Fri, 13 Mar 2020 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1584106810; bh=E54LODA3Nkm7g3IJUjmzcbT3oFt34YuZSG/e5frmYec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=cLQ/soscwtaub51bpfwizsfAwO7XVSBCHOXGVXUI/8JiqkP5X7tNa8VZg7E+b1LB8 PF4nkEsBBO4yQzq3pchbymYiEi36wB23HiQkk/IvRty1a2j6hCDVSIkyWsRcsudE72 Q9RtX9qzkd02px/ehn+BEm+07sUevi0sBHbEnfNg0i1DyVX08Zbf6ZNu+uV+CGwb/E GKdw240JQ7ro4pKv+26yFBu5VaPG7+r3b+PjV36qs+7mMEKa8+EzcfgjmBcdFRh5xy H+ktP/tQT8cZUZiheZeklfjLwtvmm3CyRxJVjE5w++ILaLEvJNzRZjDfkfn1bB6mrY GtulGVW0RodRg== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 6DA05A005D; Fri, 13 Mar 2020 13:40:08 +0000 (UTC) From: Jose Abreu To: netdev@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S. Miller" , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/4] net: phy: xpcs: Clear latched value of RX/TX fault Date: Fri, 13 Mar 2020 14:39:40 +0100 Message-Id: <50f3dd2ab58fecfea1156aaf8dbfa99d0c7b36be.1584106347.git.Jose.Abreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When reading RX/TX fault register we may have latched values from Link down. Clear the latched value first and then read it again to make sure no old errors are flagged and that new errors are caught. Signed-off-by: Jose Abreu --- Cc: Jose Abreu Cc: Andrew Lunn Cc: Florian Fainelli Cc: Heiner Kallweit Cc: Russell King Cc: "David S. Miller" Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/mdio-xpcs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index 973f588146f7..a4cbeecc6d42 100644 --- a/drivers/net/phy/mdio-xpcs.c +++ b/drivers/net/phy/mdio-xpcs.c @@ -185,6 +185,7 @@ static int xpcs_read_fault(struct mdio_xpcs_args *xpcs, return -EFAULT; } + xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT2); ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT2); if (ret < 0) return ret; From patchwork Fri Mar 13 13:39:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 222552 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF669C4CECE for ; Fri, 13 Mar 2020 13:40:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7CEC20749 for ; Fri, 13 Mar 2020 13:40:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Pzqo3QBN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbgCMNkN (ORCPT ); Fri, 13 Mar 2020 09:40:13 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:59800 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726495AbgCMNkL (ORCPT ); Fri, 13 Mar 2020 09:40:11 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 16DD1C0FAF; Fri, 13 Mar 2020 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1584106810; bh=ST+X4UnqMFXVp07BI90fmUYVsZvY74GXZgG0KxD/zzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Pzqo3QBNM0LemVYxpUtRn2N/8EqcdycybF+g2FeQZyJOc6Pkjg94j8E2di9eawu6n rWpsts3DEYiUT6i9lsB2D7zBzcHTGaRTcV95Knvxe3Zjv7CBJTl27oWiNZTUL2n5xG hoIgTe5gZRjd72BdUY1mPqkxLGYK3AI9Iv8Nxx3a7HkUTEpTiFW7OhVVgSnMmjKrZA 0TkFpPTDywkPfwSCcDFWdLNHj4Q3Jez67fW8uYEBlwUMKAcFOp0wMS08nUDocWPZEi czBs235OhaAbK+E59Ja/JP7oUybKnJMWy9H0WhFeBvCTzn88QETWq/8Ilc3ktK+7f/ KDaTAUgarqdqQ== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 9D85BA0067; Fri, 13 Mar 2020 13:40:08 +0000 (UTC) From: Jose Abreu To: netdev@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S. Miller" , linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/4] net: phy: xpcs: Reset XPCS upon probe Date: Fri, 13 Mar 2020 14:39:43 +0100 Message-Id: <422e8e739c9a2a2e64ac5eac44436e20f2a03174.1584106347.git.Jose.Abreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Reset the XPCS upon probe stage so that we start it from well known state. Signed-off-by: Jose Abreu --- Cc: Jose Abreu Cc: Andrew Lunn Cc: Florian Fainelli Cc: Heiner Kallweit Cc: Russell King Cc: "David S. Miller" Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/mdio-xpcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c index 83ced7180a44..7960dc52c4bd 100644 --- a/drivers/net/phy/mdio-xpcs.c +++ b/drivers/net/phy/mdio-xpcs.c @@ -595,7 +595,7 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs, phy_interface_t interface) match = entry; if (xpcs_check_features(xpcs, match, interface)) - return 0; + return xpcs_soft_reset(xpcs, MDIO_MMD_PCS); } }