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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8722C433EF for ; Tue, 12 Apr 2022 09:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eGUqzUG2EJKMn6xVczuxLWCQWhqLE6e+RasA4rXnlJI=; b=nwZXhpBIaacBcoU7uCyZSAlZU+ wK2L2WHiVfTLiQBt2bEYy2q+ViQX199Fq6fGdwJ3R9P4w4i0Ya1vKYlSqrC94heLI/bDsuDNINp83 Qsi7d5GWlUq0C7PiwsV3h5MKBpwNuIk4jTkf1mIKnTufoq/KGiNZcYJd3+20BeJypj0cvsp/C94jF JAWZe3PGkkwREDGg3u4IoOkP7Isyz9sMyZOEhpD1F9AL80XAVZfSvKuoZzp5QelGKbrrmaCyL/n71 yYAsfe/ch0R2b76R9284p0mIrnX/+3eMuG/fnrWZFUaFeuyxKeL8i0fXVheDH81tDAtHIBWbL+iRK qF3kZBIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neDGm-00D6A8-55; Tue, 12 Apr 2022 09:57:08 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neDG6-00D5qI-Qv for linux-arm-kernel@lists.infradead.org; Tue, 12 Apr 2022 09:56:28 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 23C9uMkm096818; Tue, 12 Apr 2022 04:56:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1649757382; bh=ugRzal5VjfUjawoYrtpjB5VqZuPi1bn0ckWPOzleY+I=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=C1f8WWG9B+NuH/0xhstTTtlhzitG0rhgxCIrYltEffUaic4JJMPgjkaJIsf2/+4Ug 431a7/S5g/wkQ84AW+CxPOAUMHEQd31cfQqvw6akWggMX3fd4nmUxEb5hUCaxEIzb5 MZqqMr0moR311MI/KhWkJY2IdK+96z5saHQwOPss= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 23C9uMvC027020 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 12 Apr 2022 04:56:22 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Tue, 12 Apr 2022 04:56:21 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Tue, 12 Apr 2022 04:56:21 -0500 Received: from [10.249.96.184] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 23C9uGJA115407; Tue, 12 Apr 2022 04:56:17 -0500 Message-ID: Date: Tue, 12 Apr 2022 12:56:18 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Content-Language: en-US To: Puranjay Mohan , Andrew Lunn References: <20220406094358.7895-1-p-mohan@ti.com> <20220406094358.7895-14-p-mohan@ti.com> <468d4d9b-44b4-2894-2a75-4caab1e72147@ti.com> From: Grygorii Strashko In-Reply-To: <468d4d9b-44b4-2894-2a75-4caab1e72147@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_025627_047866_9629809D X-CRM114-Status: GOOD ( 17.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nm@ti.com, devicetree@vger.kernel.org, vigneshr@ti.com, mathieu.poirier@linaro.org, kishon@ti.com, netdev@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, Roger Quadros , krzysztof.kozlowski+dt@linaro.org, ssantosh@kernel.org, kuba@kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/04/2022 12:45, Puranjay Mohan wrote: > + Roger, Grygorii > > On 07/04/22 00:07, Andrew Lunn wrote: >>> +static int emac_phy_connect(struct prueth_emac *emac) >>> +{ >>> + struct prueth *prueth = emac->prueth; >>> + >>> + /* connect PHY */ >>> + emac->phydev = of_phy_connect(emac->ndev, emac->phy_node, >>> + &emac_adjust_link, 0, emac->phy_if); >> >>> +static int prueth_config_rgmiidelay(struct prueth *prueth, >>> + struct device_node *eth_np, >>> + phy_interface_t phy_if) >>> +{ >>> + struct device *dev = prueth->dev; >>> + struct regmap *ctrl_mmr; >>> + u32 rgmii_tx_id = 0; >>> + u32 icssgctrl_reg; >>> + >>> + if (!phy_interface_mode_is_rgmii(phy_if)) >>> + return 0; >>> + >>> + ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay"); >>> + if (IS_ERR(ctrl_mmr)) { >>> + dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n"); >>> + return -ENODEV; >>> + } >>> + >>> + if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1, >>> + &icssgctrl_reg)) { >>> + dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n"); >>> + return -ENODEV; >>> + } >>> + >>> + if (phy_if == PHY_INTERFACE_MODE_RGMII_ID || >>> + phy_if == PHY_INTERFACE_MODE_RGMII_TXID) >>> + rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE; >>> + >>> + regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id); >>> + >>> + return 0; >>> +} >>> >> >> O.K, so this does not do what i initially thought it was doing. I was >> thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be >> a small pico second value to allow the 2ns delay to be tuned to the >> board. >> >> But now i think this is actually inserting the full 2ns delay? >> >> The problem is, you also pass phy_if to of_phy_connect() so the PHY >> will also insert the delay if requested. So you end up with double >> delays for rgmii_id and rgmii_txid. It's misunderstanding here. The bit field name in TRM is RGMII0_ID_MODE and meaning: 0h - Internal transmit delay is enabled 1h - Internal transmit delay is not enabled. So here internal delay will be disabled for RGMII_ID/RGMII_TXID. >> >> The general recommendation is that the PHY inserts the delay, based on >> phy-mode. The MAC does not add a delay, so i suggest you always write >> 0 here, just to ensure the system is in a deterministic state, and the >> bootloader and not being messing around with things. >> >> Andrew -- Best regards, Grygorii, Ukraine _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel