From patchwork Thu Oct 27 13:10:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13022149 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 D60C0FA3740 for ; Thu, 27 Oct 2022 13:25:18 +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:Subject:Cc:To: From:Date: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=/df0wVyRs4bkI6vrDIC7Yey6YcEQyLEIP+JiJdWWZ+Y=; b=YBLBrF9U9GpKxt rwkgG/xGCV8Wow/XEm4seYsrLOI2szN1OWuBe/KhVqtqccLcVHvXkDgtrfuqIp1v6Ysn/K/wbeOcv VNhdpugIYsptyBTheRmzhotmy+Nm6L2ZGuhkhACIwMyvcfHnNL4GrLQdQ6IhMkhed6IAqhVzphQDS EbViRczN/8zmf7YUKaKQQ1aFqdDnqTNRYdD5Y8dBF+jHgmzaMGUo5rSPHIC6ctGPXpkIIKQEKsyU/ vgtjQvDWuN8vCavKL4Sp5E1r6+9nsXXknyJO5ymktIrpAGnM72CMoAsZbSiQ88CETFdJrijC6i8YV V0GSeT/+vs9dU92tFefw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2rV-00DTAn-Jm; Thu, 27 Oct 2022 13:23:59 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo2gU-00DMj6-Cb; Thu, 27 Oct 2022 13:12:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=A49PgTi5SeZp6nc1oTy8pXJQi4hZGA2yQzp5TsF0JYU=; b=xw+hrfjSv7Q/X1gOdVu/x6X0Ps LnZG6dVuUsXXZvnOSrtAC/XVoo4kEz1ZWRq+8+1yVYOCvmC6taUvJb0txh6T4jEiX39hQwEXRUOsP cIAymFIH37Nex8EN1Rt44kAj/DZlwd/a8wjP6mupjJT6bDk+zVFH9EoLImH4a7Vitxel1jQpfO63U a8JPKtOftbOU/U596Bgg6Ohl91d/KTCxbTwQMtfabwOpasASVxcovcJE5YpDQzRa6jT+c2XoRHh1/ qsGU/aFatQaeJlS6osXGF9mkKRQrqPfXDRsK7fgGMNBXo+VBozKUuvazqJ1aDWUNIM6iwOPjNUn0g /1xnhfSw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34970) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oo2eF-0006xD-V0; Thu, 27 Oct 2022 14:10:15 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oo2eB-0001Zx-Ii; Thu, 27 Oct 2022 14:10:11 +0100 Date: Thu, 27 Oct 2022 14:10:11 +0100 From: "Russell King (Oracle)" To: "David S. Miller" , Jakub Kicinski , Frank Wunderlich Cc: Eric Dumazet , Felix Fietkau , John Crispin , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Mark Lee , Matthias Brugger , netdev@vger.kernel.org, Paolo Abeni , Sean Wang Subject: [PATCH net-next 00/11] net: mtk_eth_soc: improve PCS implementation Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221027_061234_457965_C9C21C61 X-CRM114-Status: GOOD ( 14.41 ) 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 Hi, As a result of invesigations from Frank Wunderlich, we know a lot more about the Mediatek "SGMII" PCS block, and can implement the PCS support correctly. This series achieves that, and Frank has tested the final result and reports that it works for him. The series could do with further testing by others, but I suspect that is unlikely to happen until it is merged based on past performances with this driver. Briefly, the patches in order: 1. Add a new helper to get the link timer duration in nanoseconds 2. Add definitions for the newly discovered registers and updates to bit definitions, including bitmasks for the BMCR, BMSR and two advertisement registers. 3. Remove unnecessary/unused error handling (functions always returning zero.) 4. Adding the missing pcs_get_state() implementation. 5. Converting the code to use regmap_update_bits() rather than open-coding read-modify-write sequences. 6. Adding out-of-band speed and duplex forcing for all non-inband modes not just the 802.3z link modes the code currently does. 7. Moving the release of the PHY power down to the main pcs_config() function. 8. Moving the interface speed selection to the main pcs_config() function. 9. Adding advertisement programming. 10. Adding correct link timer programming using the new helper in the first patch. 11. Adding support for 802.3z negotiation. There is one remaining issue - when configuring the PCS for in-band, for some reason the AN restart bit is always set. This should not be necessary, but requires further investigation with the hardware to find out whether it is really necessary. I suspect this was a work around for a previous poor implementation. drivers/net/ethernet/mediatek/mtk_eth_soc.h | 13 ++- drivers/net/ethernet/mediatek/mtk_sgmii.c | 174 ++++++++++++++++------------ include/linux/phylink.h | 24 ++++ 3 files changed, 134 insertions(+), 77 deletions(-)