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: 19619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp759183dyb; Mon, 29 Jan 2024 10:38:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA+N4+taV1ztF9nlO5qBcEvcIHjRg/x0w695PruBODIu2uZRf1fBZChlpZYKHSYg+YyrNW X-Received: by 2002:a05:6871:5b1a:b0:214:fcc4:e384 with SMTP id op26-20020a0568715b1a00b00214fcc4e384mr5195419oac.15.1706553531022; Mon, 29 Jan 2024 10:38:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706553530; cv=pass; d=google.com; s=arc-20160816; b=UelTyCzKSWM7rcqJ7mkAM0Ytb5sEvFkl/1a0zZQPCRn/Cg4aVOkWfJ4x9yGLykceOP Tkk/ShxyjJainLotkcCH38PONQq0iVRmh9k2RrzOzimyFr2Fvt0xMSp3K9DI+AqvaH09 6Cw6ggZfETuAGRNuhy75YMJZN0STSjnMriGU/ufMaHrMd/VaG+K6+PAO065j/Dy1O7J7 b5RTKe8s1v9vIAKQnnrAXBWgWCM0qpG6Wi+9ZfH0vHu345cZwfncaAjImB6IinguwiE+ Jt/6qIGkl06+kwoqziQLUEudQ/EYIV239B/9kXjZ34/heso9CuDILgNgicgaxX52ftyY uPag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=GS9hkh7E8moKRlGqewfhWTZqndI1aV31qPNIYgXzBjg=; fh=/YJd8cagnZyj8HxcDZG6YnlmNxAW8XcSWCpxhbbfMGA=; b=IKXwx/luXP1xU1T3OA6WEPLz5gUKWCUgsHVbtMMhZsYTLGcWDlqYl6htp6bC9I54tF v0QJwzTElNO2RIhU6MP+jGlT2/J+bz1PoxXk+wp1K4i5TQGXN2Jj+L84iAUvuPJ8iheE wFXd0vsmmyzVsWa6Namnzspy3rIwsZKkAtmAjF+/ErXaxYfX9gdUBpkM4JBuuw/HsRqb fdjTn3VbHhNlVAb5t6WYfwH38KIwf0+B/k0fLbnJSMFUzZT7vScBLrTvEm8/J1i026vM RvzqQiRX4ZUKfcx6Td0wxj/7kLlJdtRGQ9cXQRODt7p1MhLNSGve4Y6TD091smucZH9p IVNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XSNhTc4K; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42746-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l6-20020a63ba46000000b005cdc2bdc091si5858639pgu.436.2024.01.29.10.38.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:38:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42746-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XSNhTc4K; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42746-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42746-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C5601286297 for ; Mon, 29 Jan 2024 13:05:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D612629EE; Mon, 29 Jan 2024 13:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XSNhTc4K" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0800612C1; Mon, 29 Jan 2024 13:05:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706533510; cv=none; b=drIPFCHI/XrJrf0MIV7zjKesOrseFdC6+DAaaTIXievYEN6OqPwpKBRpaEDdW8OaUGcQR8pZYzG1VezC/yIJ9gsGrEKShht2b0hnLKlxiQ/3g501Osq18TUOXqeL4l50Yxql7kQ3qP2eEISwfW+uD0yFuZTWVgx5ztCJORrGsT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706533510; c=relaxed/simple; bh=xyoHfqTNIOjnNDp1+5s08f5WV/yjrMhPn3StDt1Ourk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MqAFemFATLkY9FaeNqpzDk/ORh9PlNFhj7gR29iVxtRDvaH8VJ+7vLyBYBhUy0V0PtMsvFg1wFDT8yilsO6t/fRwfzo3Djro4XC9NwguyR7ByVvoEG+lcHiT+sSD6MZ0yzTnKsskQwY+Rlc3RC/BciWPPEE0/JEWM15239c1R8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XSNhTc4K; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706533508; x=1738069508; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xyoHfqTNIOjnNDp1+5s08f5WV/yjrMhPn3StDt1Ourk=; b=XSNhTc4KraK/Z1LJ2Cv3S2WiOqaZRp5IpPFGF8i4PZljXra0i3lCQI3I 4ENCSHhTFbT2Tc3lReFmAR+2gOSGa9xiFKVO5MHVoMTL2VF8xSFSQ1tTG A7qM1E2PnNtcoQBy9eT5GwMhCAT7yiWkrDkvnDiIrhulsKyH5TDYg+Jhn njMOjndu6Txn9cf82XFntXIgNjJ937g0cp4ielavuvKJuYJN6m990Kuf/ gV7pbwWcf10iusQUcCWusv9ewKVvgYVX9bnk8Rm58BW3wjuKncmU5kARw yQb+aLIfQi6LHAZEkXM1cEjmOqU5QOpx1ACSz+sztrVIXEyXRS+yDph/m w==; X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="21473130" X-IronPort-AV: E=Sophos;i="6.05,227,1701158400"; d="scan'208";a="21473130" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789451075330201890 X-GMAIL-MSGID: 1789451075330201890 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