Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp526401pxf; Thu, 18 Mar 2021 06:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgDyiyDrO2XbU+oaXIsKEBQcTa8Ns00XsyAjjiWduYCtv8t18T5rE1IXFe+VOaY3vt44F9 X-Received: by 2002:a17:906:4055:: with SMTP id y21mr35660591ejj.507.1616074045222; Thu, 18 Mar 2021 06:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616074045; cv=none; d=google.com; s=arc-20160816; b=kDdgIT4ubkeKZZAjDSFB6tYgQ0l/tMPLi1P3vh+WhgYoFz9HPwqWjYfD30CLaX3AqY aXQTrNN4HjN1KfwdygzE61KLYF0wgMa+ZRupq8jKpe5x/g6mwJ9O99TqxWM2xEM64RF1 g1wJKcCF910ibvSe9/65bRFu3mCnexaVY7AFkvbUYljmGFclqTkFlPHQEgG4UkpPgig4 rWcGqCZ2Vbp9pflsykgMSv6++CFMjRKbF7A5n8iKRVDPNeOPwsekZ+cLA5DX3EI34BpY EOdJK22kcftvusM039oDoMwqkeVHSgaGzXoc7Y5AnP/Xuf2ofNWoO8mc+V0mEYI3bu5a SHcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=tn903V/DZ3bhwc3O5vkyieGLvXdfPZU7y2pYkPz0YuQ=; b=KXiQ4w3cP6QWNGU3brgNBkrgkEg+VCqfL0+jdXraTV4smAKnSqKYepVwEAuERz9roy yVirc2xB6VLS+uDPZpoPI/2rCFoIWR66KV5kzUDG7RafXQCqs5hZFGDmC0HikKBQOUN1 wboHoVxKwrIsHRgIDNy56XJeqIZtICMTl2GVDRM8NR42VwhP7J+xUtx3AGtMShNHD38g 73fa70BhmUy/U8LW1AUq4evgATS3QTrWSfyz2+gnJ5LxKJcSPs5NkFvx8vBhC92j/i/w 1Wg+xcX2jknKoz0Ca13vVj3eQMADTZHEKE6n2oGIHSPd0cw0TCrE13QW7Sz8VxTpF6wB K/7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QnQB6KwI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da5si1587230edb.464.2021.03.18.06.27.02; Thu, 18 Mar 2021 06:27:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QnQB6KwI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbhCRN0H (ORCPT + 99 others); Thu, 18 Mar 2021 09:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbhCRN0D (ORCPT ); Thu, 18 Mar 2021 09:26:03 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB9CC06174A; Thu, 18 Mar 2021 06:26:02 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id j4-20020a05600c4104b029010c62bc1e20so3357433wmi.3; Thu, 18 Mar 2021 06:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tn903V/DZ3bhwc3O5vkyieGLvXdfPZU7y2pYkPz0YuQ=; b=QnQB6KwIrslc7thN0KjQxwacqIVgDz4nf1Mw/mWSWzRt8wzS22lWmfdKBTCYbHp9rW Qu2oOA5eOw4c7ctyerlcu3EfoWY4RauocxDhVCZw0yyv41Wld2lnMVpWYpN5BtG6bU7M 1cXkzrYGOeYhtFkRoG84ZM1M5/YAgcSqTFR1pqW7TLna5+ZvxaCtdtBqu39OkXngCO9H gQ38mugjm2jc6U5tz0TqmRSHi6cy14hn1wNmuB9qvZy85hXKD1rJxxC5Bli/K2OyCgPh SFf3YkM2neKMcovP94yI2TIC9MX2hq6zpRxj/JWGP0WXxABOQ8ekxSV6QINee0j69zWX grBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tn903V/DZ3bhwc3O5vkyieGLvXdfPZU7y2pYkPz0YuQ=; b=ZdjDxLh18ppoAHwHdE/HmBesYexIBrkgZ9EDk2xX54HBR3PidoyfvaIDVXAK+Ct4X2 hZ0xcbDcRWI4i0h5S8n3bn+IS+CJNBtxYfDonPZ9sFmxr/3iIHQ+fBAjhJwA+iTUQ+l7 trFlhf+0IXTqe2mippbqRnnnQEyt/4hmLVCYPBwNv1//DLbWptVNAgOrehAz1vdQ+W8j pUm/97gf1j5qTbswyGwCEveiyK7gziTvTLXlChIm2EcoxVupJe2aIPS+lcGhRx4ijFK4 J0LBBzpu14KMGPw4JS09YJzKTlFheR+AWmEOX0+JIXHa+554GvXWukVq6ARZrARAWXgf QR0A== X-Gm-Message-State: AOAM533Cg5x1HSqLfdBLlWj/L3R0kzapBbK0I9nz7Zvh2zmja5rXGQ9l GkqE2tH75wkaqV9aL5VBJi8= X-Received: by 2002:a1c:498b:: with SMTP id w133mr3824751wma.134.1616073961339; Thu, 18 Mar 2021 06:26:01 -0700 (PDT) Received: from ?IPv6:2003:ea:8f1f:bb00:8d2c:8cc:6c7f:1a84? (p200300ea8f1fbb008d2c08cc6c7f1a84.dip0.t-ipconnect.de. [2003:ea:8f1f:bb00:8d2c:8cc:6c7f:1a84]) by smtp.googlemail.com with ESMTPSA id u8sm3060529wrr.42.2021.03.18.06.26.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 06:26:00 -0700 (PDT) To: Wong Vee Khee , Andrew Lunn , 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 References: <20210318090937.26465-1-vee.khee.wong@intel.com> From: Heiner Kallweit Subject: Re: [PATCH net V2 1/1] net: phy: fix invalid phy id when probe using C22 Message-ID: Date: Thu, 18 Mar 2021 14:25:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210318090937.26465-1-vee.khee.wong@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18.03.2021 10:09, Wong Vee Khee wrote: > 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. > I was wondering whether we have, and may break, use cases where a PHY, for whatever reason, reports PHY ID 0, but works with the genphy driver. And indeed in swphy_read_reg() we return PHY ID 0, therefore the patch may break the fixed phy. Having said that I think your patch is ok, but we need a change of the PHY ID reported by swphy_read_reg() first. At a first glance changing the PHY ID to 0x00000001 in swphy_read_reg() should be sufficient. This value shouldn't collide with any real world PHY ID. > 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; >