Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4035344ybl; Mon, 3 Feb 2020 11:15:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwDS3Aa+ScBx3dMsGwz5I1n42Sq5FqzlZnH+l+ZZF2pnd5FD1X0D0ip1D2fVAClZ8TDFVFa X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr19704253otn.22.1580757348539; Mon, 03 Feb 2020 11:15:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580757348; cv=none; d=google.com; s=arc-20160816; b=Or6mx/e5sBXc/fqNZG5M+5V3eQONh106QtBedxYHq0qBlULlaL7YHmDnuBtMCMcuyn U8eDuDt16pDebnOWLmi3aZr6Unw5F9ugPVWmyr8jR+8Jsiufu1qCK9/ZVkgA1z/tsLZd whpD30JmzSj9GdKTmdOzheCr5KOtuGSMJXxrymiP+aCKk/Yc5yk+7arglzO82UnYTOmK +g7sg1XVRCBnSp0RWvxczUOxoxHt6mfMVRuQsm1pFKQ06RMDbGy28EmXCjthT+fH0c4S 1jv6bogCx6T3uj71qoNRX6X9xLyaWwL5iHODu8e0nxxipsvbHZ1gGYzPl7FvsDp5JJ/o ZVwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ul0HVKuO8ElH72GqJH89jBPZVUgcn0UM0cFS4x7qJd4=; b=k058V5pbCbArsxG0LADRnt5rysIuoe1nHThCcSHRmkzizZT+iFgvK5F6Qly+jNczN1 1i02L0pzKFLjFPIuZ9CvFjD2CrKkgsNBAzd/KSvNNkiLLq+AnO50iRyYT/GbOx2ICGKG qg50vmFHbfhjphxRpogq/BRxlG5Pz52ypnal2iLCJ5ypcBODQ6iz30qrdm/hgDiDjJjg iFAK2TUYw9wF5W8EXxc8iRw3kIgoZ3aZIz8WJBsco/jRwxSmnQmJowPipKq0kF5Dh644 8HtGgWYNLw7/T5rfn007pbg9D23chv7oGVhiyWm2DhWXg93s1KvQkvwy5QDX2UJti5ve nglw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dknKMzx1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si8516878oiv.13.2020.02.03.11.15.36; Mon, 03 Feb 2020 11:15:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dknKMzx1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729478AbgBCSlq (ORCPT + 99 others); Mon, 3 Feb 2020 13:41:46 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:38032 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbgBCSlq (ORCPT ); Mon, 3 Feb 2020 13:41:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ul0HVKuO8ElH72GqJH89jBPZVUgcn0UM0cFS4x7qJd4=; b=dknKMzx1V+kHeGsvSUL/m770r lwectpAJQAwF7Tj+QWt/N8hIReL8BqKs32eYMh61EuTtICDXvJn31GhlVeI6EOtMk6AtRVDnRuhnq aMjtoE1nOHJJTAv1j3D8blgH6lA2DG0lWI8N4W0Rexlol+nfYWtCH2cAz/icD3bx6wp1N14Gjb2ge k+bP1mj5bfz0m2T8Yy9PrNDUWTFgxrncOxR4492HBIcbbm9QGnjTtyvDNo67o6Ihx/xPhLG2Qhlq7 826bEnPpwbEEM/1+bJercd94r+yu0n5tSWB+0Gl6jAMQi6mTsAAUkKnINvOmq8LQkUkOLC4SDE+HZ 8cDI86H/Q==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:43022) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iygf0-0005Eo-16; Mon, 03 Feb 2020 18:41:26 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iygev-00007u-B6; Mon, 03 Feb 2020 18:41:21 +0000 Date: Mon, 3 Feb 2020 18:41:21 +0000 From: Russell King - ARM Linux admin To: Calvin Johnson Cc: linux.cj@gmail.com, Jon Nettleton , Makarand Pawagi , cristian.sovaiala@nxp.com, laurentiu.tudor@nxp.com, ioana.ciornei@nxp.com, V.Sethi@nxp.com, pankaj.bansal@nxp.com, "Rajesh V . Bikkina" , Calvin Johnson , Andrew Lunn , "David S. Miller" , Florian Fainelli , Heiner Kallweit , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v1 6/7] net: phylink: Introduce phylink_fwnode_phy_connect() Message-ID: <20200203184121.GR25745@shell.armlinux.org.uk> References: <20200131153440.20870-1-calvin.johnson@nxp.com> <20200131153440.20870-7-calvin.johnson@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200131153440.20870-7-calvin.johnson@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 09:04:39PM +0530, Calvin Johnson wrote: > From: Calvin Johnson > > Introduce phylink_fwnode_phy_connect API to connect the PHY using > fwnode. > > Signed-off-by: Calvin Johnson > --- > > drivers/net/phy/phylink.c | 64 +++++++++++++++++++++++++++++++++++++++ > include/linux/phylink.h | 2 ++ > 2 files changed, 66 insertions(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index ee7a718662c6..f211f62283b5 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > > #include "sfp.h" > #include "swphy.h" > @@ -817,6 +818,69 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) > } > EXPORT_SYMBOL_GPL(phylink_connect_phy); > > +/** > + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. > + * @pl: a pointer to a &struct phylink returned from phylink_create() > + * @dn: a pointer to a &struct device_node. > + * @flags: PHY-specific flags to communicate to the PHY device driver > + * > + * Connect the phy specified in the device node @dn to the phylink instance > + * specified by @pl. Actions specified in phylink_connect_phy() will be > + * performed. > + * > + * Returns 0 on success or a negative errno. > + */ > +int phylink_fwnode_phy_connect(struct phylink *pl, > + struct fwnode_handle *fwnode, > + u32 flags) > +{ > + struct fwnode_handle *phy_node; > + struct phy_device *phy_dev; > + int ret; > + int status; > + struct fwnode_reference_args args; > + > + /* Fixed links and 802.3z are handled without needing a PHY */ > + if (pl->link_an_mode == MLO_AN_FIXED || > + (pl->link_an_mode == MLO_AN_INBAND && > + phy_interface_mode_is_8023z(pl->link_interface))) > + return 0; > + > + status = acpi_node_get_property_reference(fwnode, "phy-handle", 0, > + &args); > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) > + status = acpi_node_get_property_reference(fwnode, "phy", 0, > + &args); > + if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) > + status = acpi_node_get_property_reference(fwnode, > + "phy-device", 0, > + &args); This is a copy-and-paste of phylink_of_phy_connect() without much thought. There is no need to duplicate the legacy DT functionality of phy/phy-device/phy-handle in ACPI - there is no legacy to support, so it's pointless trying to find one of three properties here. I'd prefer both the DT and ACPI variants to be more integrated, so we don't have two almost identical functions except for the firmware specific detail. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up