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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BBADECAAD4 for ; Tue, 30 Aug 2022 12:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230231AbiH3MRS (ORCPT ); Tue, 30 Aug 2022 08:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbiH3MRO (ORCPT ); Tue, 30 Aug 2022 08:17:14 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A24AB41E; Tue, 30 Aug 2022 05:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=aIP+WVaMc1nJy/asMHv8LFrhhyHBgcCdUD1nWkCarDY=; b=jRAgsNifyCmFk62Jvng7ixAvg8 MyaTIB0XbeZftng3h67Jl4PHyE+37F9JMw2mG++qrI4Ex2a/mFVUxpXeBer066eqE8A3R6Aifp2WB vnn2etoh/Yoq6H5uzR5YbS7lXoOvHCduPqVsqGS4+y+K/ty+BcEX6gXXS+yb+6ZFLfv4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oT0Au-00F4O3-1P; Tue, 30 Aug 2022 14:17:00 +0200 Date: Tue, 30 Aug 2022 14:17:00 +0200 From: Andrew Lunn To: "Jamaluddin, Aminuddin" Cc: Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Ismail, Mohammad Athari" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , "Tan, Tee Min" , "Zulkifli, Muhammad Husaini" Subject: Re: [PATCH net 1/1] net: phy: marvell: add link status check before enabling phy loopback Message-ID: References: <20220825082238.11056-1-aminuddin.jamaluddin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > @@ -2015,14 +2016,23 @@ static int m88e1510_loopback(struct > > phy_device *phydev, bool enable) > > > if (err < 0) > > > return err; > > > > > > - /* FIXME: Based on trial and error test, it seem 1G need to > > have > > > - * delay between soft reset and loopback enablement. > > > - */ > > > - if (phydev->speed == SPEED_1000) > > > - msleep(1000); > > > + if (phydev->speed == SPEED_1000) { > > > + err = phy_read_poll_timeout(phydev, MII_BMSR, > > val, val & BMSR_LSTATUS, > > > + PHY_LOOP_BACK_SLEEP, > > > + > > PHY_LOOP_BACK_TIMEOUT, true); > > > > Is this link with itself? > > Its required cabled plug in, back to back connection. Loopback should not require that. The whole point of loopback in the PHY is you can do it without needing a cable. > > > > Have you tested this with the cable unplugged? > > Yes we have and its expected to have the timeout. But the self-test required the link > to be up first before it can be run. So you get an ETIMEDOUT, and then skip the code which actually sets the LOOPBACK bit? Please look at this again, and make it work without a cable. Maybe you are addressing the wrong issue? Is the PHY actually performing loopback, but reporting the link is down? Maybe you need to fake a link up? Maybe you need the self test to not care about the link state, all it really needs is that packets get looped? Andrew