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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49861C433E0 for ; Tue, 23 Jun 2020 12:03:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F62620738 for ; Tue, 23 Jun 2020 12:03:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="X04X1DG0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732514AbgFWMDJ (ORCPT ); Tue, 23 Jun 2020 08:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732463AbgFWMDI (ORCPT ); Tue, 23 Jun 2020 08:03:08 -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 749CCC061573 for ; Tue, 23 Jun 2020 05:03:08 -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=N+jPkGdRSIhLCRlSN/30ajaOVyouqVc7y5ysot+vl74=; b=X04X1DG0NqqME/pfMkbVeSC1K R4sMa18GOb1sbTH6ruoOiqhOX9/twaMC/miZgOW6tngh9XmNOo9lWjRfylM8q6YWd5cAfT2tCh2jt 64Gm/c6GIkbQfSGCUeqM1PN+B0VALbpH/VsHS23TbaZUZW4LOglK+6d92trBBt6yQoU2+HS3ee9g3 pIKG+Qd5atz9xSX+K9WvbyN4+1Nz/Rl3NxGvpy86fpUar6deNYiPYiPtqviHJyWKJR5TkeBcJYQ2L mLaAgtNz/U6kWz4ljhnyg1gcahtvfzVN9b6RhB0X1wAabcuzijZzChVBb9HG4Ms+G2mg88hwxQawl uhSj+fXbg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:59018) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnhdo-0001jv-M5; Tue, 23 Jun 2020 13:03:04 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jnhdm-000100-2J; Tue, 23 Jun 2020 13:03:02 +0100 Date: Tue, 23 Jun 2020 13:03:02 +0100 From: Russell King - ARM Linux admin To: Ioana Ciornei Cc: "netdev@vger.kernel.org" , "davem@davemloft.net" , Vladimir Oltean , Claudiu Manoil , Alexandru Marginean , "michael@walle.cc" , "andrew@lunn.ch" , "f.fainelli@gmail.com" , "olteanv@gmail.com" Subject: Re: [PATCH net-next v3 4/9] net: phy: add Lynx PCS module Message-ID: <20200623120301.GU1551@shell.armlinux.org.uk> References: <20200621225451.12435-1-ioana.ciornei@nxp.com> <20200621225451.12435-5-ioana.ciornei@nxp.com> <20200622101200.GC1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jun 23, 2020 at 11:49:28AM +0000, Ioana Ciornei wrote: > > This should be added to phylink_mii_c45_pcs_get_state(). There is nothing that > > is Lynx PCS specific here. > > The USXGMII standard only describes the auto-negotiation word, not the MMD > where this can be found (MMD_VEND2 in this case). > I would not add a generic phylink herper that reads the MMD and also > decodes it. > Maybe a helper that just decodes the USXGMII word read from the > Lynx module - phylink_decode_usxgmii_word(state, lpa) ? Yes, you're right - as they come from the vendor 2 MMD, there's no standard. So yes, just a helper to decode the USXGMII word please. > > > +static void lynx_pcs_get_state_2500basex(struct mdio_device *pcs, > > > + struct phylink_link_state *state) { > > > + struct mii_bus *bus = pcs->bus; > > > + int addr = pcs->addr; > > > + int bmsr, lpa; > > > + > > > + bmsr = mdiobus_read(bus, addr, MII_BMSR); > > > + lpa = mdiobus_read(bus, addr, MII_LPA); > > > + if (bmsr < 0 || lpa < 0) { > > > + state->link = false; > > > + return; > > > + } > > > + > > > + state->link = !!(bmsr & BMSR_LSTATUS); > > > + state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE); > > > + if (!state->link) > > > + return; > > > + > > > + state->speed = SPEED_2500; > > > + state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX; > > > > How do you know the other side is using pause frames, or is capable of dealing > > with them? > > Isn't this done by also looking into the PHY's pause frame bits and > enabling pause frames in the MAC only when both the PCS and the PHY > have flow enabled? You are assuming that there is a PHY to read that information from. There may not be a PHY - I have 2500base-X fibre links here, there is no PHY to read that from, there is only the PCS - but this runs with the configuration word present, so is not supported by this code (at least at the moment.) If there is a PHY, these bits will not be used anyway, so there's no point setting them. > Yep, will remove. I've gone through the documentation and the register > should be initialized to 0x0001 when in SGMII mode > (as done by phylink_mii_c22_pcs_config()). Yep, that was actually written referring to the LX2160A documentation. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!