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 8BBC7C433F5 for ; Wed, 6 Apr 2022 18:39:02 +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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nXfU5UX1wjYtjEmnRQ3rT8RyW7g+a1tpKwwt1tLt0EU=; b=BCROVY0Ec1Jex8 SHWBCppUqioZ+apWLNVxg/Be/gVZIgEO4YnSCnlwSJdVFE9V4GRJ/KydRq2MQWd9GErBolwwEK/5g dhgCYg1K+AqoTy6pmvQ/AMf0TYfh4zTnAY8n01HT2yGOZB3/lD7Yf4aDeg4rPPmK4iLJtpZZkd9bJ Ylye4WCeux+sg652Pr533/WfqicZKN5fitEmFFKfk1pf3LpGAYQx9iTN7ppGRcsbfzAbPZOzhm2og +qA1+22FCBl/vEXJFC6LEhYNTckYCUlaV1aHGxy2gcbjaBho7FosFBKhxxKorra4Le+HOwUT62x9F OR8CAUJeNZrl0SXZtX8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncAXX-007afD-Bj; Wed, 06 Apr 2022 18:37:59 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncAXU-007acZ-3l for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2022 18:37:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=YGjX529UM3G1Sm5ZEV/Cp3ZmPunyP2OAVWthxaOm0TE=; b=tFJFatXB6xPNnIMbja6SvXD6Cu bXU3vUUO2xXCQztEU1jTleEdty4GRLL6fyovwu4ho7/XnxRC1YoSxvItgGIztyc6J2Yjr4HUEetQZ rNCnT4wt2/HAhtlf+zClghovZH7e4bhX8oK2ntrborSlj/r0U+pQu3ADTxv2fYmtBfz0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ncAXN-00EVLu-E7; Wed, 06 Apr 2022 20:37:49 +0200 Date: Wed, 6 Apr 2022 20:37:49 +0200 From: Andrew Lunn To: Puranjay Mohan Subject: Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Message-ID: References: <20220406094358.7895-1-p-mohan@ti.com> <20220406094358.7895-14-p-mohan@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220406094358.7895-14-p-mohan@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_113756_189066_0DCC90FB X-CRM114-Status: GOOD ( 15.72 ) 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, krzysztof.kozlowski+dt@linaro.org, ssantosh@kernel.org, kuba@kernel.org, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > +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. 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel