Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3371629pxj; Tue, 1 Jun 2021 03:54:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMvVXPS+qFUP9AHWrUSQz6Fvsbs+b29qfQhFvm7L4+z/uBT7fcGBw4jT2yZKpN/PhABJ6e X-Received: by 2002:aa7:d659:: with SMTP id v25mr31893855edr.271.1622544845911; Tue, 01 Jun 2021 03:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622544845; cv=none; d=google.com; s=arc-20160816; b=lDRlzb3piu/Y2hKbTZBzISeqSonwC4IYsM788zfg639XuD9M5pYZiGBne0JdhObILm +Vb4vRqxTTKUEZz5n1bJg9qESvwMNTX0f/nxZrhDL6MUBFGYhQvNHqRFojFkMHE5szZp c/IV4/OCibaWaMT72T81ddXA6cmHhgPmUzxUYkyNBwA3fON0fcoMYdaBGsStMivnYNx7 TQdeiRn4sGMgowH93H8wuGX+f1cHbf4c9aRX43LrfcyHR32BA5Lwv2w0GPqDZPX9kf/X FnEhZLQTLtqGRDvCd8RAHKuW9hxpJD2YGhBU07n6fnsnXPB0HpE6gW+XNbTo2U/v0o4d zX0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=UGXMYYP5B4PIAtR5f7g+4AhfvIWiYu5pdhebrODmoZ8=; b=Y1kQFqhE1DiU40NC/WGAHdGTZn0lXxk+JUGlGbGhUSgUyVoqXEe9Pnu6HnkTPd9MMb vgRXKDIhsbM92dI9e96T9YMrDLUK60FlJ9di5tvE/3IfHXsLIZ91yPj5W8Tuo+ClNFCu ew3LKIeejTWnQIOW6zT7z1gUJykXE94HjF/KWv9rn4IYMBnLB/HUG+AjkOvqkxwhRRfV RpTS39lDTotMc0XTCRTiLBYu/V4JqSR3EQHjjFoavZR7d8deG7xtvW6ecMNA3lrVegtd JbVrc0h5Kibq45VXRBts/4W1FKYaeWNX6wIfc7BXvwHQYCNll55GYy/QFJ/q3FyHBUic ZJSA== 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 j12si7740663ejy.26.2021.06.01.03.53.43; Tue, 01 Jun 2021 03:54:05 -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 S233514AbhFAKyR (ORCPT + 99 others); Tue, 1 Jun 2021 06:54:17 -0400 Received: from mga03.intel.com ([134.134.136.65]:5058 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbhFAKyR (ORCPT ); Tue, 1 Jun 2021 06:54:17 -0400 IronPort-SDR: DutuKACw/5Xuuakq8wkfQr5NX8QIK9qqZknV+OFIpvTsirkpLZ6yTlTqsgVv9jvI0c1ggUlAsi +dNbOJW2JKTg== X-IronPort-AV: E=McAfee;i="6200,9189,10001"; a="203554826" X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="203554826" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2021 03:52:35 -0700 IronPort-SDR: I3LNhnlxS59SiW7gRqhKiQNQORxLcyuTnYDKfBdDQGtXGnQvTpQ6hqGC5O/mdwurZHjRxDOxwe Veo+LoMzZmLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="482444245" Received: from linux.intel.com ([10.54.29.200]) by fmsmga002.fm.intel.com with ESMTP; 01 Jun 2021 03:52:35 -0700 Received: from linux.intel.com (unknown [10.88.229.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 1213358090A; Tue, 1 Jun 2021 03:52:33 -0700 (PDT) Date: Tue, 1 Jun 2021 18:52:31 +0800 From: Wong Vee Khee To: "Russell King (Oracle)" Cc: Andrew Lunn , Heiner Kallweit , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next 1/2] net: phy: allow mdio bus to probe for c45 devices before c22 Message-ID: <20210601105231.GB18984@linux.intel.com> References: <20210525055839.22496-1-vee.khee.wong@linux.intel.com> <20210525083117.GC30436@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210525083117.GC30436@shell.armlinux.org.uk> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 09:31:17AM +0100, Russell King (Oracle) wrote: > On Tue, May 25, 2021 at 01:58:39PM +0800, Wong Vee Khee wrote: > > Some MAC controllers that is able to pair with external PHY devices > > such as the Synopsys MAC Controller (STMMAC) support both Clause-22 and > > Clause-45 access. > > > > When paired with PHY devices that only accessible via Clause-45, such as > > the Marvell 88E2110, any attempts to access the PHY devices via > > Clause-22 will get a PHY ID of all zeroes. > > > > To fix this, we introduce MDIOBUS_C45_C22 which the MAC controller will > > try with Clause-45 access before going to Clause-22. > > > > Signed-off-by: Wong Vee Khee > > --- > > include/linux/phy.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/include/linux/phy.h b/include/linux/phy.h > > index 60d2b26026a2..9b0e2c76e19b 100644 > > --- a/include/linux/phy.h > > +++ b/include/linux/phy.h > > @@ -368,6 +368,7 @@ struct mii_bus { > > MDIOBUS_C22, > > MDIOBUS_C45, > > MDIOBUS_C22_C45, > > + MDIOBUS_C45_C22, > > } probe_capabilities; > > > > /** @shared_lock: protect access to the shared element */ > > The new definition doesn't seem to be used anywhere, so this patch > merely adds the definition. It doesn't do what it says in the subject > line. Any driver that sets the capabilities to MDIOBUS_C45_C22 will > end up not doing any probing of the PHY. > You are right. I left out the required changes in drivers/net/mdio_bus.c:- diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6045ad3def12..fbf9b8f1f47c 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -684,6 +684,11 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) if (IS_ERR(phydev)) phydev = get_phy_device(bus, addr, true); break; + case MDIOBUS_C45_C22: + phydev = get_phy_device(bus, addr, true); + if (IS_ERR(phydev)) + phydev = get_phy_device(bus, addr, false); + break; } if (IS_ERR(phydev)) VK