From nobody Mon Apr 13 14:26:27 2026 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 1E33CC433FE for ; Mon, 14 Nov 2022 06:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235887AbiKNGxN (ORCPT ); Mon, 14 Nov 2022 01:53:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235840AbiKNGxK (ORCPT ); Mon, 14 Nov 2022 01:53:10 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCAF3BE22; Sun, 13 Nov 2022 22:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668408789; x=1699944789; h=from:to:cc:subject:date:message-id; bh=OMAW/EH2o+W96Ahwt8yKZ5v2TWWf93Wuusd98lfZN38=; b=nwP3aopwkMfQU2Pr0h78Ia8BeEa8iSMYPM0F24eCCI7VbXtvDaq+0K6m R2BDsn3scQ+3gepI8QIykWQgmZ4rKZgUtsLCSD/Ot0ELK81z+6h9/u/Op vR1+Gt1IOp6PXBMRGUMwR+wfSY1ojZFf9AQPTSjjLiqz8AOmFmzAQm6Tn Kd8CANExA8EXuOsNP0y+jyolDU6Hg1eHepAgIBM29ZUMK4T9909pQ8K+U Te2MpEBxdRRtnr1GLLdWaCbPKV7J9G/AzDyTp5AX1TksC5Gy73UR8ZO6g 8t25TSUXipKAFSNPA1AwfvJCTMkbxzYdFkJnV1ed/sL6agp0vFJjNmoH/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10530"; a="313701420" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="313701420" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2022 22:53:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10530"; a="589257469" X-IronPort-AV: E=Sophos;i="5.96,161,1665471600"; d="scan'208";a="589257469" Received: from aminuddin-ilbpg12.png.intel.com ([10.88.229.89]) by orsmga003.jf.intel.com with ESMTP; 13 Nov 2022 22:53:05 -0800 From: Aminuddin Jamaluddin To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mohammad Athari Bin Ismail Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, tee.min.tan@intel.com, muhammad.husaini.zulkifli@intel.com, aminuddin.jamaluddin@intel.com, hong.aun.looi@intel.com Subject: [PATCH net v3] net: phy: marvell: add sleep time after enabling the loopback bit Date: Mon, 14 Nov 2022 14:53:02 +0800 Message-Id: <20221114065302.10625-1-aminuddin.jamaluddin@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Sleep time is added to ensure the phy to be ready after loopback bit was set. This to prevent the phy loopback test from failing. Fixes: 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback") Cc: # 5.15.x Signed-off-by: Muhammad Husaini Zulkifli Signed-off-by: Aminuddin Jamaluddin --- V2 -> V3: Fix review comments from Jakub V1: https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.110= 56-1-aminuddin.jamaluddin@intel.com/ --- --- drivers/net/phy/marvell.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index a3e810705ce2..860610ba4d00 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -2015,14 +2015,16 @@ static int m88e1510_loopback(struct phy_device *phy= dev, bool enable) if (err < 0) return err; =20 - /* FIXME: Based on trial and error test, it seem 1G need to have - * delay between soft reset and loopback enablement. - */ - if (phydev->speed =3D=3D SPEED_1000) - msleep(1000); + err =3D phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, + BMCR_LOOPBACK); =20 - return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, - BMCR_LOOPBACK); + if (!err) { + /* It takes some time for PHY device to switch + * into/out-of loopback mode. + */ + msleep(1000); + } + return err; } else { err =3D phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); if (err < 0) --=20 2.17.1