Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp486636iog; Thu, 30 Jun 2022 04:51:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u4HkP/e73fb/6czS848roSwXFYTsU+m/5bNsHimflGdtmwlqMXlQl85NhvvjS33cr67Krv X-Received: by 2002:a63:7e1a:0:b0:40c:c3b9:f97c with SMTP id z26-20020a637e1a000000b0040cc3b9f97cmr7544059pgc.498.1656589888787; Thu, 30 Jun 2022 04:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656589888; cv=none; d=google.com; s=arc-20160816; b=rK+byHVLaoS2IaDiZS7DjsHkXa6LNyJgDOHTI7jlIFxphTDpQqTDXJ4GkhZ6zX01eM GUFOY/QSIrC0UA5BsUPqJP08+1MR30bsRnnMKody478JJggrvuuc4ZSMBdX5wnQ2Oi0t s6k/RpShiToiqimqtBzIPVAJwEQQ6XjFIar1wsOsOFUGNd+qKZIOnbdI8ZQxqKUBp9dz lmuYBl78ba1sXprQrPZJUbuk5Eq+moO60g0T667cqGnW2SoK2wzK3OoPRaItERwYwa3T 8TXAo84cf695x4ZlhPO/IXHc1VH1/eGWcPCZquyILE84wQsQD80UVv+4sKp1o0nmJ+aV xXzA== 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=pCVLDadV5ten+hI6vWRZbnBdPC+AeuTjF2D/qYD+soU=; b=Ey+WWu80quIXK024xTAX2KP+RxjvSwHrmLPEpDEd72gEDx+OujpUAZhO+KvmgAm9Ty BMI9d2IA5LJD923tMaQ7mRetn94BlDstjlrcrwq7lox8sLH7wE1+G2CyAEfW70T987ou 2MCkPc2GQsVCKYRlWkBQAtVzcz9Qey28ONbhx4b2g6qReDUd+9DVb6edXsjBX0znvjNq 4d1J5QoykwCGZZltoyuEWxbrVxrWCMsZ2wt0MjTQ/oj2MXqz9f5RKHAA1tPzQ7BDjY2C XlnB6D+YCMx1Hxd0YBrtMLeOoXnrmQ/4+j5lJ1YfUnfiT/lcyzMM6RDJ3H9H+GmpuEj6 pvpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=URILelAH; 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 g64-20020a636b43000000b004114427e980si6900712pgc.285.2022.06.30.04.51.17; Thu, 30 Jun 2022 04:51:28 -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=URILelAH; 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 S235046AbiF3Lmg (ORCPT + 99 others); Thu, 30 Jun 2022 07:42:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbiF3Lmc (ORCPT ); Thu, 30 Jun 2022 07:42:32 -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 C7F6F58FCA; Thu, 30 Jun 2022 04:42:31 -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=pCVLDadV5ten+hI6vWRZbnBdPC+AeuTjF2D/qYD+soU=; b=URILelAHkP5sNj7GCPdqIAlP85 mwvBvo7cYQFudtfKq7Jpu0ifkS6tR/bsjkiNEg87fn6Keur4eVCZBcbZLL1AlXLx0oiMVMwRRtjTz ucGVEQR4h4KZJNVUzHZdEuXXKsf17V5xOk3MNMmlSRcpojtU3gyJgOFN51+TtCNNNtGwFHLMCNLp6 WIMjOqTrMoR6mXHI8/R+tfdHgGnfuhpB0rUUTTxzYikWBNOuV9hXNRPsbiih8vMB6vHVpYQdv3FY7 mMhuAshVrIO6Qf/GegBaHIsZEH008S/x8aUhPNcPLhGclMW9aTWf2v0dZ+7gvBH0OK7eQ3lkBFI5n 7ZffnVGw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33116) 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 1o6sZ2-0004MZ-OK; Thu, 30 Jun 2022 12:42:28 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1o6sZ0-0006lS-Qs; Thu, 30 Jun 2022 12:42:26 +0100 Date: Thu, 30 Jun 2022 12:42:26 +0100 From: "Russell King (Oracle)" To: Arun Ramadoss Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Subject: Re: [Patch net-next v14 11/13] net: dsa: microchip: lan937x: add phylink_mac_link_up support Message-ID: References: <20220630102041.25555-1-arun.ramadoss@microchip.com> <20220630102041.25555-12-arun.ramadoss@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220630102041.25555-12-arun.ramadoss@microchip.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 On Thu, Jun 30, 2022 at 03:50:39PM +0530, Arun Ramadoss wrote: > +static void lan937x_config_gbit(struct ksz_device *dev, bool gbit, u8 *data) > +{ > + if (gbit) > + *data &= ~PORT_MII_NOT_1GBIT; > + else > + *data |= PORT_MII_NOT_1GBIT; > +} > + > +static void lan937x_config_interface(struct ksz_device *dev, int port, > + int speed, int duplex, > + bool tx_pause, bool rx_pause) > +{ > + u8 xmii_ctrl0, xmii_ctrl1; > + > + ksz_pread8(dev, port, REG_PORT_XMII_CTRL_0, &xmii_ctrl0); > + ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &xmii_ctrl1); > + > + switch (speed) { > + case SPEED_1000: > + lan937x_config_gbit(dev, true, &xmii_ctrl1); > + break; > + case SPEED_100: > + lan937x_config_gbit(dev, false, &xmii_ctrl1); > + xmii_ctrl0 |= PORT_MII_100MBIT; > + break; > + case SPEED_10: > + lan937x_config_gbit(dev, false, &xmii_ctrl1); > + xmii_ctrl0 &= ~PORT_MII_100MBIT; > + break; > + default: > + dev_err(dev->dev, "Unsupported speed on port %d: %d\n", > + port, speed); > + return; > + } Isn't this: if (speed == SPEED_1000) xmii_ctrl1 &= ~PORT_MII_NOT_1GBIT; else xmii_ctrl1 |= PORT_MII_NOT_1GBIT; if (speed == SPEED_100) xmii_ctrl0 |= PORT_MII_100MBIT; else xmii_ctrl0 &= ~PORT_MII_100MBIT; There isn't much need to validate that "speed" is correct, you've already told phylink that you only support 1G, 100M and 10M so you're not going to get called with anything except one of those. > + > + if (duplex) > + xmii_ctrl0 |= PORT_MII_FULL_DUPLEX; > + else > + xmii_ctrl0 &= ~PORT_MII_FULL_DUPLEX; > + > + if (tx_pause) > + xmii_ctrl0 |= PORT_MII_TX_FLOW_CTRL; > + else > + xmii_ctrl1 &= ~PORT_MII_TX_FLOW_CTRL; It seems weird to set a bit in one register and clear it in a different register. I suspect you mean xmii_ctrl0 here. > + > + if (rx_pause) > + xmii_ctrl0 |= PORT_MII_RX_FLOW_CTRL; > + else > + xmii_ctrl0 &= ~PORT_MII_RX_FLOW_CTRL; > + > + ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_0, xmii_ctrl0); > + ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_1, xmii_ctrl1); > +} > + Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!