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 9F245C433F5 for ; Thu, 13 Jan 2022 06:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231678AbiAMGcm (ORCPT ); Thu, 13 Jan 2022 01:32:42 -0500 Received: from mxout70.expurgate.net ([91.198.224.70]:16495 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiAMGck (ORCPT ); Thu, 13 Jan 2022 01:32:40 -0500 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1n7tep-000UBk-HS; Thu, 13 Jan 2022 07:32:23 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7teo-000K55-Gc; Thu, 13 Jan 2022 07:32:22 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id BBEE324004F; Thu, 13 Jan 2022 07:32:19 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 16A23240049; Thu, 13 Jan 2022 07:32:19 +0100 (CET) Received: from mail.dev.tdt.de (localhost [IPv6:::1]) by mail.dev.tdt.de (Postfix) with ESMTP id 7399A23BE5; Thu, 13 Jan 2022 07:32:13 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 13 Jan 2022 07:32:13 +0100 From: Martin Schiller To: Tim Harvey Cc: "Russell King (Oracle)" , Hauke Mehrtens , martin.blumenstingl@googlemail.com, Florian Fainelli , Andrew Lunn , hkallweit1@gmail.com, David Miller , kuba@kernel.org, netdev , open list Subject: Re: [PATCH net-next v6] net: phy: intel-xway: Add RGMII internal delay configuration Organization: TDT AG In-Reply-To: References: <20210719082756.15733-1-ms@dev.tdt.de> <94120968908a8ab073fa2fc0dd56b17d@dev.tdt.de> Message-ID: <81cce37d4222bbbd941fcc78ff9cacca@dev.tdt.de> X-Sender: ms@dev.tdt.de User-Agent: Roundcube Webmail/1.3.17 X-purgate-ID: 151534::1642055543-0000E498-6EE9F38F/0/0 X-purgate-type: clean X-purgate: clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-12 19:25, Tim Harvey wrote: > On Wed, Jan 12, 2022 at 5:46 AM Russell King (Oracle) > wrote: >> >> On Tue, Jan 11, 2022 at 11:12:33AM -0800, Tim Harvey wrote: >> > I added a debug statement in xway_gphy_rgmii_init and here you can see >> > it gets called 'before' the link comes up from the NIC on a board that >> > has a cable plugged in at power-on. I can tell from testing that the >> > rx_delay/tx_delay set in xway_gphy_rgmii_init does not actually take >> > effect unless I then bring the link down and up again manually as you >> > indicate. >> > >> > # dmesg | egrep "xway|nicvf" >> > [ 6.855971] xway_gphy_rgmii_init mdio_thunder MDI_MIICTRL:0xb100 >> > rx_delay=1500 tx_delay=500 >> > [ 6.999651] nicvf, ver 1.0 >> > [ 7.002478] nicvf 0000:05:00.1: Adding to iommu group 7 >> > [ 7.007785] nicvf 0000:05:00.1: enabling device (0004 -> 0006) >> > [ 7.053189] nicvf 0000:05:00.2: Adding to iommu group 8 >> > [ 7.058511] nicvf 0000:05:00.2: enabling device (0004 -> 0006) >> > [ 11.044616] nicvf 0000:05:00.2 eth1: Link is Up 1000 Mbps Full duplex >> >> Does the kernel message about the link coming up reflect what is going >> on physically with the link though? >> >> If a network interface is down, it's entirely possible that the link >> is >> already established at the hardware level, buit the "Link is Up" >> message >> gets reported when the network interface is later brought up. So, >> debugging this by looking at the kernel messages is unreliable. >> > > Russell, > > You are correct... the link doesn't come up at that point its already > linked. So we need to force a reset or an auto negotiation reset after > modifying the delays. > > Tim Setting BMCR_ANRESTART would work, but only if BMCR_ANENABLE is also or already set. Otherwise BMCR_ANRESTART has no effect (see the note in the datasheet). This is the reason why I came up with the idea of BMCR_PDOWN. Personally I would have no problem with setting BMCR_ANRESTART and BMCR_ANENABLE, but it would possibly change the existing configuration if (e.g. by the bootloader) aneg should be disabled. Martin