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=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham 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 0AFE1C43219 for ; Mon, 29 Apr 2019 17:37:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA14720652 for ; Mon, 29 Apr 2019 17:37:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QiFVKbif" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729098AbfD2Rhj (ORCPT ); Mon, 29 Apr 2019 13:37:39 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:37987 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728748AbfD2Rhi (ORCPT ); Mon, 29 Apr 2019 13:37:38 -0400 Received: by mail-yw1-f67.google.com with SMTP id i66so4007214ywe.5; Mon, 29 Apr 2019 10:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zEdf9d4KQvbMaZGBunv4+X3eRcRsfOxXcPjEXykTguk=; b=QiFVKbifUNyJUfYIRv9SRFfcWdmKzj6RXf604b+L/yfg46/AFGfN4hjbOvLWe3pdz7 /PtHsRyUYUjMs+mEaOWw6+m1ajTxn20RuRqskQipBHXvfmuM7kHGXn8Q8Huff5PxzOoQ MfDKAvqsaLSh4biGXA/2tpdjmHnASzIWyNTKyqpEfAbpcj0NBVNwRh1TvlqMNoJyDNJI K25Rs3A3gtiwoZAhUmfW5yxg3lB87w3v2qj9KX0Tz7Im+rmiMALBn1uWokLWdSkbIDLc PmcLOzSnsHV0xB80OCTk5Wv8St34qw8SRM4AMYfbUprJrbevrM/6+O6/2PN2VBTMnhmP 3XMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=zEdf9d4KQvbMaZGBunv4+X3eRcRsfOxXcPjEXykTguk=; b=App/0OOwRY0W9VgD8TYmJyJM5RGKVyANM0MuuGf0DGQG3tCuLrleAEpZm9kMSzeT9C i5c+NUBh8m+R13U+vYj2qcq23H196w+ug90IGm6cQaCpU2aCLO6kgEbdvgNbpeaMhmn4 z/zVvUt4FxZMx5rIHgyu//wgS9yOP87wix9lMfdEKRw3BwHkVQMsdam0/mspvCLeTNfS ySYKbA+T7UB3U0nv5llIb48OqaadYKMhMJdfpGKMaALVCz7nEheiiinAjeDJ8unovL7m 30PaAOrNh9MXz5synYh0eHrFrTdVGBOs5Rp6bcHEeZ/SyZgB1HmPCJ2q7ZrAuf+sXkwe XkPA== X-Gm-Message-State: APjAAAWgakicJLM5rRpc+tiMsYObat67d3/FItzoWv9h1zauqhDLNATn xelZHUHCwT+Kf8ZVVWXbBuPfF/sM X-Google-Smtp-Source: APXvYqzkorFpQo1egvmtFG0eYJXSW3Dxp3JCjKgTxXc5Uxr1j/erUHXDFmVbkWRlXLCVtOz9L0gs/Q== X-Received: by 2002:a81:2209:: with SMTP id i9mr52212412ywi.293.1556559456818; Mon, 29 Apr 2019 10:37:36 -0700 (PDT) Received: from [10.67.48.227] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id b69sm1376833ywh.18.2019.04.29.10.37.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 10:37:35 -0700 (PDT) Subject: Re: [PATCH v2 2/2] net: phy: realtek: Change TX-delay setting for RGMII modes only To: Serge Semin , Andrew Lunn Cc: Heiner Kallweit , "David S. Miller" , Serge Semin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190426212112.5624-1-fancer.lancer@gmail.com> <20190426212112.5624-2-fancer.lancer@gmail.com> <20190426214631.GV4041@lunn.ch> <20190426233511.qnkgz75ag7axt5lp@mobilestation> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= mQGiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz7QnRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBnbWFpbC5jb20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Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190426233511.qnkgz75ag7axt5lp@mobilestation> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/26/19 4:35 PM, Serge Semin wrote: > On Fri, Apr 26, 2019 at 11:46:31PM +0200, Andrew Lunn wrote: >> On Sat, Apr 27, 2019 at 12:21:12AM +0300, Serge Semin wrote: >>> It's prone to problems if delay is cleared out for other than RGMII >>> modes. So lets set/clear the TX-delay in the config register only >>> if actually RGMII-like interface mode is requested. >>> >>> Signed-off-by: Serge Semin >>> >>> --- >>> drivers/net/phy/realtek.c | 16 ++++++++++++---- >>> 1 file changed, 12 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c >>> index ab567a1923ad..a18cb01158f9 100644 >>> --- a/drivers/net/phy/realtek.c >>> +++ b/drivers/net/phy/realtek.c >>> @@ -163,16 +163,24 @@ static int rtl8211c_config_init(struct phy_device *phydev) >>> static int rtl8211f_config_init(struct phy_device *phydev) >>> { >>> int ret; >>> - u16 val = 0; >>> + u16 val; >>> >>> ret = genphy_config_init(phydev); >>> if (ret < 0) >>> return ret; >>> >>> - /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ >>> - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || >>> - phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) >>> + /* enable TX-delay for rgmii-id/rgmii-txid, and disable it for rgmii */ >>> + switch (phydev->interface) { >>> + case PHY_INTERFACE_MODE_RGMII: >>> + val = 0; >>> + break; >>> + case PHY_INTERFACE_MODE_RGMII_ID: >>> + case PHY_INTERFACE_MODE_RGMII_TXID: >>> val = RTL8211F_TX_DELAY; >>> + break; >>> + default: /* the rest of the modes imply leaving delay as is. */ >>> + return 0; >>> + } >> >> So there is no control of the RX delay? >> > > As you can see it hasn't been there even before this change. So I suppose > either the hardware just doesn't support it (although the openly available > datasheet states that there is an RXD pin) or the original driver developer > decided to set TX-delay only. > > Just to make sure you understand. I am not working for realtek and don't > posses any inside info regarding these PHYs. I was working on a project, > which happened to utilize a rtl8211e PHY. We needed to find a way to > programmatically change the delays setting. So I searched the Internet > and found the U-boot rtl8211f driver and freebsd-folks discussion. This > info has been used to write the config_init method for Linux version of the > PHY' driver. That's it. > >> That means PHY_INTERFACE_MODE_RGMII_ID and >> PHY_INTERFACE_MODE_RGMII_RXID are not supported, and you should return >> -EINVAL. >> > > Apparently the current config_init method doesn't support RXID setting. > The patch introduced current function code was submitted by > Martin Blumenstingl in 2016: > https://patchwork.kernel.org/patch/9447581/ > and was reviewed by Florian. So we'd better ask him why it was ok to mark > the RGMII_ID as supported while only TX-delay could be set. > I also failed to find anything regarding programmatic rtl8211f delays setting > in the Internet. So at this point we can set TX-delay only for f-model of the PHY. > > Anyway lets clarify the situation before to proceed further. You are suggesting > to return an error in case if either RGMII_ID or RGMII_RXID interface mode is > requested to be enabled for the PHY. It's fair seeing the driver can't fully > support either of them. That is how I read Andrew's suggestion and it is reasonable. WRT to the original changes from Martin, he is probably the one you would want to add to this conversation in case there are any RX delay control knobs available, I certainly don't have the datasheet, and Martin's change looks and looked reasonable, seemingly independent of the direction of this very conversation we are having. But what about the rest of the modes like GMII, MII > and others? The delays should be largely irrelevant for GMII and MII, since a) the PCB is required to have matching length traces, and b) these are not double data rate interfaces > Shouldn't we also return an error instead of leaving a default > delay value? That seems a bit harsh, those could have been configured by firmware, whatever before Linux comes up and be correct and valid. We don't know of a way to configure it, but that does not mean it does not exist and some software is doing it already. > > The same question can be actually asked regarding the config_init method of > rtl8211e PHY, which BTW you already tagged as Reviewed-by. > >> This is where we get into interesting backwards compatibility >> issues. Are there any broken DT blobs with rgmii-id or rgmii-rxid, >> which will break with such a change? >> > > Not that I am aware of and which simple grep rtl8211 could find. Do you > know about one? > > -Sergey > >> Andrew -- Florian