Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2340878imj; Mon, 18 Feb 2019 04:26:15 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaqc4X7tmDMalbDgktxIQgBIfcljyZ+D1yZ1BvN1UbpkNOTzZvbnpLEmKtQT0fAlpFsOGtO X-Received: by 2002:a63:1723:: with SMTP id x35mr18262397pgl.364.1550492775786; Mon, 18 Feb 2019 04:26:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550492775; cv=none; d=google.com; s=arc-20160816; b=TQDEt3JI5nJBcYIj3q8p2PzmmqZ2Ir5pFuFOtGOjbXTXzuBcQ4rUa72VCbXiPbNLHi uak4M/Qb++VZ3mae1MXc8V/sfOrlWZmBS6owQ2U1PJOJt7UgKkNawjdhT/HA7e+x55nu RakBqCzE2lLjbX8GRX7D3tnznGdYc6YVPx5EuZrjLmuVOLAfju/wemr2Y0fFgdkHvV3t 7Jqd8RfXgcqrsrxttb2m2SB5h8eotn3yN6UcKC6DXZwM++5oYcEBwIhOpjj/rQl+AM6I fO/pqWyk4bE/08Ss2Ma8lcqfI2kPPLE1dTxiGijxuwJZmPQBuK6rI/3pqHIDg53PZ5or vlEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5P7YgJCbEUjTEt6oIZYQqmnB4f8AHSDzilbNSbQGbDM=; b=D9XUcn0dDMouigU66jiqXvIlfxy6nfVLnW9zpAzUjuDgzOzIBTMzFhEkBAD6tt0z8r WPxCmrJGKqBHC2b+8QhUQ33ehNEa4BfIY3FY8dT3LDHbGrso2r6llqAkQvXFYO7nPL3x uLwe/lPIHVi/fMoHSjom5/taIZHMq1iID8UFdI8YwXIzGq2gT1qLNGHDK9c0t1snmjvS EXWSc+w2ThhID0I9os4IYiIu9wRpKPcAzzVqNAAxBBCXumyT2FvCrQJn8erHo3JFna/l cZ9d+MlVR08WkXVROdK6JhWo5tQA0mcFELMsDqXEzigCdrC0TaiL36QEzIjhBG9ujNYQ mVMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b="UaJfd1I/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ysoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si6746573pfa.101.2019.02.18.04.25.28; Mon, 18 Feb 2019 04:26:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b="UaJfd1I/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ysoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729643AbfBRLyn (ORCPT + 99 others); Mon, 18 Feb 2019 06:54:43 -0500 Received: from uho.ysoft.cz ([81.19.3.130]:55240 "EHLO uho.ysoft.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728293AbfBRLyn (ORCPT ); Mon, 18 Feb 2019 06:54:43 -0500 Received: from [10.1.8.111] (unknown [10.1.8.111]) by uho.ysoft.cz (Postfix) with ESMTP id F3DF9A4087; Mon, 18 Feb 2019 12:54:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1550490880; bh=5P7YgJCbEUjTEt6oIZYQqmnB4f8AHSDzilbNSbQGbDM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=UaJfd1I/SkJWzVI5MXfPxKdNmcNzTU3M29A6zYooiERkax8tCQWbntw73jpDcmEsi CJE43YrVr8HhW4SVQW4dWrh7b0cEIoiip6HCoO3GVuoTVACqQsrw0vXYRhmZ2C4ne4 z9av5XFuf1kQAVFIcpj6WUdOK8Y7Z4v76okZzkWc= Subject: Re: [RFC] net: dsa: qca8k: implement rgmii-id mode To: Vinod Koul , Andrew Lunn Cc: "David S. Miller" , netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" , Florian Fainelli References: <0c7428dc-736e-c5c4-13e7-b42052c60cd7@ysoft.com> <20190215152356.GP708@lunn.ch> <20190218104539.GL21884@vkoul-mobl> From: =?UTF-8?B?TWljaGFsIFZva8OhxI0=?= Message-ID: <40d0e8b0-b16d-85ef-e647-944bc7dbd571@ysoft.com> Date: Mon, 18 Feb 2019 12:54:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190218104539.GL21884@vkoul-mobl> Content-Type: text/plain; charset=utf-8; format=flowed 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 18. 02. 19 11:45, Vinod Koul wrote: > On 15-02-19, 16:23, Andrew Lunn wrote: >> On Fri, Feb 15, 2019 at 04:01:08PM +0100, Michal Vokáč wrote: >>> Hi, >>> >>> networking on my boards [1], which are currently in linux-next, suddently >>> stopped working. I tracked it down to this commit 5ecdd77c61c8 ("net: dsa: >>> qca8k: disable delay for RGMII mode") [2]. >>> >>> So I think the rgmii-id mode is obviously needed in my case. >>> I was able to find a couple drivers that read tx/rx-delay or >>> tx/rx-internal-delay from device tree. Namely: >>> >>> drivers/net/ethernet/apm/xgene/xgene_enet_main.c >>> drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c >>> drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c >>> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c >>> drivers/net/phy/dp83867.c >>> >>> I would appreciate any hints how to add similar function to qca8k driver >>> if that is the correct way to go. Can I take some of the above mentioned >>> drivers as a good example for that? How should the binding look like? >>> >>> I would expect something like this: >>> >>> switch@0 { >>> compatible = "qca,qca8334"; >>> reg = <0>; >>> >>> switch_ports: ports { >>> #address-cells = <1>; >>> #size-cells = <0>; >>> >>> ethphy0: port@0 { >>> reg = <0>; >>> label = "cpu"; >>> phy-mode = "rgmii-id"; >>> qca,tx-delay = <3>; >>> qca,rx-delay = <3>; >>> ethernet = <&fec>; >>> }; >> >> Hi Michal >> >> Your submission used: >> >> + ethphy0: port@0 { >> + reg = <0>; >> + label = "cpu"; >> + phy-mode = "rgmii"; >> + ethernet = <&fec>; >> + >> + fixed-link { >> + speed = <1000>; >> + full-duplex; >> + }; >> + }; >> >> This is good. If you have a fixed-link you can pass a phy-mode. Yes, I am using fixed-link and the plan was to implement the rgmii-id mode. >> >> The comment that was removed was: >> >> - /* According to the datasheet, RGMII delay is enabled through >> - * PORT5_PAD_CTRL for all ports, rather than individual port >> - * registers >> - */ >> >> Is it possible to enable delays per port? Ideally, you want to enable >> delays for just selected ports. Add another case for >> PHY_INTERFACE_MODE_RGMII_ID to enable the delays. I am still trying to collect all the relevant notes and bits from the horrible docs to understand how this is done. The problem is different parts and different versions of the documentation provide diffrerent details. For example the QCA8334 model does not have PORT5 and so that registers are not documented. Though some application note document says: """ The MAC0 timing control is in the Port0 PAD Mode Control Register (offset 0x0004): 1. RGMII timing delay for the output path of QCA8337(N) is enabled by 0x8[24]. Set 1 to add 2ns delay in 1000 mode for all RGMII interfaces. 2. Bit [21:20]: select the delay time for the output path in 10/100 mode. 3. Bit 25: enable the timing delay for the input path of QCA8337(N) in 1000 mode. 4. Bit [23:22]: select the delay time for the input path in 1000 mode. 00: 0.2ns 01: 1.2ns 10: 2.1ns 11: 3.1ns """ That is in line with the removed comment. The bit 24 at address 0x8 is used to enable/disable delays globally. And obviously it is needed on the QCA8334 model as well even though it should not have the PORT5. > In the hindsight I should not have removed the comment, let me ressurect > that as well as add handling of the RGMII modes... OK, thanks. > Please do test Sure, will do. Just let me know when you have something ready. Thank you! Michal