Skip to content

Commit e33b88b

Browse files
Marek Vasutbebarino
authored andcommitted
clk: stm32mp1: Split ETHCK_K into separate MUX and GATE clock
The ETHCK_K are modeled as composite clock of MUX and GATE, however per STM32MP1 Reference Manual RM0436 Rev 3, Page 574, Figure 83. Peripheral clock distribution for Ethernet, ETHPTPDIV divider is attached past the ETHCK_K mux, and ETH_CLK/eth_clk_fb clock are output past ETHCKEN gate. Therefore, in case ETH_CLK/eth_clk_fb are not in use AND PTP clock are in use, ETHCKEN gate can be turned off. Current driver does not permit that, fix it. This patch converts ETHCK_K from composite clock into a ETHCKEN gate, ETHPTP_K from composite clock into ETHPTPDIV divider, and adds another NO_ID clock "ck_ker_eth" which models the ETHSRC mux and is parent clock to both ETHCK_K and ETHPTP_K. Therefore, all references to ETHCK_K and ETHPTP_K remain functional as before. [1] STM32MP1 Reference Manual RM0436 Rev 3, Page 574, Figure 83. Peripheral clock distribution for Ethernet https://www.st.com/resource/en/reference_manual/dm00327659-stm32mp157-advanced-armbased-32bit-mpus-stmicroelectronics.pdf Signed-off-by: Marek Vasut <marex@denx.de> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Christophe Roullier <christophe.roullier@foss.st.com> Cc: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: linux-clk@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Link: https://lore.kernel.org/r/20220118202958.1840431-1-marex@denx.de Tested-by: Johann Neuhauser <jneuhauser@dh-electronics.com> Acked-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent e783362 commit e33b88b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/clk/clk-stm32mp1.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
20082008
KCLK(DSI_K, "dsi_k", dsi_src, 0, G_DSI, M_DSI),
20092009
KCLK(ADFSDM_K, "adfsdm_k", sai_src, 0, G_ADFSDM, M_SAI1),
20102010
KCLK(USBO_K, "usbo_k", usbo_src, 0, G_USBO, M_USBO),
2011-
KCLK(ETHCK_K, "ethck_k", eth_src, 0, G_ETHCK, M_ETHCK),
20122011

20132012
/* Particulary Kernel Clocks (no mux or no gate) */
20142013
MGATE_MP1(DFSDM_K, "dfsdm_k", "ck_mcu", 0, G_DFSDM),
@@ -2017,11 +2016,16 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
20172016
MGATE_MP1(GPU_K, "gpu_k", "pll2_q", 0, G_GPU),
20182017
MGATE_MP1(DAC12_K, "dac12_k", "ck_lsi", 0, G_DAC12),
20192018

2020-
COMPOSITE(ETHPTP_K, "ethptp_k", eth_src, CLK_OPS_PARENT_ENABLE |
2019+
COMPOSITE(NO_ID, "ck_ker_eth", eth_src, CLK_OPS_PARENT_ENABLE |
20212020
CLK_SET_RATE_NO_REPARENT,
20222021
_NO_GATE,
20232022
_MMUX(M_ETHCK),
2024-
_DIV(RCC_ETHCKSELR, 4, 4, 0, NULL)),
2023+
_NO_DIV),
2024+
2025+
MGATE_MP1(ETHCK_K, "ethck_k", "ck_ker_eth", 0, G_ETHCK),
2026+
2027+
DIV(ETHPTP_K, "ethptp_k", "ck_ker_eth", CLK_OPS_PARENT_ENABLE |
2028+
CLK_SET_RATE_NO_REPARENT, RCC_ETHCKSELR, 4, 4, 0),
20252029

20262030
/* RTC clock */
20272031
COMPOSITE(RTC, "ck_rtc", rtc_src, CLK_OPS_PARENT_ENABLE,

0 commit comments

Comments
 (0)