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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD87C433EF for ; Thu, 19 May 2022 14:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239696AbiESO0g (ORCPT ); Thu, 19 May 2022 10:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239348AbiESO0b (ORCPT ); Thu, 19 May 2022 10:26:31 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1752737002; Thu, 19 May 2022 07:26:29 -0700 (PDT) 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=7GgMfKIL4eOaBr7+tGiHzVQvi5p6f4TXu98a+NEhGJg=; b=igfou1cBpIpplBzY2402a/7/Xt NBVixRZoc1H2RE5pJVf4KzDFqCZmF6r1nSopIp4EhEkGv6COSrRcw6V7wKGLxpjFYBpNQK6p4jkbg EvueVA4ktbf5M2JjD4RYfv9LQlrnNmml+tReRL7DRy2rP8JTyFTEu3Nx5r3kMKVZ8hsitK/Ch2nnt TTnW9HKKFlM6Zz3h2k5eDsu1usfTZfdc8EJUVWk8zWNNC1+dcFu5EA6+7DjcZzadioCmwfUtQ2rcj mp3y8yHS1gG2Y2hGVP9r1HdwvletPAdJ+xxya+OgZZYWBxN3E0C3++rLDR3UEyjLzNs1F5Zf4I8j1 aJYAz0ew==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60774) 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 1nrh6e-0003yl-Um; Thu, 19 May 2022 15:26:25 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nrh6d-0006dU-DN; Thu, 19 May 2022 15:26:23 +0100 Date: Thu, 19 May 2022 15:26:23 +0100 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Florian Fainelli , Heiner Kallweit , linux-arm-kernel@lists.infradead.org, Richard Cochran , Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next 3/6] net: lan966x: Add QUSGMII support for lan966x Message-ID: References: <20220519135647.465653-1-maxime.chevallier@bootlin.com> <20220519135647.465653-4-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220519135647.465653-4-maxime.chevallier@bootlin.com> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, May 19, 2022 at 03:56:44PM +0200, Maxime Chevallier wrote: > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > index e6642083ab9e..304c784f48f6 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > @@ -452,4 +452,10 @@ static inline void lan_rmw(u32 val, u32 mask, struct lan966x *lan966x, > gcnt, gwidth, raddr, rinst, rcnt, rwidth)); > } > > +static inline bool lan966x_is_qsgmii(phy_interface_t mode) > +{ > + return (mode == PHY_INTERFACE_MODE_QSGMII) || > + (mode == PHY_INTERFACE_MODE_QUSGMII); > +} Maybe linux/phy.h should provide a helper, something like: phy_interface_serdes_lanes() that returns how many serdes lanes the interface mode uses? > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > index 38a7e95d69b4..96708352f53e 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > @@ -28,11 +28,18 @@ static int lan966x_phylink_mac_prepare(struct phylink_config *config, > phy_interface_t iface) > { > struct lan966x_port *port = netdev_priv(to_net_dev(config->dev)); > + phy_interface_t serdes_mode = iface; > int err; > > if (port->serdes) { > + /* As far as the SerDes is concerned, QUSGMII is the same as > + * QSGMII. > + */ > + if (lan966x_is_qsgmii(iface)) > + serdes_mode = PHY_INTERFACE_MODE_QSGMII; > + > err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET, > - iface); > + serdes_mode); I don't think that the ethernet MAC driver should be changing the interface mode before passing it down to the generic PHY layer - phy_set_mode_ext() is defined to take the phy interface mode, and any aliasing of modes should really be up to the generic PHY driver not the ethernet MAC driver. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! 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 696A5C433F5 for ; Thu, 19 May 2022 15:16:54 +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=cmWq3f29WaFc4mBtFGiHNQcAVed9/XRLe0z17634xik=; b=zydCIn4mOqtgFB LN3AiFI4kwAIJtleeqMJJQVH2KO3nMI+T3a2BcH9wTwf3k6hsHz+V8PsYHSNN16lpgLvWZ0l5s9zg D9nP6X753Qm5wKOd5to2QMTpUplOp1KVH6Eynq1TRnJK+MoP+91T0lGI+7z+jcHl6gh6OsF13izj8 ShFLTgxXtqmp5EM9ivXsPT4xYU+wC0Ens7hCDBRgHr6y5lVgLS/OySly7qFRKM3GETOT1HNkPPtXY ctJ8/B4Yv/G+3okL35gTIgIctHG9FX2s0zKiAg303YjhWIpEbeRxCLTyJ43xMHoEkYKhFURZuJZii l6xx9gA3F6L8tdKxcugA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrhsA-007pMn-L4; Thu, 19 May 2022 15:15:30 +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 1nrh6w-007PJk-4g for linux-arm-kernel@lists.infradead.org; Thu, 19 May 2022 14:26:44 +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=7GgMfKIL4eOaBr7+tGiHzVQvi5p6f4TXu98a+NEhGJg=; b=igfou1cBpIpplBzY2402a/7/Xt NBVixRZoc1H2RE5pJVf4KzDFqCZmF6r1nSopIp4EhEkGv6COSrRcw6V7wKGLxpjFYBpNQK6p4jkbg EvueVA4ktbf5M2JjD4RYfv9LQlrnNmml+tReRL7DRy2rP8JTyFTEu3Nx5r3kMKVZ8hsitK/Ch2nnt TTnW9HKKFlM6Zz3h2k5eDsu1usfTZfdc8EJUVWk8zWNNC1+dcFu5EA6+7DjcZzadioCmwfUtQ2rcj mp3y8yHS1gG2Y2hGVP9r1HdwvletPAdJ+xxya+OgZZYWBxN3E0C3++rLDR3UEyjLzNs1F5Zf4I8j1 aJYAz0ew==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60774) 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 1nrh6e-0003yl-Um; Thu, 19 May 2022 15:26:25 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nrh6d-0006dU-DN; Thu, 19 May 2022 15:26:23 +0100 Date: Thu, 19 May 2022 15:26:23 +0100 From: "Russell King (Oracle)" To: Maxime Chevallier Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Florian Fainelli , Heiner Kallweit , linux-arm-kernel@lists.infradead.org, Richard Cochran , Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next 3/6] net: lan966x: Add QUSGMII support for lan966x Message-ID: References: <20220519135647.465653-1-maxime.chevallier@bootlin.com> <20220519135647.465653-4-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220519135647.465653-4-maxime.chevallier@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220519_072642_245336_97EAB82C X-CRM114-Status: GOOD ( 19.82 ) 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 Hi, On Thu, May 19, 2022 at 03:56:44PM +0200, Maxime Chevallier wrote: > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > index e6642083ab9e..304c784f48f6 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h > @@ -452,4 +452,10 @@ static inline void lan_rmw(u32 val, u32 mask, struct lan966x *lan966x, > gcnt, gwidth, raddr, rinst, rcnt, rwidth)); > } > > +static inline bool lan966x_is_qsgmii(phy_interface_t mode) > +{ > + return (mode == PHY_INTERFACE_MODE_QSGMII) || > + (mode == PHY_INTERFACE_MODE_QUSGMII); > +} Maybe linux/phy.h should provide a helper, something like: phy_interface_serdes_lanes() that returns how many serdes lanes the interface mode uses? > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > index 38a7e95d69b4..96708352f53e 100644 > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c > @@ -28,11 +28,18 @@ static int lan966x_phylink_mac_prepare(struct phylink_config *config, > phy_interface_t iface) > { > struct lan966x_port *port = netdev_priv(to_net_dev(config->dev)); > + phy_interface_t serdes_mode = iface; > int err; > > if (port->serdes) { > + /* As far as the SerDes is concerned, QUSGMII is the same as > + * QSGMII. > + */ > + if (lan966x_is_qsgmii(iface)) > + serdes_mode = PHY_INTERFACE_MODE_QSGMII; > + > err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET, > - iface); > + serdes_mode); I don't think that the ethernet MAC driver should be changing the interface mode before passing it down to the generic PHY layer - phy_set_mode_ext() is defined to take the phy interface mode, and any aliasing of modes should really be up to the generic PHY driver not the ethernet MAC driver. 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