Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp416531ybm; Thu, 28 May 2020 06:12:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDCdrJkLItsfsC/zoqbp+VGxGdKv8Ug1U0SYyb2VWkfVCM8OMk5McM1vuFMHFFe3iWMMNE X-Received: by 2002:a05:6402:128d:: with SMTP id w13mr3168091edv.0.1590671574244; Thu, 28 May 2020 06:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590671574; cv=none; d=google.com; s=arc-20160816; b=LvSHrS3vWBfKdolt0rjHTSL60AigNtC1WxJamLvxYzu4pw5LoUSbhCzZLagk0CC0Vi EUPBtzvuZ+F9m0izsJziTZbh0OHEaStgetDopcxYpS6X2UowHkTRxEwj8/b3Lctc1+/c lJTKwglRQcMXOY9jXx2Xpi99SeRKAqXsnI/3n1YU9fZM6pxkuWwPNUzJHQhyEx7HW0C2 Rjh92GLK0U1C85nFJmCU3vHmsWEugjvHtcw7t/20nSsJoqoX8dJTssep2fWbxMoqJY14 12smIcYkv6EG31B1+qtijHXBIP84HFF0DRog5Wx68I7StHJMu4fPlJRQn5LMb1wVJzbn vP5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=PFNpJOdNreBWIv2VXMSlp6vZWYItaUUXM5F73hUgu2U=; b=KkL7ffbOlduDRNpFoEjxQ56GsenPrw1eo3YIBrycD+dSVOXfPuKv+qmhd4KzJuSB8/ TzXEEwTz3rGxg+I3iMmLiTQwFltzE2wWhJPpSg0o3wPf2OoZv9fs2o5+e+j6CPz4PPaT yQf7y4oMsxLXDNoER5HZM9fl4NlgRUzW5/9/Mz7JABvA4U24F/OZ3qGfEHU1ORxcHBRm XlqAJf2go5QETW4BXEdBFAAO6XHHxVhyvOMKgK2dYgNnUBJOvx3swMO3HB+ZMb2sTlIY gDw5KKaK2osSXBptm/FMHoTCVlcu6Leaymm7ABe+mg3C7zBx2uAf0tYlciBBu0Cc4gjG QEyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si2655386ejl.366.2020.05.28.06.12.29; Thu, 28 May 2020 06:12:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390221AbgE1NKX (ORCPT + 99 others); Thu, 28 May 2020 09:10:23 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:38257 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390089AbgE1NKU (ORCPT ); Thu, 28 May 2020 09:10:20 -0400 Received: by mail-ot1-f65.google.com with SMTP id o13so2292930otl.5; Thu, 28 May 2020 06:10:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PFNpJOdNreBWIv2VXMSlp6vZWYItaUUXM5F73hUgu2U=; b=KpQoZKEgtjmy/OOFtS570wk2BDehWspjwu2oiW6u4Nh7DMWo8+BNVlCyQN+1/cUUDh ep6glPMsAsTxuSFtiwG8YLVvlWt1xFWHazoddEIda541+eICaBml8k00X0eJQxff8sFw DuCyFe3Kj6jNnwdxaRX4PlZOYvjdkNfrfF6qOm5oqasLPR/qe6GTsfl6D8+rpTdiTfrB CANT2HD+3DyYv2fs+6nXlQG7m5GBeYHz+AhJV/YkxWYbqmuchqDw0WmF+1ao33QNJRTx tA+gjGYCWt/yVkkGk/XMG9quRQa+1foPW0YlkYL1PYMfKS+1wjH6DeSGkytKWsKuEgLZ 48ug== X-Gm-Message-State: AOAM531X2dl/1sRaJjcixleNQYJ7XPBxGnjoc9uAlutVUE2D7CPx/aSb 4xBRv4jBODSR28GOfYYA12OSLheCINli4AMJ97s= X-Received: by 2002:a05:6830:1151:: with SMTP id x17mr2247633otq.250.1590671418177; Thu, 28 May 2020 06:10:18 -0700 (PDT) MIME-Version: 1.0 References: <20200422072137.8517-1-o.rempel@pengutronix.de> <20200428154718.GA24923@lunn.ch> <6791722391359fce92b39e3a21eef89495ccf156.camel@toradex.com> <20200429092616.7ug4kdgdltxowkcs@pengutronix.de> <20200527205221.GA818296@lunn.ch> In-Reply-To: <20200527205221.GA818296@lunn.ch> From: Geert Uytterhoeven Date: Thu, 28 May 2020 15:10:06 +0200 Message-ID: Subject: Re: [PATCH net-next v3] net: phy: micrel: add phy-mode support for the KSZ9031 PHY To: Andrew Lunn Cc: Oleksij Rempel , Philippe Schenker , "sergei.shtylyov@cogentembedded.com" , "kernel@pengutronix.de" , "davem@davemloft.net" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "linux-kernel@vger.kernel.org" , "david@protonic.nl" , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "linux-renesas-soc@vger.kernel.org" , Kazuya Mizuguchi , Grygorii Strashko Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, On Wed, May 27, 2020 at 10:52 PM Andrew Lunn wrote: > > You may wonder what's the difference between 3 and 4? It's not just the > > PHY driver that looks at phy-mode! > > drivers/net/ethernet/renesas/ravb_main.c:ravb_set_delay_mode() also > > does, and configures an additional TX clock delay of 1.8 ns if TXID is > > enabled. > > That sounds like a MAC bug. Either the MAC insert the delay, or the > PHY does. If the MAC decides it is going to insert the delay, it > should be masking what it passes to phylib so that the PHY does not > add a second delay. And so I gave this a try, and modified the ravb driver to pass "rgmii" to the PHY if it has inserted a delay. That fixes the speed issue on R-Car M3-W! And gets rid of the "*-skew-ps values should be used only with..." message. I also tried if I can get rid of "rxc-skew-ps = <1500>". After dropping the property, DHCP failed. Compensating by changing the PHY mode in DT from "rgmii-txid" to "rgmii-id" makes it work again. However, given Philippe's comment that the rgmi-*id apply to the PHY only, I think we need new DT properties for enabling MAC internal delays. > This whole area of RGMII delays has a number of historical bugs, which > often counter act each other. So you fix one, and it break somewhere > else. Indeed... > In this case, not allowing skews for plain RGMII is probably being too > strict. We probably should relax that constrain in this case, for this > PHY driver. That description is not quite correct: the driver expects skews for plain RGMII only. For RGMII-*ID, it prints a warning, but still applies the supplied skew values. To fix the issue, I came up with the following problem statement and plan: A. Old behavior: 1. ravb acts upon "rgmii-*id" (on SoCs that support it[1]), 2. ksz9031 ignored "rgmii-*id", using hardware defaults for skew values. B. New behavior (broken): 1. ravb acts upon "rgmii-*id", 2. ksz9031 acts upon "rgmii-*id". C. Quick fix for v5.8 (workaround, backwards-compatible with old DTB): 1. ravb acts upon "rgmii-*id", but passes "rgmii" to phy, 2. ksz9031 acts upon "rgmi", using new "rgmii" skew values. D. Long-term fix: 1. Check if new boolean "renesas,[rt]x-delay"[2] values are specified in DTB. No: ravb acts upon "rgmii-*id", but passes "rgmii" to phy, for backwards-compatibility, Yes: ravb enables TX clock delay of 2.0 ns and/or RX clock delay of 1.8 ns, based on "renesas,[rt]x-delay" values, and passes the unmodified interface type to phy, 2. ksz9031 acts upon "rgmii*", 3. Salvator-X(S) DTS makes things explicit by changing it from phy-mode = "rgmii-txid"; rxc-skew-ps = <1500>; to: phy-mode = "rgmii"; renesas,rx-delay = ; renesas,tx-delay = ; rxc-skew-ps = <1500>; or: phy-mode = "rgmii"; renesas,rx-delay = ; renesas,tx-delay = ; [2] Should we use numerical "renesas,[rt]x-delay-ps" instead? The only supported values are 0 and 2000 (TX) or 1800 (RX). The ULCB boards are very similar to Salvator-X(S), so I guess they behave the same, and are thus affected. Unfortunately there are other boards that use R-Car Gen3 EtherAVB: - The Silicon Linux sub board for CAT874 (CAT875) connects EtherAVB to an RTL8211E PHY. As it uses the "rgmii" mode, it should not be affected. - The HiHope RZ/G2M sub board connects EtherAVB to an RTL8211E PHY. It uses the "rgmii-txid" mode, so it will be affacted by modifying the ravb driver. - Eagle and V3MSK connect EtherAVB to a KSZ9031, and use the "rgmii-id" mode with rxc-skew-ps = <1500>, so they are affected. - Ebisu and Draak connect EtherAVB to a KSZ9031, and use the "rgmii" mode with rxc-skew-ps = <1500>. However, they're limited to 100 Mbps, as EtherAVB on R-Car E3 and D3 do not support TX clock internal delay mode[1], and the delays provided by KSZ9031 clock pad skew were deemed insufficient. Obviously, the affected boards will need testing (I only have Salvator-X(S) and Ebisu). Does the above make sense? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds