From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C954BC48BE0 for ; Fri, 11 Jun 2021 11:20:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93905613B8 for ; Fri, 11 Jun 2021 11:20:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93905613B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ltPZtQjWvTla3zRB9ufCrrMMpM9QipP49cTg4Lw+XKo=; b=tBpF6pt0Qy3qgF qhib2YvKKTs6QTBqRUL6LXFTSv27Hu0Rpyr+FJ8OWDBnHu1wdmCON86LmimZWK4t4sMREocSZIPL6 H9evXT7vUW4Yx6Hex7W0VHBhwEgHyug5I5bJQ0c5lpcd7TiintpuSYp9rJ0bEK423iY9pp0ljIGZd q2+PEnwtoAHzrVgWtx13Yef+CcGqd1p0cYSD6xKt4tWxB2R5rgeTq3oXipdya0eFJhpQOgIdAkgsL FxjH1VJo53AtfwhhKX7WeV/Q0TOQaSmR2o2CXNNpQWfP2CPx70XrbIcqCVs+T4ofN0gsnsNcdlvfW KFc+RBfzoqL5NImsSiww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrfB9-004ynb-2d; Fri, 11 Jun 2021 11:18:23 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrfB1-004ylQ-S1 for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 11:18:17 +0000 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=J8owCuPd5/8ySW2SHSltyMbz8eudomH+a+c2304+N58=; b=c9Kuu1ayjF5HovhwoYXeYzQeY NWZThOyYoZbCSL3cUyQpeoQcN2b3xN9smeGgaw9oJ5PVEbfaoiulwzv+xrBpOQUS6GNKPBcA7oFwf MiFYMDc5uyfjz+gSUyqVE5KLoKP5kleD/eqcEh06mns0VO3INcb1XM3UjpM4zacVfhgWXFkvI/8CG EiU7XITuKMAqKyCnYTL7GJmPMLFS/VLAYHJ5EbeGLKSZstNIhfNnnJZ9fPnG4mlhWa2zJgONkqvDL xn3HfoARosG+fID2HgP+jQ4yBPK+gBhFrfaK7EZ3BLk4c7K+cYs08CMGgpgRV1YBFGGiqHpBoYA2F 6qGQmaJVg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44908) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrfAi-00012V-2O; Fri, 11 Jun 2021 12:17:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lrfAc-0001EC-Hz; Fri, 11 Jun 2021 12:17:50 +0100 Date: Fri, 11 Jun 2021 12:17:50 +0100 From: "Russell King (Oracle)" To: Ioana Ciornei Cc: davem@davemloft.net, kuba@kernel.org, hkallweit1@gmail.com, netdev@vger.kernel.org, Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , calvin.johnson@oss.nxp.com, Cristi Sovaiala , Florin Laurentiu Chiculita , Madalin Bucur , linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, Laurentiu Tudor , Len Brown , "Rafael J . Wysocki" , Ioana Ciornei Subject: Re: [PATCH net-next v9 13/15] net: phylink: introduce phylink_fwnode_phy_connect() Message-ID: <20210611111750.GH22278@shell.armlinux.org.uk> References: <20210611105401.270673-1-ciorneiioana@gmail.com> <20210611105401.270673-14-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210611105401.270673-14-ciorneiioana@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_041815_934611_155C0E08 X-CRM114-Status: GOOD ( 24.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 11, 2021 at 01:53:59PM +0300, Ioana Ciornei wrote: > From: Calvin Johnson > > Define phylink_fwnode_phy_connect() to connect phy specified by > a fwnode to a phylink instance. > > Signed-off-by: Calvin Johnson > Signed-off-by: Ioana Ciornei > Acked-by: Grant Likely Reviewed-by: Russell King (Oracle) Thanks. > --- > > Changes in v9: None > Changes in v8: None > Changes in v7: None > Changes in v6: > - remove OF check for fixed-link > > Changes in v5: None > Changes in v4: > - call phy_device_free() before returning > > Changes in v3: None > Changes in v2: None > > > > drivers/net/phy/phylink.c | 54 +++++++++++++++++++++++++++++++++++++++ > include/linux/phylink.h | 3 +++ > 2 files changed, 57 insertions(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 96d8e88b4e46..9cc0f69faafe 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -5,6 +5,7 @@ > * > * Copyright (C) 2015 Russell King > */ > +#include > #include > #include > #include > @@ -1125,6 +1126,59 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, > } > EXPORT_SYMBOL_GPL(phylink_of_phy_connect); > > +/** > + * phylink_fwnode_phy_connect() - connect the PHY specified in the fwnode. > + * @pl: a pointer to a &struct phylink returned from phylink_create() > + * @fwnode: a pointer to a &struct fwnode_handle. > + * @flags: PHY-specific flags to communicate to the PHY device driver > + * > + * Connect the phy specified @fwnode to the phylink instance specified > + * by @pl. > + * > + * 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_fwnode; > + struct phy_device *phy_dev; > + int ret; > + > + /* Fixed links and 802.3z are handled without needing a PHY */ > + if (pl->cfg_link_an_mode == MLO_AN_FIXED || > + (pl->cfg_link_an_mode == MLO_AN_INBAND && > + phy_interface_mode_is_8023z(pl->link_interface))) > + return 0; > + > + phy_fwnode = fwnode_get_phy_node(fwnode); > + if (IS_ERR(phy_fwnode)) { > + if (pl->cfg_link_an_mode == MLO_AN_PHY) > + return -ENODEV; > + return 0; > + } > + > + phy_dev = fwnode_phy_find_device(phy_fwnode); > + /* We're done with the phy_node handle */ > + fwnode_handle_put(phy_fwnode); > + if (!phy_dev) > + return -ENODEV; > + > + ret = phy_attach_direct(pl->netdev, phy_dev, flags, > + pl->link_interface); > + if (ret) { > + phy_device_free(phy_dev); > + return ret; > + } > + > + ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); > + if (ret) > + phy_detach(phy_dev); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(phylink_fwnode_phy_connect); > + > /** > * phylink_disconnect_phy() - disconnect any PHY attached to the phylink > * instance. > diff --git a/include/linux/phylink.h b/include/linux/phylink.h > index fd2acfd9b597..afb3ded0b691 100644 > --- a/include/linux/phylink.h > +++ b/include/linux/phylink.h > @@ -441,6 +441,9 @@ void phylink_destroy(struct phylink *); > > int phylink_connect_phy(struct phylink *, struct phy_device *); > int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); > +int phylink_fwnode_phy_connect(struct phylink *pl, > + struct fwnode_handle *fwnode, > + u32 flags); > void phylink_disconnect_phy(struct phylink *); > > void phylink_mac_change(struct phylink *, bool up); > -- > 2.31.1 > > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel