Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp220686rwe; Fri, 26 Aug 2022 03:59:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4u4WHp8fPZrPEx219c3v3t568cBKI6ji1EWIZajbbduLpbHPQ4Vz8J9zbwS81uzjCW0/cc X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr5027052ejb.551.1661511583446; Fri, 26 Aug 2022 03:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661511583; cv=none; d=google.com; s=arc-20160816; b=KYyy4SNxoy7aQ5IYzPWMQD/uSOoRBCek0RSNa5Xt1RIhT3G7hXGlBD1qARjWJTp0e4 kyOPdHtWiWLKOWnS/irwJx2LqsPMuKUh9kq8VQBg9uJIuy1gkAGBdUALwoShFrAnCPVI H64AYO7PkdnlB+14J3euFHumZJxJrXc95gkqhpyk+y7bvx2RvcQUpCIJuFZbM4Fv3D1Q vidUFrK87IMCWTFprTIpjWC+e2ErRYB9hoK67Cm++xJWoD207y6SOqV/gVn/bb4pQZPo jToujwSUkamjhk5shCm6SUbD+5kcyxIZaZKRPwUsNb9sWZxsxLvuVQvfVbNR8EkADP5l k2MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DORtDnzbQWo3oQ+Smi+reTWwrC+pvs77cGaffvaWJDM=; b=LklmRoWHlHOW8qENa/H5kGOxfIxCJbtYEgR/pNzWYEK4uK9Y1MhxP3ak7unoSBTYd9 5qmFtYWVIKeQ0h0lWl1/spkZ8WbOwlGPCwiUXLBpYHwhqBT3KGu218ilUIe3MJyEJUct 0ttwDOmQn4HARmfvzuakjJZMkvMSv447ym2lPD8rWo6QztkxiBL5N62MPeFLfi7j1d0W GZnLjSPqHPWfbKLt97/w54BP1Op0Cl4DbAJBYHZvls02srNd7m5UObHy0xDwy6bFGjdb 92gHSZRaV0gFRnzbyl19tZRMkr6AR2Mk3ogr1LxBJu4KpHFxvUnwQnN9r0HYsBgbgHF7 XQqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a50d592000000b00446e658cfdbsi1098175edi.240.2022.08.26.03.59.17; Fri, 26 Aug 2022 03:59:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343808AbiHZKnx (ORCPT + 99 others); Fri, 26 Aug 2022 06:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235942AbiHZKnv (ORCPT ); Fri, 26 Aug 2022 06:43:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A412D7D29 for ; Fri, 26 Aug 2022 03:43:50 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRWoI-0001QT-PI; Fri, 26 Aug 2022 12:43:34 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oRWoH-0005gY-2G; Fri, 26 Aug 2022 12:43:33 +0200 Date: Fri, 26 Aug 2022 12:43:33 +0200 From: Oleksij Rempel To: Michael Walle Cc: Divya.Koppera@microchip.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, hkallweit1@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, pabeni@redhat.com Subject: Re: [PATCH net-next] net: phy: micrel: Adding SQI support for lan8814 phy Message-ID: <20220826104333.GF2116@pengutronix.de> References: <20220825080549.9444-1-Divya.Koppera@microchip.com> <20220826084249.1031557-1-michael@walle.cc> <421712ea840fbe5edffcae4a6cb08150@walle.cc> <20220826095429.GE2116@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220826095429.GE2116@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 Fri, Aug 26, 2022 at 11:54:29AM +0200, Oleksij Rempel wrote: > Hi, > > On Fri, Aug 26, 2022 at 11:26:12AM +0200, Michael Walle wrote: > > [+ Oleksij Rempel] > > > > Hi, > > > > Am 2022-08-26 11:11, schrieb Divya.Koppera@microchip.com: > > > > > Supports SQI(Signal Quality Index) for lan8814 phy, where it has SQI > > > > > index of 0-7 values and this indicator can be used for cable integrity > > > > > diagnostic and investigating other noise sources. > > > > > > > > > > Signed-off-by: Divya Koppera > > > > .. > > > > > > > +#define LAN8814_DCQ_CTRL_CHANNEL_MASK GENMASK(1, > > > > 0) > > > > > +#define LAN8814_DCQ_SQI 0xe4 > > > > > +#define LAN8814_DCQ_SQI_MAX 7 > > > > > +#define LAN8814_DCQ_SQI_VAL_MASK GENMASK(3, 1) > > > > > + > > > > > static int lanphy_read_page_reg(struct phy_device *phydev, int page, > > > > > u32 addr) { > > > > > int data; > > > > > @@ -2927,6 +2934,32 @@ static int lan8814_probe(struct phy_device > > > > *phydev) > > > > > return 0; > > > > > } > > > > > > > > > > +static int lan8814_get_sqi(struct phy_device *phydev) { > > > > > + int rc, val; > > > > > + > > > > > + val = lanphy_read_page_reg(phydev, 1, LAN8814_DCQ_CTRL); > > > > > + if (val < 0) > > > > > + return val; > > > > > + > > > > > + val &= ~LAN8814_DCQ_CTRL_CHANNEL_MASK; > > > > > > > > I do have a datasheet for this PHY, but it doesn't mention 0xe6 on > > > > EP1. > > > > > > This register values are present in GPHY hard macro as below > > > > > > 4.2.225 DCQ Control Register > > > Index (In Decimal): EP 1.230 Size: 16 bits > > > > > > Can you give me the name of the datasheet which you are following, so > > > that I'll check and let you know the reason. > > > > I have the AN4286/DS00004286A ("LAN8804/LAN8814 GPHY Register > > Definitions"). Maybe there is a newer version of it. > > > > > > > > > So I can only guess that this "channel mask" is for the 4 rx/tx > > > > pairs on GbE? > > > > > > Yes channel mask is for wire pair. > > > > > > > And you only seem to evaluate one of them. Is that the correct thing > > > > to do > > > > here? > > > > > > > > > > I found in below link is that, get_SQI returns sqi value for 100 base-t1 > > > phy's > > > https://lore.kernel.org/netdev/20200519075200.24631-2-o.rempel@pengutronix.de/T/ > > > > That one is for the 100base-t1 which has only one pair. > > > > > In lan8814 phy only channel 0 is used for 100base-tx. So returning SQI > > > value for channel 0. > > > > What if the other pairs are bad? Maybe Oleksij has an opinion here. > > > > Also 100baseTX (and 10baseT) has two pairs, one for transmitting and one > > for receiving. I guess you meassure the SQI on the receiving side. So is > > channel 0 correct here? > > > > Again this is the first time I hear about SQI but it puzzles me that > > it only evaluate one pair in this case. So as a user who reads this > > SQI might be misleaded. > > Wow! I was so possessed with one-pair networks, that forgot to image > that there is 1000Base-T with more then one pairs :D > > Yes, your are right. We wont to have readings from all RX channels and > be able to export them to the user space. In fact, if i see it > correctly, the LAN8814_DCQ_CTRL_CHANNEL_MASK value should be synced with > the MDI-X state. Otherwise we will be reading TX channels. Just an idea not really related to this patch. It will be coll to be able to generate diagnostic graphs like this: Interface | pairs | data | power | SQI | cable | selft | direction | | | test | test eth0 ok 0 | RX | NC | 7/7 | ok | 1 | TX | NC | NA | ok | 2 | NC | + 10W | NA | ok | 3 | NC | - | NA | ok | -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |