Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp363284pxf; Thu, 18 Mar 2021 02:07:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvgXvN4Yl+9B+b2Huvfz7doxnjm8zv/EKe/tgk8kdWsEOXZmTeL9cPss7bC99m83NOKa6z X-Received: by 2002:a17:906:9bc5:: with SMTP id de5mr40234812ejc.284.1616058438085; Thu, 18 Mar 2021 02:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616058438; cv=none; d=google.com; s=arc-20160816; b=NwNQWs4/JHKx+20nndYzA6T5QzJIBcva4d7dWdECtcPfGngRxKosw+yCcRjguiuVQS X+GI9gx6YC2n4py8xJCI0lupoOzKrd/uFpaIn41OOXdigou32JS+7rLdLJkw71U56QDo K66jVaJICxIo3s/xMTW7GW/Sto+ZZqJD9JFuyoFMuz91lhmg7/agjvR/p1eWmw4scqC0 L4Hj4db+fkQH320wkCj9oIZdLHeDHM+fuS8KMRh3SGunCwQ1z7dFTL5AbprPp0FwF18w Tiy0NsgZWQvkT1MbZGJZ+bdgXTc6FroJDhmIQkFio9vrm2RpydQ8JZhM9TPTOvFlC/jC pIIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=pNBmz/Ld0Axbbo9daTBKDL0USDREL03HNa6J9TVl1gQ=; b=KF6Y92S8DmKNy7ncdjWijxvO2Qh/a2TNxMxTUiFLPEmyUkb+ULn6reBv12Gp/Z8eJc 6FCCN1PZojHTEmK/rn7EGzwbHhHsA0bLFKO0abeo0PC1ioiCHKHJnwpHo/ddNFRjKY/v ubPZTn6CohIDFHi7YNurY3/ocHiJH1UFfNtxJ9s2Be1Bzs8UxqYmDMCWJPR4d0PbLt5i hSRg+Rr9gbOLUZ95as5UVJwg354ljHLXEirun/2YBelWl4z4szno+X8QWVfRNk50ejtA dAe3lICtww9+MiWIbOD+yYpWqgJDLnRPPvDoHFzBGGEJ9yze2tikXAKQ/fC69kgSWM+t CMWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si1097619edz.505.2021.03.18.02.06.54; Thu, 18 Mar 2021 02:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbhCRJFz (ORCPT + 99 others); Thu, 18 Mar 2021 05:05:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:10982 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhCRJFa (ORCPT ); Thu, 18 Mar 2021 05:05:30 -0400 IronPort-SDR: I4QSBcDttPm3Dqga/8UFFnI+e/0J5I80LDy88Lxz19hIP7Rk9Q9pVq1xq/42W18uMJhA2eYmsu gObtBFt26vWg== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="189680237" X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="189680237" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 02:05:30 -0700 IronPort-SDR: hk1yorJL8O8FykbM/JjTKrcSQC9oqv23EYpanBd3nw0Fr62+mSv+J4CUl6v+bPqFCf1dHfpnmp j97KseJ5l6Ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,258,1610438400"; d="scan'208";a="372645266" Received: from glass.png.intel.com ([10.158.65.59]) by orsmga003.jf.intel.com with ESMTP; 18 Mar 2021 02:05:27 -0700 From: Wong Vee Khee To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Voon Weifeng , Ong Boon Leong Subject: [PATCH net V2 1/1] net: phy: fix invalid phy id when probe using C22 Date: Thu, 18 Mar 2021 17:09:37 +0800 Message-Id: <20210318090937.26465-1-vee.khee.wong@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using Clause-22 to probe for PHY devices such as the Marvell 88E2110, PHY ID with value 0 is read from the MII PHYID registers which caused the PHY framework failed to attach the Marvell PHY driver. Fixed this by adding a check of PHY ID equals to all zeroes. Fixes: ee951005e95e ("net: phy: clean up get_phy_c22_id() invalid ID handling") Cc: stable@vger.kernel.org Reviewed-by: Voon Weifeng Signed-off-by: Wong Vee Khee --- v2 changelog: - added fixes tag - marked for net instead of net-next --- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index cc38e326405a..c12c30254c11 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -809,8 +809,8 @@ static int get_phy_c22_id(struct mii_bus *bus, int addr, u32 *phy_id) *phy_id |= phy_reg; - /* If the phy_id is mostly Fs, there is no device there */ - if ((*phy_id & 0x1fffffff) == 0x1fffffff) + /* If the phy_id is mostly Fs or all zeroes, there is no device there */ + if (((*phy_id & 0x1fffffff) == 0x1fffffff) || (*phy_id == 0)) return -ENODEV; return 0; -- 2.25.1