From mboxrd@z Thu Jan 1 00:00:00 1970 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 AAE76C74A5B for ; Tue, 21 Mar 2023 11:30:37 +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:In-Reply-To:MIME-Version:References: 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: List-Owner; bh=VT/sQQLlqz3Gq6UJerQP7dAkO7GPZ3sARQgVgqDFyn8=; b=z9ozBcDQmJIgNQ hQMxe9XZ0UZS0gaFNyPWShWe0t0oUjq03BKB7skuM58ObsJfu0Mtaaug9Erap+Tx5L0Z65bYv3EDA bK9F4zbKvEbQYDXw0PJ15v7t9h0fy40bsSkQbC+wk3NvsqCmk2LHDSd4zcyh+89zbD9edne70seCv 3yzRydPNoGyT7g82xigEzRBeUBfZWMueAF2/0upopUkIAyKenXuw737ghFkxhrWGEtTjbObUKWEDN E8lb1H7ELMnvebN839Ceh4FNulgFdxb/38yZoL4OQ/UZIUu4qpNpCjTgJGM3uyKrqpGPTtGvS/bQz 4FhpkjUOmoyWFNiIKrQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peaBU-00CCvo-1W; Tue, 21 Mar 2023 11:29:44 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peaBP-00CCuA-1e for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 11:29:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References: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:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oap6q/AKU/Nc85sAkWOr7bFdsfJR4UbCwf+1zdilgRk=; b=cOHlEbBF3+ess4lXDJfK8ftydZ 39HCBk3XatFET00yeA/AMIUDN+J3uZQz7afNKQW6y2RzZ66ZNDId/EqIDNvbewVbUotTn6U/DANPU H+8hH8qwwTlquFkTp2qHLbb5VNAf5i3jV4v+Hj7iLAnJCf/atvpFKlSJCW1RztmM3wrwNtPYD3mof 82nevGjvgJIrm7W5UBpmxfIsNxsYHbTg/TQYFpak+D84wGReSoLG0gRO59Q+eADhTzh36AxXL+sUX bHeQxYgNn3DQ0W94LpIB/HznYy7KDkV5mDDZEe3PMzGW7QH5qvTN8NmcfasEmp3dGZOc/U20Az+mg VsItqCyA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:55716) 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 1peaBH-0000zs-K9; Tue, 21 Mar 2023 11:29:31 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1peaBG-0007gs-A6; Tue, 21 Mar 2023 11:29:30 +0000 Date: Tue, 21 Mar 2023 11:29:30 +0000 From: "Russell King (Oracle)" To: Siddharth Vadapalli Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, rogerq@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, srk@ti.com Subject: Re: [PATCH net-next 2/4] net: ethernet: ti: am65-cpsw: Add support for SGMII mode Message-ID: References: <20230321111958.2800005-1-s-vadapalli@ti.com> <20230321111958.2800005-3-s-vadapalli@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230321111958.2800005-3-s-vadapalli@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_042939_593429_E04AF459 X-CRM114-Status: GOOD ( 19.54 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 21, 2023 at 04:49:56PM +0530, Siddharth Vadapalli wrote: > Add support for configuring the CPSW Ethernet Switch in SGMII mode. > > Depending on the SoC, allow selecting SGMII mode as a supported interface, > based on the compatible used. > > Signed-off-by: Siddharth Vadapalli > --- > drivers/net/ethernet/ti/am65-cpsw-nuss.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c > index cba8db14e160..d2ca1f2035f4 100644 > --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c > +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c > @@ -76,6 +76,7 @@ > #define AM65_CPSW_PORTN_REG_TS_CTL_LTYPE2 0x31C > > #define AM65_CPSW_SGMII_CONTROL_REG 0x010 > +#define AM65_CPSW_SGMII_MR_ADV_ABILITY_REG 0x018 > #define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE BIT(0) Isn't this misplaced? Shouldn't AM65_CPSW_SGMII_MR_ADV_ABILITY_REG come after AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, rather than splitting that from its register offset definition? If the advertisement register is at 0x18, and the lower 16 bits is the advertisement, are the link partner advertisement found in the upper 16 bits? > #define AM65_CPSW_CTL_VLAN_AWARE BIT(1) > @@ -1496,9 +1497,14 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in > struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); > struct am65_cpsw_common *common = port->common; > > - if (common->pdata.extra_modes & BIT(state->interface)) > + if (common->pdata.extra_modes & BIT(state->interface)) { > + if (state->interface == PHY_INTERFACE_MODE_SGMII) > + writel(ADVERTISE_SGMII, > + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); > + I think we can do better with this, by implementing proper PCS support. It seems manufacturers tend to use bought-in IP for this, so have a look at drivers/net/pcs/ to see whether any of those (or the one in the Mediatek patch set on netdev that has recently been applied) will idrive your hardware. However, given the definition of AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, I suspect you won't find a compatible implementation. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel