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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 96913C6FD1D for ; Thu, 30 Mar 2023 09:16:05 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QE4RsV7psx85qjv2ZiqI7okWPt4TTzQX8bgk8vbZnAo=; b=VX/HFvhAgFTK9Z cmYNMIS0m6RVLo6Cj54zU4paz40v+htBm3QtMwRULZknQKWc9rjlaTs58bzGMQqlqx4FwS41DORMD cFvGZhs70mGEFX+UWs3cUGcBlJELMUpmB4nUrnEC+WnM32/ezjSg6+H/Y7mt2A8ibYMBKqE8s0ziI nxHnsMc9h9TYWxpYnJcfn19iZldBs/xGAG6gu+Ye7uNp6wHGMSSKQeHEW+WR8vK+IiuckfQW5KiVG FsXqdRl+FKu3peywnzJwEYJHoyuW475DkUp75NXR4JQktt/eVHR8S9zc5/XtQaf+Vmx6v+bjP5b9w 9+8RODM2MQL0EB2D+Rog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1phoNC-003E0j-1j; Thu, 30 Mar 2023 09:15:10 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1phoN8-003DzI-2U for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2023 09:15:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680167706; x=1711703706; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EQDSnthQ5cFmTJaAo9m1vejrcveOKhLU44+A2MCijjk=; b=IU+xXSPO8jFKukukEWvc05+KmhcAFyhSR4GlFgqA4/2NGPvtS5CJbVDb fbu0pEimQsyppcoK1F+r82Rh3uktQ3xIlMF1lE2teC6RkeK8i0vWVcl3a 5lQfX3KCHCvoa27JY2FBOuRP+xxXaNHnW1GcTxf3D8AfK+lTl53LnJIwM b1i1k8wMquFwWWjiZTD5XmqeTTsZuFOPKd3H82YeV1hIw8sL+Rsw4gPOM PAtnTT26okLSdRyVmEj1L16n7WZ/bV0NDFuomnBvq6/FAuhSgzPbFVjjQ 8zUyuEXenOdbBHxhzFEXsHAwHNiKmH54bcqZE8xFi7sz/XKLeOUL8jDQM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="325038872" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="325038872" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 02:15:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="678125408" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="678125408" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by orsmga007.jf.intel.com with ESMTP; 30 Mar 2023 02:14:52 -0700 From: Michael Sit Wei Hong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, hkallweit1@gmail.com, andrew@lunn.ch Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v5 1/3] net: phylink: add phylink_expects_phy() method Date: Thu, 30 Mar 2023 17:14:02 +0800 Message-Id: <20230330091404.3293431-2-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330091404.3293431-1-michael.wei.hong.sit@intel.com> References: <20230330091404.3293431-1-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230330_021506_875211_609EF93A X-CRM114-Status: GOOD ( 12.19 ) 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 Provide phylink_expects_phy() to allow MAC drivers to check if it is expecting a PHY to attach to. Since fixed-linked setups do not need to attach to a PHY. Provides a boolean value as to if the MAC should expect a PHY. Returns true if a PHY is expected. Reviewed-by: Russell King (Oracle) Signed-off-by: Michael Sit Wei Hong --- drivers/net/phy/phylink.c | 19 +++++++++++++++++++ include/linux/phylink.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a2f074685fa..30c166b33468 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1586,6 +1586,25 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); +/** + * phylink_expects_phy() - Determine if phylink expects a phy to be attached + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * When using fixed-link mode, or in-band mode with 1000base-X or 2500base-X, + * no PHY is needed. + * + * Returns true if phylink will be expecting a PHY. + */ +bool phylink_expects_phy(struct phylink *pl) +{ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || + (pl->cfg_link_an_mode == MLO_AN_INBAND && + phy_interface_mode_is_8023z(pl->link_config.interface))) + return false; + return true; +} +EXPORT_SYMBOL_GPL(phylink_expects_phy); + static void phylink_phy_change(struct phy_device *phydev, bool up) { struct phylink *pl = phydev->phylink; diff --git a/include/linux/phylink.h b/include/linux/phylink.h index c492c26202b5..637698ed5cb6 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -574,6 +574,7 @@ struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, phy_interface_t iface, const struct phylink_mac_ops *mac_ops); void phylink_destroy(struct phylink *); +bool phylink_expects_phy(struct phylink *pl); int phylink_connect_phy(struct phylink *, struct phy_device *); int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel