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 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 56C2EC001E0 for ; Wed, 2 Aug 2023 14:41:51 +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:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc: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=KviH/sSkeE7UO/cVdZdkCSggxhjqLTxmsrR7AwFxQR8=; b=gzf0U12LsiiE3e xSSA8WD6DDh9dAtalbASxNY5dnvFMQ/lC9PSLO09FHn/bujtKX76pR5QkbCb18QI+a0ArWvGJU20v xpM10tFBUQ0dUSi8qhv1PtujFX3Cku67W8fZHuuvYw9/5PVTY2l1TM43aOksXDGTp3ePNQri14ttf XfMch2jnwAxN0M4r1CIEOymcl02I9nNT19PuSjmZlcjibJhRQC/rmHCPTfKEl/GoyZCzZnlt3TeOp hLpGpvSQqAWtdw64JU0s2rjlfGScVXa/r49hodLhpzI/7WrnNz4y/6nXgjIr29EADTj0CctAwUI+G wLtF/2ZEt/w+JdbPrmig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRD2V-0056ef-2E; Wed, 02 Aug 2023 14:41:27 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRD2R-0056dP-2V for linux-amlogic@lists.infradead.org; Wed, 02 Aug 2023 14:41:26 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qRD1e-0002R7-VB; Wed, 02 Aug 2023 16:40:35 +0200 Message-ID: <49d52a10-20cf-9c5b-ebe3-07292664fe11@pengutronix.de> Date: Wed, 2 Aug 2023 16:40:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Content-Language: en-US, de-DE To: Shenwei Wang , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Shawn Guo , Sascha Hauer , Neil Armstrong , Kevin Hilman , Vinod Koul , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Pengutronix Kernel Team , Fabio Estevam , dl-linux-imx , Jerome Brunet , Martin Blumenstingl , Bhupesh Sharma , Nobuhiro Iwamatsu , Simon Horman , Andrew Halaney , Bartosz Golaszewski , Wong Vee Khee , Revanth Kumar Uppala , Jochen Henneberg , "netdev@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-amlogic@lists.infradead.org" , "imx@lists.linux.dev" , Frank Li References: <20230731161929.2341584-1-shenwei.wang@nxp.com> <20230731161929.2341584-3-shenwei.wang@nxp.com> From: Johannes Zink In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: j.zink@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_074124_126284_F9AB1010 X-CRM114-Status: GOOD ( 32.09 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Hi Shenwei, On 8/2/23 16:27, Shenwei Wang wrote: > > >> -----Original Message----- >> From: Johannes Zink >> Sent: Wednesday, August 2, 2023 1:26 AM >> To: Shenwei Wang ; Russell King >> ; David S. Miller ; Eric >> Dumazet ; Jakub Kicinski ; Paolo >> Abeni ; Maxime Coquelin >> ; Shawn Guo ; Sascha >> Hauer ; Neil Armstrong ; >> Kevin Hilman ; Vinod Koul ; Chen- >> Yu Tsai ; Jernej Skrabec ; Samuel >> Holland >> Cc: Giuseppe Cavallaro ; Alexandre Torgue >> ; Jose Abreu ; >> Pengutronix Kernel Team ; Fabio Estevam >> ; dl-linux-imx ; Jerome Brunet >> ; Martin Blumenstingl >> ; Bhupesh Sharma >> ; Nobuhiro Iwamatsu >> ; Simon Horman >> ; Andrew Halaney ; >> Bartosz Golaszewski ; Wong Vee Khee >> ; Revanth Kumar Uppala ; Jochen >> Henneberg ; netdev@vger.kernel.org; linux- >> stm32@st-md-mailman.stormreply.com; linux-arm-kernel@lists.infradead.org; >> linux-kernel@vger.kernel.org; linux-amlogic@lists.infradead.org; >> imx@lists.linux.dev; Frank Li >> Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the >> TXC clock in fixed-link >> >> Caution: This is an external email. Please take care when clicking links or >> opening attachments. When in doubt, report the message using the 'Report this >> email' button >> >> >> Hi Shenwei, >> >> On 8/1/23 19:10, Shenwei Wang wrote: >>> >>> >>>> -----Original Message----- >>>> From: Johannes Zink >>>> Sent: Tuesday, August 1, 2023 7:48 AM >>>> To: Shenwei Wang ; Russell King >>>> ; David S. Miller ; Eric >>>> Dumazet ; Jakub Kicinski ; >>>> Paolo Abeni ; Maxime Coquelin >>>> ; Shawn Guo ; >> Sascha >>>> Hauer ; Neil Armstrong >>>> ; Kevin Hilman ; >>>> Vinod Koul ; Chen- Yu Tsai ; Jernej >>>> Skrabec ; Samuel Holland >>>> >>>> Cc: Giuseppe Cavallaro ; Alexandre Torgue >>>> ; Jose Abreu ; >>>> Pengutronix Kernel Team ; Fabio Estevam >>>> ; dl-linux-imx ; Jerome Brunet >>>> ; Martin Blumenstingl >>>> ; Bhupesh Sharma >>>> ; Nobuhiro Iwamatsu >>>> ; Simon Horman >>>> ; Andrew Halaney ; >>>> Bartosz Golaszewski ; Wong Vee Khee >>>> ; Revanth Kumar Uppala ; >>>> Jochen Henneberg ; >>>> netdev@vger.kernel.org; linux- stm32@st-md-mailman.stormreply.com; >>>> linux-arm-kernel@lists.infradead.org; >>>> linux-kernel@vger.kernel.org; linux-amlogic@lists.infradead.org; >>>> imx@lists.linux.dev; Frank Li >>>> Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause >>>> the TXC clock in fixed-link >>>> >>>> Caution: This is an external email. Please take care when clicking >>>> links or opening attachments. When in doubt, report the message using >>>> the 'Report this email' button >>>> >>>> >>>> Hi Shenwei, >>>> >>>> thanks for your patch. >>>> >>>> On 7/31/23 18:19, Shenwei Wang wrote: >>>>> When using a fixed-link setup, certain devices like the SJA1105 >>>>> require a small pause in the TXC clock line to enable their internal >>>>> tunable delay line (TDL). >>>> >>>> If this is only required for some devices, is it safe to enforce this >>>> behaviour unconditionally for any kind of fixed link devices >>>> connected to the MX93 EQOS or could this possibly break for other devices? >>>> >>> >>> It won't impact normal devices. The link layer hasn't built up yet. >>> >> >> As Russel suggested in [1] - maybe you could rephrase your commit message for >> your v4 to point this out to future reviewers (apparently multiple people have >> had questions about this...) and have this fact also recorded in the git log later >> on. >> > > Okay. > >> Also: does this only apply to i.MX93, or would we have to test and enable it on >> e.g. i.MX8MP as well? >> > > Yes, it is required when the EQOS MAC is selected. However, this patch just enables > The feature on i.MX93. If this behaviour is required on all EQOS, I think the name imx_dwmac_fix_speed_mx93() is misleading. It should either be imx_dwmac_fix_speed() if applicable to all imx implementations, or dwmac_fix_speed() (and moved to a non-gluecode file) if applicable for all implementations in general. You can then add a second patch for enabling it for the i.mx93 in the gluecode driver. Johannes > > Thanks, > Shenwei > >> Thanks >> Johannes >> >> [1] ZMk/xqRP67zXHNrf@shell.armlinux.org.uk >> >> >>> Thanks, >>> Shenwei >>> >>>> Best regards >>>> Johannes >>>> >>>>> >>>>> To satisfy this requirement, this patch temporarily disables the TX >>>>> clock, and restarts it after a required period. This provides the >>>>> required silent interval on the clock line for SJA1105 to complete >>>>> the frequency transition and enable the internal TDLs. >>>>> >>>>> So far we have only enabled this feature on the i.MX93 platform. >>>>> >>>>> Signed-off-by: Shenwei Wang >>>>> Reviewed-by: Frank Li >>>>> --- >>>>> .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 >> +++++++++++++++++++ >>>>> 1 file changed, 42 insertions(+) >>>>> >>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c >>>>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c >>>>> index 53ee5a42c071..2e4173d099f3 100644 >>>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c >>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c >>>>> @@ -32,6 +32,7 @@ >>>>> #define GPR_ENET_QOS_RGMII_EN (0x1 << 21) >>>>> >>>>> #define MX93_GPR_ENET_QOS_INTF_MODE_MASK GENMASK(3, 0) >>>>> +#define MX93_GPR_ENET_QOS_INTF_MASK GENMASK(3, 1) >>>>> #define MX93_GPR_ENET_QOS_INTF_SEL_MII (0x0 << 1) >>>>> #define MX93_GPR_ENET_QOS_INTF_SEL_RMII (0x4 << 1) >>>>> #define MX93_GPR_ENET_QOS_INTF_SEL_RGMII (0x1 << 1) >>>>> @@ -40,6 +41,7 @@ >>>>> #define DMA_BUS_MODE 0x00001000 >>>>> #define DMA_BUS_MODE_SFT_RESET (0x1 << 0) >>>>> #define RMII_RESET_SPEED (0x3 << 14) >>>>> +#define CTRL_SPEED_MASK GENMASK(15, 14) >>>>> >>>>> struct imx_dwmac_ops { >>>>> u32 addr_width; >>>>> @@ -56,6 +58,7 @@ struct imx_priv_data { >>>>> struct regmap *intf_regmap; >>>>> u32 intf_reg_off; >>>>> bool rmii_refclk_ext; >>>>> + void __iomem *base_addr; >>>>> >>>>> const struct imx_dwmac_ops *ops; >>>>> struct plat_stmmacenet_data *plat_dat; @@ -212,6 +215,42 @@ >>>>> static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode) >>>>> dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); >>>>> } >>>>> >>>>> +static void imx_dwmac_fix_speed_mx93(void *priv, uint speed, uint >>>>> +mode) { >>>>> + struct imx_priv_data *dwmac = priv; >>>>> + int ctrl, old_ctrl, iface; >>>>> + >>>>> + imx_dwmac_fix_speed(priv, speed, mode); >>>>> + >>>>> + if (!dwmac || mode != MLO_AN_FIXED) >>>>> + return; >>>>> + >>>>> + if (regmap_read(dwmac->intf_regmap, dwmac->intf_reg_off, &iface)) >>>>> + return; >>>>> + >>>>> + iface &= MX93_GPR_ENET_QOS_INTF_MASK; >>>>> + if (iface != MX93_GPR_ENET_QOS_INTF_SEL_RGMII) >>>>> + return; >>>>> + >>>>> + old_ctrl = readl(dwmac->base_addr + MAC_CTRL_REG); >>>>> + ctrl = old_ctrl & ~CTRL_SPEED_MASK; >>>>> + regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off, >>>>> + MX93_GPR_ENET_QOS_INTF_MODE_MASK, 0); >>>>> + writel(ctrl, dwmac->base_addr + MAC_CTRL_REG); >>>>> + >>>>> + /* Ensure the settings for CTRL are applied and avoid CPU/Compiler >>>>> + * reordering. >>>>> + */ >>>>> + wmb(); >>>>> + >>>>> + usleep_range(10, 20); >>>>> + iface |= MX93_GPR_ENET_QOS_CLK_GEN_EN; >>>>> + regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off, >>>>> + MX93_GPR_ENET_QOS_INTF_MODE_MASK, iface); >>>>> + >>>>> + writel(old_ctrl, dwmac->base_addr + MAC_CTRL_REG); } >>>>> + >>>>> static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr) >>>>> { >>>>> struct plat_stmmacenet_data *plat_dat = priv; @@ -317,8 >>>>> +356,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) >>>>> plat_dat->exit = imx_dwmac_exit; >>>>> plat_dat->clks_config = imx_dwmac_clks_config; >>>>> plat_dat->fix_mac_speed = imx_dwmac_fix_speed; >>>>> + if (of_machine_is_compatible("fsl,imx93")) >>>>> + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; >>>>> plat_dat->bsp_priv = dwmac; >>>>> dwmac->plat_dat = plat_dat; >>>>> + dwmac->base_addr = stmmac_res.addr; >>>>> >>>>> ret = imx_dwmac_clks_config(dwmac, true); >>>>> if (ret) >>>> >>>> -- >>>> Pengutronix e.K. | Johannes Zink | >>>> Steuerwalder Str. 21 | >>>> https://www/ >>>> .pe%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d60a461 >> ee01408 >>>> >> db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63826554 >> 36335 >>>> >> 61986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM >> zIiLCJ >>>> >> BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CV10o1M%2BOj >> DPOaH5C >>>> y%2Fka%2B0aOMs0IaVapMH7aa3RnTI%3D&reserved=0 >>>> >> ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c >>>> >> 1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C >>>> >> 0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA >>>> >> wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C% >>>> >> 7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r >>>> eserved=0 | >>>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >>>> Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 | >>> >>> >> >> -- >> Pengutronix e.K. | Johannes Zink | >> Steuerwalder Str. 21 | >> https://www.pe/ >> ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d >> 60a461ee01408db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 >> C0%7C638265543633561986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj >> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C >> %7C&sdata=yKzNPsHqD%2FxU%2FRmzLn4JSQjmuT9tU8SabLxHyGTTmms%3D&r >> eserved=0 | >> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >> Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 | > > -- Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 | _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic