Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1482079ybk; Thu, 14 May 2020 10:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTDBClizGhc8kzWtTUtv+PIiFLDXxTdc1iSZ2XyeyMTywNv+2MDN4ZIX/FWJ83bQydIrMC X-Received: by 2002:a17:906:b4e:: with SMTP id v14mr4588788ejg.302.1589475773446; Thu, 14 May 2020 10:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589475773; cv=none; d=google.com; s=arc-20160816; b=EGd4B8NKx5iNUlbf/0NeRkOijwBijyk7eBp6WC3JA/qYrnVl9VLzBqHs6PCTfGpWRr jK7rOF2U25N7HtxmFR0khw7hIlunDaEyj8q4qYL1K6vLaZQdJcRlTiLcfYfDmjiyKeRb nNRByPk5qSPso63hLlGjtfeaEvOqs2nMAHT5vlvJOvlF4pVr/A1Mjf4Un/bbuCAM9BnQ tch9RrmEbvmt/nGH+BG8N7mPKp/S8TrjXl4HgoxsWz2RR8FrCQuTL4ClIIFiLI5qjctA BtQ25GCn8BiOskE5wOV8aLDf9XttdhLEr9x/oa4RdfjscL0Ji1E3w6pAHskhqQbE2lpg GZJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YVJrHmzisS/Di61iHb1+stDFB/CjgIgyehq2V26BS4I=; b=LimI1QLmpeBA5ALi6nQ3AVXPXjsHOnYqiJ7V1wj2vou63p4a4+O9ZrxtJcY7UWG9Ik 3ILtHnpj7g1CRbQ45gHfD6xck98Fjdmcdt58DBEamwoMUsS+qPxll3cdydJn8nBConoW GtqMZpRdP9X7NGQu7Pbg/r0eINI6nSxq/E0Zlnv8YR4XM/aCfGzGTzB7pr/LEDb7UPRT COmWu5XWyMkOYXofQuH0OvIIS6S89gKapKQ0cdmfYfYvohHvwv66kiCvVLVqUO8J+oDB plvNRlve62U741YL8ZIAL5F27AgekCaaNECpqCNxhJujjwseM3vek3xgxhpjJq6LoHgL VmWw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si2195738ejd.80.2020.05.14.10.02.28; Thu, 14 May 2020 10:02:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726170AbgENRAo (ORCPT + 99 others); Thu, 14 May 2020 13:00:44 -0400 Received: from foss.arm.com ([217.140.110.172]:40676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbgENRAn (ORCPT ); Thu, 14 May 2020 13:00:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 663061042; Thu, 14 May 2020 10:00:43 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5E4513F71E; Thu, 14 May 2020 10:00:43 -0700 (PDT) From: Jeremy Linton To: netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, linux-kernel@vger.kernel.org, Jeremy Linton Subject: [PATCH] net: phy: Fix c45 no phy detected logic Date: Thu, 14 May 2020 12:00:25 -0500 Message-Id: <20200514170025.1379981-1-jeremy.linton@arm.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commit "disregard Clause 22 registers present bit..." clears the low bit of the devices_in_package data which is being used in get_phy_c45_ids() to determine if a phy/register is responding correctly. That check is against 0x1FFFFFFF, but since the low bit is always cleared, the check can never be true. This leads to detecting c45 phy devices where none exist. Lets fix this by also clearing the low bit in the mask to 0x1FFFFFFE. This allows us to continue to autoprobe standards compliant devices without also gaining a large number of bogus ones. Fixes: 3b5e74e0afe3 ("net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg") Cc: Heiner Kallweit Signed-off-by: Jeremy Linton --- 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 ac2784192472..b93d984d35cc 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -723,7 +723,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, if (phy_reg < 0) return -EIO; - if ((*devs & 0x1fffffff) == 0x1fffffff) { + if ((*devs & 0x1ffffffe) == 0x1ffffffe) { /* If mostly Fs, there is no device there, * then let's continue to probe more, as some * 10G PHYs have zero Devices In package, @@ -733,7 +733,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, if (phy_reg < 0) return -EIO; /* no device there, let's get out of here */ - if ((*devs & 0x1fffffff) == 0x1fffffff) { + if ((*devs & 0x1ffffffe) == 0x1ffffffe) { *phy_id = 0xffffffff; return 0; } else { -- 2.24.1