Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3982898pxf; Tue, 16 Mar 2021 02:46:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAZwwZP9Wy/gdeUIh5hTdHOAwV3aJGOy8QXSOv+gdqjB2Bd1BJFWw0c3bYz5/kP743Jy0X X-Received: by 2002:a17:906:3882:: with SMTP id q2mr28236447ejd.540.1615887996201; Tue, 16 Mar 2021 02:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615887996; cv=none; d=google.com; s=arc-20160816; b=A7lNZCtaQpdgt1nAVpsajp85mLboKFC9Q//gkpFpr3PResSChH8vtf9D4FwBAODnCv LdxgsNXeBMq5r6FuDPpNTDsQZhWcn0jNDFp0LaIT26+wC2oW3eMG1cyFZGUMzD4NvFlG 9u6D9Euk0PVND9dcZfObvk7nZaFYiyTpOUAPwFXcsyHwt+7Vj7cVfYUw8p0N/53WmOxD tHgjBD7g3vTmGjPxqMm710nx5hhgAMAfxkw6ErMocJTOYGobXoBmCtqCJcqOwl3QXDjk //nzjsGLDeGujShQS5sP////VKCQ/NEAf413DEX7Y5Sz+fh3qmoUgfmRf7WkEsasxOE+ Y4Mw== 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=3KnbdlsPwkC08DQJ/2DirAZNFRsEDZGOuOd7hIb9Gao=; b=FyJFQjsS6I6UPvoaa1f/lrV1bwb4uosyBpUjJm6M/XwGsIDR0J5VA4og1+SifXvmc4 cDRH7ryqqASXwBwyYhUHKcv7FBkdiUgwWb9YDTFzfbOJEEynq0tJf+njaPhYQh7Z5EFm CFp6WYfO7u/Fx2CeCMn4/SgvDCWFUuFGGRYeLwNTAw6Wvb00HaVFsTIIxmOHpDFnelb5 /ysnntarRNJhBfQTEqdqYq75MsWrXADd1oVL5LMGPXKUiFEYEJ5BIeQ50TUWdAYJBh4h ZvE+vzR9YkWhiw0sCtwjV4M5uJTN5GCSU8SmbUnzmCyauhJallLYeLN2YiGbmwmCWpLE wZFQ== 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 k4si12302222edq.442.2021.03.16.02.46.13; Tue, 16 Mar 2021 02:46:36 -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 S235807AbhCPIyT (ORCPT + 99 others); Tue, 16 Mar 2021 04:54:19 -0400 Received: from mga03.intel.com ([134.134.136.65]:39224 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235553AbhCPIxn (ORCPT ); Tue, 16 Mar 2021 04:53:43 -0400 IronPort-SDR: brrGyZ0wcQU5MpNfuw0wXLNhD1TkzXUw9W7B/ww3B5mZnnKLnecMym8FkSf65GHuOJIRBeliQ+ ejmtWbJPTesw== X-IronPort-AV: E=McAfee;i="6000,8403,9924"; a="189274541" X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="189274541" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 01:53:42 -0700 IronPort-SDR: bFPhdZuFuRIsfoX6ZTnXty9YDw1RjNQZmXexsuTu0fZHwM1wQLp4jEQnebGHn8I3Q4gcrPEShb +e8hD8vwsN6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="373724184" Received: from glass.png.intel.com ([10.158.65.59]) by orsmga006.jf.intel.com with ESMTP; 16 Mar 2021 01:53:40 -0700 From: Wong Vee Khee To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Voon Weifeng , Ong Boon Leong , Wong Vee Khee Subject: [PATCH net-next 1/1] net: phy: fix invalid phy id when probe using C22 Date: Tue, 16 Mar 2021 16:57:48 +0800 Message-Id: <20210316085748.3017-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. Cc: stable@vger.kernel.org Reviewed-by: Voon Weifeng Signed-off-by: Wong Vee Khee --- 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 a009d1769b08..f1afc00fcba2 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -820,8 +820,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