From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 461BCC433DB for ; Tue, 30 Mar 2021 14:50:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0855619CB for ; Tue, 30 Mar 2021 14:50:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0855619CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UHEaj+D83HA94zw3lMyaCMLkQTohi2pdzod468HJHec=; b=CAZyulv2TIYDGunE+8RDEIBz1 DI/FPkzEcFG16nNi25OoSvImt/Of9w5SAMA1x4IB6PyoD+4zG9ESjpnfhOrLKNdL+ViO2ZmI/JRmH lAM0U97HI1U0BFdPrh1EwIgBWA3rlWeXvXPhVu6CQx/TobKjVGElm/z8G4pJwH/6GP7gC2V45bAMg DQgtE2uu7xP0j/I4dn2UoveNsgzX7C3fFV4WXHFVwzdw/J9GC/0nyIktfalrqrYo76vFWh4qpmXNE oZWvsBbs01Xh9Y+8MHtpocI2DAoxwglRyxFStfaZnQwcNhGy8MQV9HDPZYBrJokyzCCbSvGGC+Qjq i4chcIOzQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRFgW-0043B6-Jd; Tue, 30 Mar 2021 14:49:36 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRFgQ-0043Ae-Nw for linux-arm-kernel@lists.infradead.org; Tue, 30 Mar 2021 14:49:33 +0000 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lRFgO-00E2Bg-LN; Tue, 30 Mar 2021 16:49:28 +0200 Date: Tue, 30 Mar 2021 16:49:28 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: Shawn Guo , Sascha Hauer , Florian Fainelli , Heiner Kallweit , Fugang Duan , kernel@pengutronix.de, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, Fabio Estevam , David Jander , Russell King , Philippe Schenker Subject: Re: [PATCH net-next v1 2/3] net: phy: at803x: AR8085: add loopback support Message-ID: References: <20210330135407.17010-1-o.rempel@pengutronix.de> <20210330135407.17010-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210330135407.17010-3-o.rempel@pengutronix.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_154931_052044_84505DE8 X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 30, 2021 at 03:54:06PM +0200, Oleksij Rempel wrote: > PHY loopback is needed for the ethernet controller self test support. > This PHY was tested with the FEC sefltest. > > Signed-off-by: Oleksij Rempel > --- > drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index d7799beb811c..8679738cf2ab 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -326,6 +326,30 @@ static int at803x_resume(struct phy_device *phydev) > return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); > } > > +static int at803x_loopback(struct phy_device *phydev, bool enable) > +{ > + int ret; > + > + if (enable) > + ret = phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE); > + else > + ret = phy_set_bits(phydev, MII_BMCR, BMCR_ANENABLE); Auto-neg might of been turned off when entering self test. So you should leave it off when existing self test. Or maybe call phy_config_aneg() which should reconfigure the PHY back how it was. Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 23058C433DB for ; Tue, 30 Mar 2021 14:50:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F10B8619D3 for ; Tue, 30 Mar 2021 14:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232020AbhC3OuE (ORCPT ); Tue, 30 Mar 2021 10:50:04 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:54972 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbhC3Otc (ORCPT ); Tue, 30 Mar 2021 10:49:32 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lRFgO-00E2Bg-LN; Tue, 30 Mar 2021 16:49:28 +0200 Date: Tue, 30 Mar 2021 16:49:28 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: Shawn Guo , Sascha Hauer , Florian Fainelli , Heiner Kallweit , Fugang Duan , kernel@pengutronix.de, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, Fabio Estevam , David Jander , Russell King , Philippe Schenker Subject: Re: [PATCH net-next v1 2/3] net: phy: at803x: AR8085: add loopback support Message-ID: References: <20210330135407.17010-1-o.rempel@pengutronix.de> <20210330135407.17010-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330135407.17010-3-o.rempel@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 03:54:06PM +0200, Oleksij Rempel wrote: > PHY loopback is needed for the ethernet controller self test support. > This PHY was tested with the FEC sefltest. > > Signed-off-by: Oleksij Rempel > --- > drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index d7799beb811c..8679738cf2ab 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -326,6 +326,30 @@ static int at803x_resume(struct phy_device *phydev) > return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); > } > > +static int at803x_loopback(struct phy_device *phydev, bool enable) > +{ > + int ret; > + > + if (enable) > + ret = phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE); > + else > + ret = phy_set_bits(phydev, MII_BMCR, BMCR_ANENABLE); Auto-neg might of been turned off when entering self test. So you should leave it off when existing self test. Or maybe call phy_config_aneg() which should reconfigure the PHY back how it was. Andrew