Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp761467rwl; Fri, 24 Mar 2023 01:22:03 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9+vy4VSthK2ixSi8Je1UsyKemGRIF14Kf+tL3oflCkWPlRalP4iuj0HNswcsenX3sURCP X-Received: by 2002:a17:903:2309:b0:19b:dae0:c97d with SMTP id d9-20020a170903230900b0019bdae0c97dmr2101360plh.32.1679646123466; Fri, 24 Mar 2023 01:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679646123; cv=none; d=google.com; s=arc-20160816; b=vly3OSwgdXJLgaB8VPQc0S/4n6eXav8dRQ/wLhnoWN7YUNTT+qseCAmOBT2/LBh27/ U3VrhKOgcgOdoJWWw2xE6w9KSvUm2rXmoDT7RbHbmdiP55M4xBkbIO0QeCwN5zvWQnVR zU7yN3eFAmdVtbWUdmGS50yI1QjMjDkxgFOMamSJU06tXsAVYDeys0iAMlHX8qZWJtAg HG1pG/5KxrmTpQw0qboSm0Cev8JqAaG2kJAzabRxMJvBUwfWNJiYsE3DRo52cRkaKkLG Bhpu2LxG69CM/NbUpjLW2dvh/Vbi2JSy62aRCo9LDMN0+GcPMWP3zTKrNqtpht7NpZkn e0kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BXb1nkBpUTAX8yrpBdxs34C49hnCCJAqCIo5kHlT/+o=; b=sBw3M7NjGefcFlcFKu0mM17O0UOPgJdxDvwoV8VISARFSKkHAlvordE7Hwc3YqlM3O SnsCmbHKssuIUu47xT11MUR6Sd/qbakMvba3fymJ/WU4SO8a1B77M08jh23iGKosLMFT rmCQfwD7hNm7XHwNH5y8OZKiY6tBn4Zhl+RmtBmMT65Gvx6x73UE6Pv2I56vTLUyT8BO 5wKyR8MAXfW2ut+2dzeEhFUKQChH5adu3i0jWg0dHh5Pcvtvf4XiiZk4GKEkH8ffFggd VMUdQJTpGPDGOzSpu/t65eSSVP8Nsg6FEbQF8MyCzuJna9iBHuD0wJPgmwAC9fa0mBbl 4spw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XWlX2aiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a170903410b00b001a1efc91917si6428914pld.634.2023.03.24.01.21.51; Fri, 24 Mar 2023 01:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XWlX2aiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbjCXIRo (ORCPT + 99 others); Fri, 24 Mar 2023 04:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjCXIRm (ORCPT ); Fri, 24 Mar 2023 04:17:42 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6CE24705; Fri, 24 Mar 2023 01:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679645861; x=1711181861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7zEf318EIZQVC7Yb173ekmxTq+Dw6hKeKqmHqTYHp78=; b=XWlX2aiI0mu0vuIvgxk4TtNpg2rHKvr4Q+kzU4EN3TLENUqAFATZjKbV 3fbSq8vGcH9X8xyfqdUcxBvyuzPK7SCk2zi/gKjET++dxAGok4zXoKWVu +WV3vv7lej0JvAw79oktNnTHLw85XPd4oDI6a492wp10YgJAf+miSdIKm L0zeu/jwFvpbjORv2bV6gSwIQ0K5IyjHsCKrctgSP43eJiuZRUPS9Geaj ubV5yh1o4KHwu/ifawz+nGCXu1dFrSUEyBnw3vqCV8/PMWBYxVmhULFuE qbDeHStI+1hRmJ0wXH7PCMrFDemOBW6otyN9DaPQS5rgGUUD8mRrVsbFK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320116081" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="320116081" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2023 01:17:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="928574701" X-IronPort-AV: E=Sophos;i="5.98,287,1673942400"; d="scan'208";a="928574701" Received: from mike-ilbpg1.png.intel.com ([10.88.227.76]) by fmsmga006.fm.intel.com with ESMTP; 24 Mar 2023 01:17:37 -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 Cc: Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: [PATCH net v3 1/3] net: phylink: add phylink_expects_phy() method Date: Fri, 24 Mar 2023 16:16:54 +0800 Message-Id: <20230324081656.2969663-2-michael.wei.hong.sit@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> References: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Signed-off-by: Michael Sit Wei Hong --- drivers/net/phy/phylink.c | 13 +++++++++++++ include/linux/phylink.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a2f074685fa..5c2bd1370993 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1586,6 +1586,19 @@ 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() + * + * Fixed-link mode does not need a PHY, returns a boolean value to check if + * phylink will be expecting a PHY to attach. + */ +bool phylink_expects_phy(struct phylink *pl) +{ + return pl->cfg_link_an_mode != MLO_AN_FIXED; +} +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