From patchwork Tue May 9 02:27: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: 13235306 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 EC46717D3 for ; Tue, 9 May 2023 02:31:06 +0000 (UTC) Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E70AD1F for ; Mon, 8 May 2023 19:31:03 -0700 (PDT) X-QQ-mid: bizesmtp78t1683599338tav6i44r Received: from wxdbg.localdomain.com ( [125.119.253.217]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 09 May 2023 10:28:39 +0800 (CST) X-QQ-SSF: 01400000000000I0Z000000A0000000 X-QQ-FEAT: LE7C6P2vL8S1CRIbgI3gKRvRenjzf/dLyRfNopDzpyZ2NgrD6JR30LZyzKC46 shSM9vwtmyUawiMD2WMKUvv3WjqJ9R31lrd+O7OPcmFzoVrTqRJmwhQmgoIUBFEc5StkuIa dPGG53Bwp5sqlwV1B3QOplA87JVlUivaBDvWGPDJreGy5kUmlfnsZZC/Rdhvof5IhXFuh3K N+lOMtEi2IYZ22TUdPW4rJR39W6z84V8i6R3HeglpBfnF4iF0PfX5Ocmgcue5rSnE1gau/M R5D38FlNA40UxL4NYq5W2iThtoivpMir+YhRhuDJUtvum0HhsXkxa/3RnR8PZgmlotSlhio gpJH86l2hnr/ea0/0Vi/7LKmvpd3M2yN/aRSif6B0FCk6R/rSdP7X39xzxlyA== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 15120649050218020363 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, Jose.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: [PATCH net-next v7 0/9] TXGBE PHYLINK support Date: Tue, 9 May 2023 10:27:25 +0800 Message-Id: <20230509022734.148970-1-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@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. v6 -> v7: - change swnode property of I2C platform to be boolean - use device_property_present() to match I2C device data v5 -> v6: - fix to set error code if pointer of txgbe is NULL - change "if" to "switch" for *_i2c_dw_xfer_quirk() - rename property for I2C device flag - use regmap to access I2C mem region - use DEFINE_RES_IRQ() - use phylink_mii_c45_pcs_get_state() for DW_XPCS_10GBASER 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 | 89 ++- drivers/i2c/busses/i2c-designware-platdrv.c | 15 + drivers/net/ethernet/wangxun/Kconfig | 8 + 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 | 65 +- .../net/ethernet/wangxun/txgbe/txgbe_phy.c | 651 ++++++++++++++++++ .../net/ethernet/wangxun/txgbe/txgbe_phy.h | 10 + .../net/ethernet/wangxun/txgbe/txgbe_type.h | 94 +++ drivers/net/pcs/pcs-xpcs.c | 30 + include/linux/pcs/pcs-xpcs.h | 1 + 15 files changed, 969 insertions(+), 38 deletions(-) create mode 100644 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c create mode 100644 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.h