From patchwork Mon Jan 29 13:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Choong Yong Liang X-Patchwork-Id: 13535613 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 C9BA8C47422 for ; Mon, 29 Jan 2024 13:05:28 +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: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:In-Reply-To:References: List-Owner; bh=KWXpkosus5SaOGNR3xL7jmhtDs0dn78a3gbiyE1rcPk=; b=wocVxOqx2MoOGc QA6QcpUY7McFBVeHHBMQTJ8zGG/TH01Ketz+og5Hf/9qA0Mv5F3+2lEm/53YpmjJ+z2k+lcwnwqjO RtArj3miPdIdikpnqqzqIcWCHLc8KHZ2SUFW74/1zVy+cZpbqChKyITmQ/WrtaU3ZKWcRWzHbZWrT Zj9+f+6HRqq4pZv705bCxn5XEag8vSgpzKhYriLTLT1M7IJ5cPuSwIwbkQOt8UdN57+GyFk3m1ydM Tp2ig77JJ0AX7jZU1IYLI4ApTx80j5fCNzpn5f03AoBeORbm9yrD3zshdkCdUL/gOGtEt6m2Jn26g ILEXbSsC4yi5/REf4ZNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rURK4-0000000ClEB-2zxi; Mon, 29 Jan 2024 13:05:12 +0000 Received: from mgamail.intel.com ([198.175.65.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rURK1-0000000ClDD-1poJ for linux-arm-kernel@lists.infradead.org; Mon, 29 Jan 2024 13:05:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706533510; x=1738069510; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xyoHfqTNIOjnNDp1+5s08f5WV/yjrMhPn3StDt1Ourk=; b=cXIGJPOyvYUSaBEXcKkJPSDh41CQt1uAotqznkVl6vRUdNUhI3ZQc5f6 CAHd6D6BNAo4EythTjJdxbaZ7SkQcRw9y69jDz2O1uplWeKyHQCvQpxFm 5vd1+1zWVUW1vLN/aCC6Rtv/dXHTUoS3FqmbFi2jfGIlY4BnF/wXcStFP miazBYiUUunTFB2lxjYT1QcolWPYHcAUxYM6ZBaXQX4AgomicqA0Ph2P0 8sxu7qWbwXpLfa77WJpJWIL2tKROT3pbqZAtpePvN1QiGkFq3/MGs8DmG PVeFyff/XkD738aX+hZuF0uMoI1ycm/qDmHGeVRU0dD+LLhiSn425ieTu g==; X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="21473121" X-IronPort-AV: E=Sophos;i="6.05,227,1701158400"; d="scan'208";a="21473121" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2024 05:05:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="907106700" X-IronPort-AV: E=Sophos;i="6.05,227,1701158400"; d="scan'208";a="907106700" Received: from yongliang-ubuntu20-ilbpg12.png.intel.com ([10.88.229.33]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2024 05:04:59 -0800 From: Choong Yong Liang To: Rajneesh Bhardwaj , David E Box , Hans de Goede , Mark Gross , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Richard Cochran , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrew Lunn , Heiner Kallweit , Philipp Zabel Cc: Andrew Halaney , Simon Horman , Serge Semin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org, bpf@vger.kernel.org, Voon Wei Feng , Michael Sit Wei Hong , Lai Peter Jun Ann , Abdul Rahim Faizal Subject: [PATCH net-next v4 00/11] Enable SGMII and 2500BASEX interface mode switching for Intel platforms Date: Mon, 29 Jan 2024 21:02:42 +0800 Message-Id: <20240129130253.1400707-1-yong.liang.choong@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240129_050509_625229_B186F06D X-CRM114-Status: GOOD ( 16.52 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Choong Yong Liang At the start of link initialization, the 'allow_switch_interface' flag is set to true. Based on 'allow_switch_interface' flag, the interface mode is configured to PHY_INTERFACE_MODE_NA within the 'phylink_validate_phy' function. This setting allows all ethtool link modes that are supported and advertised will be published. Then interface mode switching occurs based on the selection of different link modes. During the interface mode change, the 'phylink_major_config' function will be triggered in phylink. The modification of the following functions will be triggered to support the switching between SGMII and 2500BASEX interfaces for the Intel platform. - mac_get_pcs_neg_mode: A new function that selects the PCS negotiation mode according to the interface mode. - mac_select_pcs: Destroys and creates a new PCS according to the interface mode. - mac_finish: Configures the SerDes according to the interface mode. With the above changes, the code will work as follows during the interface mode change. The PCS and PCS negotiation mode will be selected for PCS configuration according to the interface mode. Then, the MAC driver will perform SerDes configuration on the 'mac_finish' based on the interface mode. During the SerDes configuration, the selected interface mode will identify TSN lane registers from FIA and then send IPC commands to the Power Management Controller (PMC) through the PMC driver/API. PMC will act as a proxy to program the PLL registers. Change log: v1 -> v2: - Add static to pmc_lpm_modes declaration - Add cur_link_an_mode to the kernel doc - Combine 2 commits i.e. "stmmac: intel: Separate driver_data of ADL-N from TGL" and "net: stmmac: Add 1G/2.5G auto-negotiation support for ADL-N" into 1 commit. v2 -> v3: - Create `pmc_ipc.c` file for `intel_pmc_ipc()` function and allocate the file in `arch/x86/platform/intel/` directory. - Update phylink's AN mode during phy interface change and not exposing phylink's AN mode into phylib. v3 -> v4: - Introduce `allow_switch_interface` flag to have all ethtool link modes that are supported and advertised will be published. - Introduce `mac_get_pcs_neg_mode` function that selects the PCS negotiation mode according to the interface mode. - Remove pcs-xpcs.c changes and handle pcs during `mac_select_pcs` function - Configure SerDes base on the interface on `mac_finish` function. Choong Yong Liang (9): net: phylink: publish ethtool link modes that supported and advertised net: stmmac: provide allow_switch_interface flag net: phylink: provide mac_get_pcs_neg_mode() function net: phylink: add phylink_pcs_neg_mode() declaration into phylink.h net: stmmac: select PCS negotiation mode according to the interface mode net: stmmac: resetup XPCS according to the new interface mode net: stmmac: configure SerDes on mac_finish stmmac: intel: interface switching support for EHL platform stmmac: intel: interface switching support for ADL-N platform David E. Box (1): arch: x86: Add IPC mailbox accessor function and add SoC register access Tan, Tee Min (1): stmmac: intel: configure SerDes according to the interface mode MAINTAINERS | 2 + arch/x86/Kconfig | 9 + arch/x86/platform/intel/Makefile | 1 + arch/x86/platform/intel/pmc_ipc.c | 75 ++++++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 + .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 233 ++++++++++++++++-- .../net/ethernet/stmicro/stmmac/dwmac-intel.h | 81 ++++++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 48 +++- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 +- drivers/net/phy/phylink.c | 30 ++- include/linux/phylink.h | 9 + .../linux/platform_data/x86/intel_pmc_ipc.h | 34 +++ include/linux/stmmac.h | 6 + 14 files changed, 506 insertions(+), 32 deletions(-) create mode 100644 arch/x86/platform/intel/pmc_ipc.c create mode 100644 include/linux/platform_data/x86/intel_pmc_ipc.h