Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp189451ioo; Fri, 20 May 2022 18:16:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNxe2Bs/UPSZgFLInGltHg0D3OV9n3pKdHUQKlzKmOqx0a0c+v/x64kvk6jS7ATrbokTUT X-Received: by 2002:a17:907:1c25:b0:6f4:2d46:52ce with SMTP id nc37-20020a1709071c2500b006f42d4652cemr10946792ejc.25.1653095816598; Fri, 20 May 2022 18:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653095816; cv=none; d=google.com; s=arc-20160816; b=DGOGTXvG5az2M1y8VeYkShKJCa7Z+H9fDnJRFVAOoYecucO0+NeLlx0HGGGTjw3zhj WLuRgJsLU2pS3EBQH9rlOSNvVT2jYhtJpvmW3iJauDeL5LkIC1jurJxWJdzdsuConomj ISFCi935jE20FlIeJeg5U9kJNAC/IGGz51Fj47CbWPFD//6lPD+2VLVLr0mqWZMUbc1j kNEB+uWOwNEGTEVDCI9hm+8olRzG0Eun3SNkJh4kogV1x2do5cl9F1b0HcjJ6t/DHjtX +XEdFgIJzI7FJIzdFVWJGcjIbKqgWW+oPF1i4AVHkukVshRyqlKW75qSLRI8sPvJbCkR 0Trw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7GgMfKIL4eOaBr7+tGiHzVQvi5p6f4TXu98a+NEhGJg=; b=INahx9L03RB9r7CJQHOUoeqx5zEhgGb1xqpVzNGMdoV3m5kvTH3Wpv2FoJa3ZHnDk0 UW1Y8xBE6Y5wRpy9+QLindXC5zBGQQ7fHUoft07Dl79OhrAu4PP75BPtEFd8+JRVHePm 9pVKIg/+E2xmak2L313y5BCiSFyt4MSTluarNLpBN6n1G5Qc7oq1TsLcjl73BolwTXz6 gubJ2U7siMW1eTkLDSunGViToQOKHDqNuMStkoDJrFPctJREBWms5EpcuHSPT/Lj77ke Qp56JXml8awH+P2EqT3HxcK6uPS4myyUVGRraw+DaprVJTjcc7zDhr/kXw2YAjmqHOhu 8b2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=igfou1cB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go42-20020a1709070daa00b006f4cbc841d7si4138591ejc.1005.2022.05.20.18.16.30; Fri, 20 May 2022 18:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=igfou1cB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239686AbiESO0f (ORCPT + 99 others); Thu, 19 May 2022 10:26:35 -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) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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!