From patchwork Tue Nov 8 07:40:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aminuddin Jamaluddin X-Patchwork-Id: 16916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2551480wru; Tue, 8 Nov 2022 00:00:56 -0800 (PST) X-Google-Smtp-Source: AMsMyM6SevdB+aVZI02BTucYxV7y3a6SuZKjtcabM0WekFK8qXlYdCUjIjmQcww9lqnROF9H61Z8 X-Received: by 2002:a50:ee0a:0:b0:463:4055:9db4 with SMTP id g10-20020a50ee0a000000b0046340559db4mr48860770eds.421.1667894456614; Tue, 08 Nov 2022 00:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667894456; cv=none; d=google.com; s=arc-20160816; b=SiyQD+C0VI0I56krmG9ol5Wcoht02JWdWpkuQVOhwdzHPjAxDnp+L25rX/vrgD8JBS d9YfmdJUkU6qOgt1mZMnzXyju6lOq9QNK6Bx+9AmG+t9aOVGVGNLC2deyhTRglQ8/VKz +rEmrSsuUt/rOXX65ENccae65N/lw5QRJu5f0dq8/Rbc7CUHxmD0C/uh6qtI/2AEq+GA +GBWjmh9+HAVOyrKnIiJcQ/5D5b/mS8dX5AyTQV6ADpt9poZvRf0sE0njeDmFepf0DJ4 VSzJ2vO5d2Gusiv0onCqBNkGdFX8+q7UaQ5bVtKAe27euiXI1H8RhStriX9OxPCNYBX+ N50A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=0mxB8jxkqPkwKw3XYDyndGVCp9oDzo2MFZ8I6TsQVY8=; b=natYFwQcg85fDN2UZwYXll+rv5UEh0hrFT6AMGAMPiITVDog/Fm8RMrbL3RpblGw7n 3O0pJr0ajSRW3IqQPmrJRxk8CWSmBO+qOcDF3vN0gOHz1y1AnFCz4+tBMZateyl1LIRD N12u+gBySc3Kjhds++c5ccGfs5D8W++OpCCGhRGXABpj4y5rM9LiVmOQd6pOjeweMnKs 2Kk2EQalWG0vfH+3gsyUTetYgRGpX6Ejh0nHSTTAB8LsZGWgBCFTua1U1bTJD2p7iSef dzfhcYZe0Tv36gM0raXXWZbNfHqr2EIcEOiGOAbDMB7UcTp3Nj4nKYADOaryjQ21TkJ2 4QqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L6BOsDxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a170906795400b007ae21bbb010si13467507ejo.462.2022.11.08.00.00.29; Tue, 08 Nov 2022 00:00:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L6BOsDxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233641AbiKHHpN (ORCPT + 99 others); Tue, 8 Nov 2022 02:45:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233593AbiKHHos (ORCPT ); Tue, 8 Nov 2022 02:44:48 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F75D32057; Mon, 7 Nov 2022 23:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667893454; x=1699429454; h=from:to:cc:subject:date:message-id; bh=T7jYiJ8YBdJidKEszRodAoGwDG2x93waptWQVrXdBTY=; b=L6BOsDxMrVcqfYzJrASN1FLimz7EjXQx6Dj52MMyP9Eh5CFyaO2G0Boh z3MVbhHKDk58TbGb4MUAlRtxUt9vjhqrlAT08GaWmmgLsRHlYhnNR83k9 HN9WvkBeK1yVHqH2UbhbrS4cPfJr/eJshO9q1Lx9DbtKRVGeR46kFy2r4 DJJpoQPhQtNvu5SxjiSoc3j6Lcy9Q6fjKDRb7EPMIVFHjzLN1gV8EigHl mAbx/ImTKRWxFZPE6UwUR8vUPfZpiMXpnKenHT0/JBqLsWUuZ0+j9xV3G YSe95Jgr5x9rPvaX2aHEF3KUlUwZFIM7LIj78s445VjPWAQkm8KYPin94 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="311786135" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="311786135" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 23:44:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="811147737" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="811147737" Received: from aminuddin-ilbpg12.png.intel.com ([10.88.229.89]) by orsmga005.jf.intel.com with ESMTP; 07 Nov 2022 23:44:09 -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-next v2] net: phy: marvell: add sleep time after enabling the loopback bit Date: Tue, 8 Nov 2022 15:40:05 +0800 Message-Id: <20221108074005.28229-1-aminuddin.jamaluddin@intel.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748914097603180392?= X-GMAIL-MSGID: =?utf-8?q?1748914097603180392?= 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. --- V1: https://patchwork.kernel.org/project/netdevbpf/patch/20220825082238.11056-1-aminuddin.jamaluddin@intel.com/ --- 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 --- 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 *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); + err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, + BMCR_LOOPBACK); - 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 = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); if (err < 0)