From patchwork Wed Apr 26 07:14:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawen Wu X-Patchwork-Id: 677390 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 4466CC7618E for ; Wed, 26 Apr 2023 07:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239464AbjDZHVy (ORCPT ); Wed, 26 Apr 2023 03:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239384AbjDZHVw (ORCPT ); Wed, 26 Apr 2023 03:21:52 -0400 Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2ADDC2; Wed, 26 Apr 2023 00:21:22 -0700 (PDT) X-QQ-mid: bizesmtp63t1682493358tw99y582 Received: from wxdbg.localdomain.com ( [183.129.236.74]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 26 Apr 2023 15:15:47 +0800 (CST) X-QQ-SSF: 01400000000000I0Z000000A0000000 X-QQ-FEAT: k0mQ4ihyJQM+5pSjXtrf8udOhMBQXu4gXXwj6nrx8A+TASNmhS2iT4Ohdu8eN oQUpAZ/eNG+jXUEfuMXviwGToOJUeVUTGS9PuKo26QPNmjWeD3nDF4j2J3kS4/uyDA6TkVl OHRQlLsKNrZtCb/qsxOlgCvguiFdm2Rtc1A7RjSy1SAdzMriEOkAsVRNy5JrqQLJCk/tCin u9Ikv4Vvfk3FypD8xV9MX1HYrremvO2gNqsvSetKazX2t7f7S65UA8QFAxv3EYSkUdY3Flo FDBBhoYQhP6sUEKQF4SFV8IVxdPaLr0plsv8sG5GMuo8T/lQ2mes9P+3cWbil/EH+fg2hw7 D4WikYcUTkWIQJtdrksMQHVejJD+p2o5jCaTqboABhs3CAq/XQ= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 13341010435687556093 From: Jiawen Wu To: netdev@vger.kernel.org, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, jsd@semihalf.com, ose.Abreu@synopsys.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk Cc: linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, mengyuanlou@net-swift.com, Jiawen Wu Subject: [RFC PATCH net-next v5 0/9] TXGBE PHYLINK support Date: Wed, 26 Apr 2023 15:14:25 +0800 Message-Id: <20230426071434.452717-1-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybglogicsvr:qybglogicsvr5 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Implement I2C, SFP, GPIO and PHYLINK to setup TXGBE link. Because our I2C and PCS are based on Synopsys Designware IP-core, extend the i2c-designware and pcs-xpcs driver to realize our functions. v4 -> v5: - add clock register - delete i2c-dw.h with platform data - introduce property "i2c-dw-flags" to match device flags - get resource from platform info to do ioremap - rename quirk functions in i2c-designware-*.c - fix calling txgbe_phylink_init() v3 -> v4: - modify I2C transfer to be generic implementation - avoid to read DW_IC_COMP_PARAM_1 - remove redundant "if" statement - add specific labels to handle error in txgbe_init_phy(), and remove "if" conditions in txgbe_remove_phy() v2 -> v3: - delete own I2C bus master driver, support it in i2c-designware - delete own PCS functions, remove pma configuration and 1000BASE-X mode - add basic function for 10GBASE-R interface in pcs-xpcs - add helper to get txgbe pointer from netdev v1 -> v2: - add comments to indicate GPIO lines - add I2C write operation support - modify GPIO direction functions - rename functions related to PHY interface - add condition on interface changing to re-config PCS - add to set advertise and fix to get status for 1000BASE-X mode - other redundant codes remove Jiawen Wu (9): net: txgbe: Add software nodes to support phylink i2c: designware: Add driver support for Wangxun 10Gb NIC net: txgbe: Register fixed rate clock net: txgbe: Register I2C platform device net: txgbe: Add SFP module identify net: txgbe: Support GPIO to SFP socket net: pcs: Add 10GBASE-R mode for Synopsys Designware XPCS net: txgbe: Implement phylink pcs net: txgbe: Support phylink MAC layer drivers/i2c/busses/i2c-designware-common.c | 8 + drivers/i2c/busses/i2c-designware-core.h | 1 + drivers/i2c/busses/i2c-designware-master.c | 84 ++- drivers/i2c/busses/i2c-designware-platdrv.c | 20 + drivers/net/ethernet/wangxun/Kconfig | 7 + drivers/net/ethernet/wangxun/libwx/wx_lib.c | 3 +- drivers/net/ethernet/wangxun/libwx/wx_type.h | 3 + drivers/net/ethernet/wangxun/txgbe/Makefile | 1 + .../ethernet/wangxun/txgbe/txgbe_ethtool.c | 28 + .../net/ethernet/wangxun/txgbe/txgbe_main.c | 63 +- .../net/ethernet/wangxun/txgbe/txgbe_phy.c | 620 ++++++++++++++++++ .../net/ethernet/wangxun/txgbe/txgbe_phy.h | 10 + .../net/ethernet/wangxun/txgbe/txgbe_type.h | 94 +++ drivers/net/pcs/pcs-xpcs.c | 56 ++ include/linux/pcs/pcs-xpcs.h | 1 + 15 files changed, 963 insertions(+), 36 deletions(-) create mode 100644 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c create mode 100644 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.h