All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre TORGUE <alexandre.torgue@foss.st.com>
To: Marek Vasut <marex@denx.de>, <linux-arm-kernel@lists.infradead.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Patrick Delaunay <patrick.delaunay@st.com>,
	Patrice Chotard <patrice.chotard@st.com>
Subject: Re: [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock
Date: Thu, 14 Jan 2021 18:08:35 +0100	[thread overview]
Message-ID: <e7ccdf7c-c7fa-4d03-2400-d4d89815d5d0@foss.st.com> (raw)
In-Reply-To: <20210106204347.475920-3-marex@denx.de>

Hi Marek

On 1/6/21 9:43 PM, Marek Vasut wrote:
> The implementation of ETH_RX_CLK/ETH_REF_CLK handling currently does not
> permit selecting the clock input from SoC pad. To make things worse, the
> implementation of this is partly present and is split between the clock
> driver and dwmac4 driver. Moreover, the ETHRX clock parent is incorrect.

Sorry but I don't understand which configuration is missing. I think we 
can handle all possible cases for RMII. At the glue layer 
(dwmac-stm32.c) clocks gates and syscfg are set regarding device tree 
binding (see the tab in dwmac-stm32.c). You could have a look here for 
more details: 
https://wiki.st.com/stm32mpu/wiki/Ethernet_device_tree_configuration

Regarding the clock parent, yes it is not at the well frequency if you 
want to select this path. Our current "clock tree" is done to fit with 
our ST reference boards (we have more peripherals than PLL outputs so we 
have to make choices). So yes for customer/partners boards this clock 
tree has to be modified to better fit with the need (either using 
assigned-clock-parent or by modifying bootloader clock tree (tf-a or 
u-boot)).

> 
> First, the ETHRX clock in clk-stm32mp1.c only represents the ETHRXEN gate,
> however it should represent also ETH_REF_CLK_SEL mux. The problem is that
> the ETH_REF_CLK_SEL mux is currently configured in the DWMAC4 driver and
> the ETH_REF_CLK_SEL bit is part of SYSCFG block, not the DWMAC4 or the
> clock block.

dwmac4-stm32 doesn't contain code for dwmac4 but it contains the glue 
around the dwmac4: syscfg, clocks ...

> 
> Second, the ETHRX parent clock is either eth_clk_fb (ETHCK_K) or external
> ETH_RX_CLK/ETH_REF_CLK_SEL, it is never CK_AXI.

Why CK_AXI ?

Regards
Alex

> 
> This patch attempts to address the clock selection by adding fixed factor
> clock to DT, which allows the user to select its upstream clock.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Patrick Delaunay <patrick.delaunay@st.com>
> Cc: linux-stm32@st-md-mailman.stormreply.com
> To: linux-arm-kernel@lists.infradead.org
> ---
>   arch/arm/boot/dts/stm32mp151.dtsi | 8 ++++++++
>   drivers/clk/clk-stm32mp1.c        | 2 +-
>   2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
> index 32875eabd357..8c2a5d0875d8 100644
> --- a/arch/arm/boot/dts/stm32mp151.dtsi
> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> @@ -82,6 +82,14 @@ clk_csi: clk-csi {
>   			compatible = "fixed-clock";
>   			clock-frequency = <4000000>;
>   		};
> +
> +		clk_eth_rx: eth-rx-clk {
> +			compatible = "fixed-factor-clock";
> +			clocks = <&rcc ETHCK_K>;
> +			#clock-cells = <0>;
> +			clock-div = <1>;
> +			clock-mult = <1>;
> +		};
>   	};
>   
>   	thermal-zones {
> diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
> index a875649df8b8..63971d40f15c 100644
> --- a/drivers/clk/clk-stm32mp1.c
> +++ b/drivers/clk/clk-stm32mp1.c
> @@ -1892,7 +1892,7 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
>   	PCLK(MDMA, "mdma", "ck_axi", 0, G_MDMA),
>   	PCLK(GPU, "gpu", "ck_axi", 0, G_GPU),
>   	PCLK(ETHTX, "ethtx", "ck_axi", 0, G_ETHTX),
> -	PCLK(ETHRX, "ethrx", "ck_axi", 0, G_ETHRX),
> +	PCLK(ETHRX, "ethrx", "eth-rx-clk", 0, G_ETHRX),
>   	PCLK(ETHMAC, "ethmac", "ck_axi", 0, G_ETHMAC),
>   	PCLK(FMC, "fmc", "ck_axi", CLK_IGNORE_UNUSED, G_FMC),
>   	PCLK(QSPI, "qspi", "ck_axi", CLK_IGNORE_UNUSED, G_QSPI),
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-01-14 17:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 20:43 [PATCH 1/4] ARM: dts: stm32: Add alternate pinmux for ethernet0 pins Marek Vasut
2021-01-06 20:43 ` [PATCH 2/4] ARM: dts: stm32: Add alternate pinmux for mco2 pins Marek Vasut
2021-01-06 20:43 ` [PATCH 3/4] [RFC] ARM: dts: stm32: Add mux for ETHRX clock Marek Vasut
2021-01-14 17:08   ` Alexandre TORGUE [this message]
2021-01-15 12:15     ` Marek Vasut
2021-01-15 15:22       ` Alexandre TORGUE
2021-01-16 17:01         ` Marek Vasut
2021-01-26 10:17           ` Alexandre TORGUE
2021-01-26 10:40             ` Marek Vasut
2021-01-26 10:54               ` Alexandre TORGUE
2021-01-26 12:59                 ` Marek Vasut
2021-01-26 15:40                   ` Alexandre TORGUE
2021-01-26 15:42                     ` Marek Vasut
2021-01-26 16:47                       ` Alexandre TORGUE
2021-01-26 19:11                         ` Marek Vasut
2021-01-29 15:19                           ` Alexandre TORGUE
2021-01-30 18:36                             ` Marek Vasut
2021-02-01  7:57                               ` Alexandre TORGUE
2021-01-06 20:43 ` [PATCH 4/4] [RFC] ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7ccdf7c-c7fa-4d03-2400-d4d89815d5d0@foss.st.com \
    --to=alexandre.torgue@foss.st.com \
    --cc=alexandre.torgue@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=marex@denx.de \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=patrice.chotard@st.com \
    --cc=patrick.delaunay@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.