Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1628517ybk; Thu, 14 May 2020 13:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc0GaXYS4J7MBJOjVcQvwL4uoiGWZG+vrQ+LCSSJftKcevy35G5hDOD6Ly+4mNJnIElWla X-Received: by 2002:a50:cb85:: with SMTP id k5mr5905897edi.152.1589489478442; Thu, 14 May 2020 13:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589489478; cv=none; d=google.com; s=arc-20160816; b=B1jGaWijDw4TginGpeU8l8s+6T3rEBOthO3C3XZB7pnCoA9TYl3JMtbOL/hNWuZ+Za SDCmBFFf9DqaZtpw/qjPh8UdwSqVZ3LIh+EGxR58bs6gbcZqAOjHNsqa6OXJ6KWsNT/W tErjdWBxH+jw7Sg4ZMcgaA1Ki8V4fMVnptp3Zy4AT27Ye5Pq6g0v0QbQQ7lBKrAwfiqV Hqva1IHfEDPwfuwmJf2bceAE3Fq8dLaw4e1FXlHsaUXJhICSOy2ETAfvLo8XJN5bKMtG WQh6KgkJrm0GIhIREGbADaRbsv1Uj4QO/VNMsDJA23ipnUI9wcb+bFdSFfdbytjSShUS 414w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ZJbhJFpqBwQgyJWGDOQXr6btnZKzSSb6K2qCu929Jzs=; b=PHUryEZnvNStZ4E1QheZvND8GWD0L7ZvLUO6GdBhtSXZfdzjWNRIj1ZWTg9etOJPzl hqgy3WCTtVQJqMsG/MgPws0EMzr69d809DZbg7oWUqcJOQsQuun2pOABdiGdEu9Oz/cb eROY50wGbcf1CxxqPDDISV0zg2oU0R7bUoLLQpAG3SgsqrPbk5vpjp1DcSPBHKvs6Fcq tptOJqFeGxDgtjgz/N+6hbUA68hA+CuQT99waASVJii2wlVjr77stDnRxcA4PWvpM+9o HhAE5+ilHPumQetYnzmfd0+R/0h7H/GQjjzJ9dJZso7ZaNkGXM23IJjr8G4yGRpa/N6f yGaQ== 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 e17si2468512edr.16.2020.05.14.13.50.53; Thu, 14 May 2020 13:51: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbgENUtV (ORCPT + 99 others); Thu, 14 May 2020 16:49:21 -0400 Received: from foss.arm.com ([217.140.110.172]:44304 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbgENUtU (ORCPT ); Thu, 14 May 2020 16:49:20 -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 D64281042; Thu, 14 May 2020 13:49:19 -0700 (PDT) Received: from [192.168.122.166] (unknown [10.119.48.101]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8082E3F68F; Thu, 14 May 2020 13:49:19 -0700 (PDT) Subject: Re: [PATCH] net: phy: Fix c45 no phy detected logic To: Heiner Kallweit , netdev@vger.kernel.org Cc: andrew@lunn.ch, f.fainelli@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, linux-kernel@vger.kernel.org References: <20200514170025.1379981-1-jeremy.linton@arm.com> From: Jeremy Linton Message-ID: <337071a2-0eaf-6143-f6c0-b451d681733d@arm.com> Date: Thu, 14 May 2020 15:49:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 5/14/20 2:59 PM, Heiner Kallweit wrote: > On 14.05.2020 19:00, Jeremy Linton wrote: >> 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, > > Looks good to me, it would just be good to extend the comment and explain > why we exclude bit 0 here. Sure, sounds good. > > >> * 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 { >> >