From patchwork Wed Mar 22 12:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King \(Oracle\)" X-Patchwork-Id: 665933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF1E5C761A6 for ; Wed, 22 Mar 2023 12:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjCVMAS (ORCPT ); Wed, 22 Mar 2023 08:00:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbjCVMAQ (ORCPT ); Wed, 22 Mar 2023 08:00:16 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DF3570B0; Wed, 22 Mar 2023 05:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To: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=P/qDIKEXByHY2/N3TKS7+nB/0HfKOu7KPqR9nLtkfwE=; b=eDF75J5J8rXizfk3r2+FDs3dOa 35Mmj9z1ZUBXXoKN46KAXYg4dU1BeI/nDOhxYUmxQxRol7BbnVOhTGmY/Z5qH8QI540kjOBwfAwlZ MaGz4YrU8bw3hSn4LRSQdnlA6yTuBflUs8phNy0TV3Afv9nLD8KWXeS86OUmGbEUQkoULypZcnW2+ UZzJ+GoxwBOu4kaER3zm5mRJXlvGQH809xy8nY4xGxh0+2a7Y8vPHkfWQCHmai35eBi9HTSEh8rSJ zALShRUX541MexaRUzESybEvd09uvvVrT9RMrsSzs+kzQcoCJpUSidoSLp7xDUVy/nHPvRirClQD7 OrTXx+qw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:60880 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pex8Q-00035i-SG; Wed, 22 Mar 2023 12:00:06 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pex8Q-00Dvnr-5y; Wed, 22 Mar 2023 12:00:06 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Andy Shevchenko , Daniel Scally , "David S. Miller" , Eric Dumazet , Florian Fainelli , Greg Kroah-Hartman , Heikki Krogerus , Jakub Kicinski , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, Paolo Abeni , "Rafael J. Wysocki" , Sakari Ailus , Vladimir Oltean Subject: [PATCH RFC net-next 3/7] net: dsa: use fwnode_get_phy_mode() to get phy interface mode MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Wed, 22 Mar 2023 12:00:06 +0000 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In preparation for supporting the use of software nodes to setup phylink, switch DSA to use fwnode_get_phy_mode() to retrieve the phy interface mode, rather than using of_get_phy_mode() which is DT specific. Signed-off-by: Russell King (Oracle) --- net/dsa/port.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/dsa/port.c b/net/dsa/port.c index 67ad1adec2a2..07f9cb374a5d 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1678,13 +1678,9 @@ static const struct phylink_mac_ops dsa_port_phylink_mac_ops = { int dsa_port_phylink_create(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; - phy_interface_t mode; + struct fwnode_handle *fwnode; struct phylink *pl; - int err; - - err = of_get_phy_mode(dp->dn, &mode); - if (err) - mode = PHY_INTERFACE_MODE_NA; + int mode; /* Presence of phylink_mac_link_state or phylink_mac_an_restart is * an indicator of a legacy phylink driver. @@ -1696,8 +1692,14 @@ int dsa_port_phylink_create(struct dsa_port *dp) if (ds->ops->phylink_get_caps) ds->ops->phylink_get_caps(ds, dp->index, &dp->pl_config); - pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), - mode, &dsa_port_phylink_mac_ops); + fwnode = of_fwnode_handle(dp->dn); + + mode = fwnode_get_phy_mode(fwnode); + if (mode < 0) + mode = PHY_INTERFACE_MODE_NA; + + pl = phylink_create(&dp->pl_config, fwnode, mode, + &dsa_port_phylink_mac_ops); if (IS_ERR(pl)) { pr_err("error creating PHYLINK: %ld\n", PTR_ERR(pl)); return PTR_ERR(pl);