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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10D1FC0015E for ; Fri, 28 Jul 2023 09:22:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B19078666C; Fri, 28 Jul 2023 11:22:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="gBWnjiqa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B09B186848; Fri, 28 Jul 2023 11:22:00 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 177D386612 for ; Fri, 28 Jul 2023 11:21:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=6573c1cf83=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36S96Wut026232; Fri, 28 Jul 2023 11:21:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=US+gTW2q0WFi6JiOnFg9M6IBYSBMBKfg56rvmFRTJAE=; b=gBWnjiqaUzMJBg+zSJI8mUEuHe7w5SeM2lkEHIdFz1gwIyHu3wABt/merFW3G/vACcXa ckDICM4joXcQbdxYQIfZfN9pmCtQsKEwnmy9226BU30JkmBIA9z1N9/yRfl08QqqtWBJ 10M3Q9CBydXobV5IRmEPfMzUqKlZAUleUEOpWAoucXCRLnz7Vrc2P92/36lLD8g36B1R SnIPQ5B44rpLDCg7VSShefs/UknTvyEzPEzOSrR7xFKRv6493o+8ROrNTIwO4I6/T+0m OGi5giz1mSbZ2fTd7y6RcsMrVxiQoaV3VWZJRqWS8YiCiUwQSg7cUY3VfNDngxtL0YqV vg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3s4armg36b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Jul 2023 11:21:49 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 615FC10002A; Fri, 28 Jul 2023 11:21:48 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4267B25AEEC; Fri, 28 Jul 2023 11:21:48 +0200 (CEST) Received: from [10.48.1.0] (10.48.1.0) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 28 Jul 2023 11:21:47 +0200 Message-ID: <902e5162-e58d-ab35-cf14-021e020ac4d0@foss.st.com> Date: Fri, 28 Jul 2023 11:21:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM Content-Language: en-US To: Marek Vasut , CC: Patrice Chotard , , , gabriel FERNANDEZ References: <20230726224537.360161-1-marex@denx.de> From: Patrick DELAUNAY In-Reply-To: <20230726224537.360161-1-marex@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.1.0] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi, On 7/27/23 00:45, Marek Vasut wrote: > The DHCOM SoM has two options for supplying ETHRX clock to the DWMAC > block and PHY. Either (1) ETHCK_K generates 50 MHz clock on ETH_CLK > pad for the PHY and the same 50 MHz clock are fed back to ETHRX via > internal eth_clk_fb clock connection OR (2) ETH_CLK is not used at > all, MCO2 generates 50 MHz clock on MCO2 output pad for the PHY and > the same MCO2 clock are fed back into ETHRX via ETH_RX_CLK input pad > using external pad-to-pad connection. > > Option (1) has two downsides. ETHCK_K is supplied directly from either > PLL3_Q or PLL4_P, hence the PLL output is limited to exactly 50 MHz and > since the same PLL output is also used to supply SDMMC blocks, the > performance of SD and eMMC access is affected. The second downside is > that using this option, the EMI of the SoM is higher. > > Option (2) solves both of those problems, so implement it here. In this > case, the PLL4_P is no longer limited and can be operated faster, at > 100 MHz, which improves SDMMC performance (read performance is improved > from ~41 MiB/s to ~57 MiB/s with dd if=/dev/mmcblk1 of=/dev/null bs=64M > count=1). The EMI interference also decreases. > > Ported from Linux kernel commit > 73ab99aad50cd ("ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM") > > Signed-off-by: Marek Vasut > --- > Cc: Patrice Chotard > Cc: Patrick Delaunay > Cc: u-boot@dh-electronics.com > Cc: uboot-stm32@st-md-mailman.stormreply.com > --- > arch/arm/dts/stm32mp15xx-dhcom-som.dtsi | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/dts/stm32mp15xx-dhcom-som.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-som.dtsi > index 83e2c87713f..238a611192e 100644 > --- a/arch/arm/dts/stm32mp15xx-dhcom-som.dtsi > +++ b/arch/arm/dts/stm32mp15xx-dhcom-som.dtsi > @@ -118,13 +118,12 @@ > > ðernet0 { > status = "okay"; > - pinctrl-0 = <ðernet0_rmii_pins_a>; > - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; > + pinctrl-0 = <ðernet0_rmii_pins_c &mco2_pins_a>; > + pinctrl-1 = <ðernet0_rmii_sleep_pins_c &mco2_sleep_pins_a>; > pinctrl-names = "default", "sleep"; > phy-mode = "rmii"; > max-speed = <100>; > phy-handle = <&phy0>; > - st,eth-ref-clk-sel; > > mdio0 { > #address-cells = <1>; > @@ -136,7 +135,7 @@ > /* LAN8710Ai */ > compatible = "ethernet-phy-id0007.c0f0", > "ethernet-phy-ieee802.3-c22"; > - clocks = <&rcc ETHCK_K>; > + clocks = <&rcc CK_MCO2>; > reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; > reset-assert-us = <500>; > reset-deassert-us = <500>; > @@ -446,6 +445,21 @@ > }; > }; > > +&rcc { > + /* Connect MCO2 output to ETH_RX_CLK input via pad-pad connection */ > + clocks = <&rcc CK_MCO2>; > + clock-names = "ETH_RX_CLK/ETH_REF_CLK"; > + > + /* > + * Set PLL4P output to 100 MHz to supply SDMMC with faster clock, > + * set MCO2 output to 50 MHz to supply ETHRX clock with PLL4P/2, > + * so that MCO2 behaves as a divider for the ETHRX clock here. > + */ > + assigned-clocks = <&rcc CK_MCO2>, <&rcc PLL4_P>; > + assigned-clock-parents = <&rcc PLL4_P>; > + assigned-clock-rates = <50000000>, <100000000>; > +}; > + > &rng1 { > status = "okay"; > }; Reviewed-by: Patrick Delaunay ok for device tree alignment but this MCO2 assignment if not functional in U-Boot clock driver - set_parent() => is not defined - set_rate() => is only supported for a limited number of clock, PLL4_Q for example but OK as the MCO2 is already configured in the clock tree directly in U-Boot SPL: ./arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi &rcc {     st,clksrc = < ...         CLK_MCO2_PLL4P     >;     st,clkdiv = < ...         1 /*MCO2*/     >; Thanks Patrick