clk: stm32mp1: Split ETHCK_K into separate MUX and GATE clock
PATCH 1/5 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
--- drivers/clk/clk-stm32mp1.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/clk/clk-stm32mp1.c +7 -3
@@ -2008,7 +2008,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = {KCLK (DSI_K ,"dsi_k" , dsi_src,0 ,G_DSI ,M_DSI ),KCLK (ADFSDM_K ,"adfsdm_k" , sai_src,0 ,G_ADFSDM ,M_SAI1 ),KCLK (USBO_K ,"usbo_k" , usbo_src,0 ,G_USBO ,M_USBO ), -KCLK (ETHCK_K ,"ethck_k" , eth_src,0 ,G_ETHCK ,M_ETHCK ),/* Particulary Kernel Clocks (no mux or no gate) */ MGATE_MP1(DFSDM_K, "dfsdm_k", "ck_mcu", 0, G_DFSDM),
@@ -2017,11 +2016,16 @@ static const struct clock_config stm32mp1_clock_cfg[] = {MGATE_MP1 (GPU_K ,"gpu_k" ,"pll2_q" ,0 ,G_GPU ),MGATE_MP1 (DAC12_K ,"dac12_k" ,"ck_lsi" ,0 ,G_DAC12 ), -COMPOSITE (ETHPTP_K ,"ethptp_k" , eth_src,CLK_OPS_PARENT_ENABLE | +COMPOSITE (NO_ID ,"ck_ker_eth" , eth_src,CLK_OPS_PARENT_ENABLE |CLK_SET_RATE_NO_REPARENT , _NO_GATE,_MMUX (M_ETHCK ), -_DIV (RCC_ETHCKSELR ,4 ,4 ,0 ,NULL )), + _NO_DIV), + +MGATE_MP1 (ETHCK_K ,"ethck_k" ,"ck_ker_eth" ,0 ,G_ETHCK ), + +DIV (ETHPTP_K ,"ethptp_k" ,"ck_ker_eth" ,CLK_OPS_PARENT_ENABLE | +CLK_SET_RATE_NO_REPARENT ,RCC_ETHCKSELR ,4 ,4 ,0 ),/* RTC clock */ COMPOSITE(RTC, "ck_rtc", rtc_src, CLK_OPS_PARENT_ENABLE,
Signature · 1 line
2.34.1
PATCH 2/5 clk: stm32mp1: Add parent_data to ETHRX clock
Pass parent_data to ETHRX clock with new fw_name = "ETH_RX_CLK/ETH_REF_CLK". By default, this change has no impact on the operation of the clock driver. However, due to the fw_name, it permits DT to override ETHRX clock parent, which might be needed in case the ETHRX clock are supplied by external clock source.
Example of MCO2 supplying clock to ETH_RX_CLK via external pad-to-pad wire:
&rcc {
clocks = <&rcc CK_MCO2>;
clock-names = "ETH_RX_CLK/ETH_REF_CLK";
};Note that while this patch permits to implement this rare usecase, the issue with ethernet RX and TX input clock modeling on MP1 is far more complex and requires more core plumbing.
[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
--- drivers/clk/clk-stm32mp1.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)
drivers/clk/clk-stm32mp1.c +32 -4
@@ -155,6 +155,10 @@ static const char * const eth_src[] = { "pll4_p", "pll3_q" }; +const struct clk_parent_data ethrx_src[] = { + { .name ="ethck_k" , .fw_name ="ETH_RX_CLK/ETH_REF_CLK" }, +}; +static const char *const rng_src[] = {"ck_csi" ,"pll4_r" ,"ck_lse" ,"ck_lsi" };
@@ -317,6 +321,7 @@ struct clock_config {const char *name;const char *parent_name;const char *const *parent_names; +const struct clk_parent_data *parent_data;int num_parents;unsigned long flags;void *cfg;
@@ -576,6 +581,7 @@ static struct clk_hw * clk_stm32_register_gate_ops(struct device *dev, const char *name, const char *parent_name, + const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *base, const struct stm32_gate_cfg *cfg,
@@ -586,7 +592,10 @@ clk_stm32_register_gate_ops(struct device *dev,int ret; init.name = name; - init.parent_names = &parent_name; +if (parent_name) + init.parent_names = &parent_name; +if (parent_data) + init.parent_data = parent_data; init.num_parents =1 ; init.flags = flags;
@@ -611,6 +620,7 @@ clk_stm32_register_gate_ops(struct device *dev,static struct clk_hw *clk_stm32_register_composite (struct device *dev,const char *name,const char *const *parent_names, +const struct clk_parent_data *parent_data,int num_parents,void __iomem *base,const struct stm32_composite_cfg *cfg,unsigned long flags,spinlock_t *lock)
@@ -1135,6 +1145,7 @@ _clk_stm32_register_gate(struct device *dev, return clk_stm32_register_gate_ops(dev, cfg->name, cfg->parent_name, + cfg->parent_data, cfg->flags, base, cfg->cfg,
@@ -1148,8 +1159,8 @@ _clk_stm32_register_composite(struct device *dev, const struct clock_config *cfg) {return clk_stm32_register_composite (dev, cfg->name, cfg->parent_names, - cfg->num_parents, base, cfg->cfg, - cfg->flags, lock); + cfg->parent_data, cfg->num_parents, + base, cfg->cfg, cfg->flags, lock); }#define GATE (_id, _name, _parent, _flags, _offset, _bit_idx, _gate_flags)\
@@ -1258,6 +1269,16 @@ _clk_stm32_register_composite(struct device *dev, .func = _clk_stm32_register_gate,\ } +#define STM32_GATE_PDATA (_id, _name, _parent, _flags, _gate)\ +{\ + .id = _id,\ + .name = _name,\ + .parent_data = _parent,\ + .flags = _flags,\ + .cfg = (struct stm32_gate_cfg *) {_gate},\ + .func = _clk_stm32_register_gate,\ +} +#define _STM32_GATE (_gate_offset, _gate_bit_idx, _gate_flags, _mgate, _ops)\ (&(struct stm32_gate_cfg) {\ &(struct gate_cfg) {\
@@ -1291,6 +1312,10 @@ _clk_stm32_register_composite(struct device *dev,STM32_GATE (_id, _name, _parent, _flags,\ _STM32_MGATE(_mgate)) +#define MGATE_MP1_PDATA (_id, _name, _parent, _flags, _mgate)\ + STM32_GATE_PDATA(_id, _name, _parent, _flags,\ + _STM32_MGATE(_mgate)) +#define _STM32_DIV (_div_offset, _div_shift, _div_width,\ _div_flags, _div_table, _ops)\ .div = &(struct stm32_div_cfg) {\
@@ -1354,6 +1379,9 @@ _clk_stm32_register_composite(struct device *dev,#define PCLK (_id, _name, _parent, _flags, _mgate)\ MGATE_MP1(_id, _name, _parent, _flags, _mgate) +#define PCLK_PDATA (_id, _name, _parent, _flags, _mgate)\ + MGATE_MP1_PDATA(_id, _name, _parent, _flags, _mgate) +#define KCLK (_id, _name, _parents, _flags, _mgate, _mmux)\ COMPOSITE(_id, _name, _parents, CLK_OPS_PARENT_ENABLE |\ CLK_SET_RATE_NO_REPARENT | _flags,\
@@ -1951,7 +1979,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_PDATA (ETHRX ,"ethrx" , ethrx_src,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),
Signature · 1 line
2.34.1
RE: [PATCH 2/5] clk: stm32mp1: Add parent_data to ETHRX clock
Quoted 156 lines
From: Marek Vasut [mailto:[email protected]]
Sent: Tuesday, January 18, 2022 9:30 PMPass
parent_datato ETHRX clock with newfw_name= "ETH_RX_CLK/ETH_REF_CLK". By default, this change has no impact on the operation of the clock driver. However, due to thefw_name, it permits DT to override ETHRX clock parent, which might be needed in case the ETHRX clock are supplied by external clock source.Example of MCO2 supplying clock to
ETH_RX_CLKvia external pad-to-pad wire:&rcc { clocks = <&rcc CK_MCO2>; clock-names = "ETH_RX_CLK/ETH_REF_CLK"; };Note that while this patch permits to implement this rare usecase, the issue with ethernet RX and TX input clock modeling on MP1 is far more complex and requires more core plumbing.
[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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- drivers/clk/clk-stm32mp1.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)drivers/clk/clk-stm32mp1.c +32
-5@@ -155,6 +155,10 @@ static const char * const eth_src[] = { "pll4_p", "pll3_q" }; +const struct clk_parent_data ethrx_src[] = { + { .name ="ethck_k" , .fw_name ="ETH_RX_CLK/ETH_REF_CLK" }, +}; +static const char *const rng_src[] = {"ck_csi" ,"pll4_r" ,"ck_lse" ,"ck_lsi" };@@ -317,6 +321,7 @@ struct clock_config {const char *name;const char *parent_name;const char *const *parent_names; +const struct clk_parent_data *parent_data;int num_parents;unsigned long flags;void *cfg;@@ -576,6 +581,7 @@ static struct clk_hw * clk_stm32_register_gate_ops(struct device *dev, const char *name, const char *parent_name, + const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *base, const struct stm32_gate_cfg *cfg,@@ -586,7 +592,10 @@ clk_stm32_register_gate_ops(struct device *dev,int ret; init.name = name; - init.parent_names = &parent_name; +if (parent_name) + init.parent_names = &parent_name; +if (parent_data) + init.parent_data = parent_data; init.num_parents =1 ; init.flags = flags;@@ -611,6 +620,7 @@ clk_stm32_register_gate_ops(struct device *dev,static struct clk_hw *clk_stm32_register_composite (struct device *dev,const char *name,const char *const *parent_names, +const struct clk_parent_data *parent_data,int num_parents,void __iomem *base,const struct stm32_composite_cfg *cfg,unsigned long flags,spinlock_t *lock)@@ -1135,6 +1145,7 @@ _clk_stm32_register_gate(struct device *dev, return clk_stm32_register_gate_ops(dev, cfg->name, cfg->parent_name, + cfg->parent_data, cfg->flags, base, cfg->cfg,@@ -1148,8 +1159,8 @@ _clk_stm32_register_composite(struct device *dev, const struct clock_config *cfg) {return clk_stm32_register_composite (dev, cfg->name, cfg->parent_names, - cfg->num_parents, base, cfg->cfg, - cfg->flags, lock); + cfg->parent_data, cfg->num_parents, + base, cfg->cfg, cfg->flags, lock); }#define GATE (_id, _name, _parent, _flags, _offset, _bit_idx, _gate_flags)\@@ -1258,6 +1269,16 @@ _clk_stm32_register_composite(struct device *dev, .func = _clk_stm32_register_gate,\ } +#define STM32_GATE_PDATA (_id, _name, _parent, _flags, _gate)\ +{\ + .id = _id,\ + .name = _name,\ + .parent_data = _parent,\ + .flags = _flags,\ + .cfg = (struct stm32_gate_cfg *) {_gate},\ + .func = _clk_stm32_register_gate,\ +} +#define _STM32_GATE (_gate_offset, _gate_bit_idx, _gate_flags, _mgate, _ops)\ (&(struct stm32_gate_cfg) {\ &(struct gate_cfg) {\@@ -1291,6 +1312,10 @@ _clk_stm32_register_composite(struct device *dev,STM32_GATE (_id, _name, _parent, _flags,\ _STM32_MGATE(_mgate)) +#define MGATE_MP1_PDATA (_id, _name, _parent, _flags, _mgate)\ + STM32_GATE_PDATA(_id, _name, _parent, _flags,\ + _STM32_MGATE(_mgate)) +#define _STM32_DIV (_div_offset, _div_shift, _div_width,\ _div_flags, _div_table, _ops)\ .div = &(struct stm32_div_cfg) {\@@ -1354,6 +1379,9 @@ _clk_stm32_register_composite(struct device *dev,#define PCLK (_id, _name, _parent, _flags, _mgate)\ MGATE_MP1(_id, _name, _parent, _flags, _mgate) +#define PCLK_PDATA (_id, _name, _parent, _flags, _mgate)\ + MGATE_MP1_PDATA(_id, _name, _parent, _flags, _mgate) +#define KCLK (_id, _name, _parents, _flags, _mgate, _mmux)\ COMPOSITE(_id, _name, _parents, CLK_OPS_PARENT_ENABLE |\ CLK_SET_RATE_NO_REPARENT | _flags,\@@ -1951,7 +1979,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_PDATA (ETHRX ,"ethrx" , ethrx_src,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), --
Quoted 1 line
2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/5] clk: stm32mp1: Add parent_data to ETHRX clock
In reply to Marek VasutHi Marek,
Thanks for the patchet.
You can add
Quoted 152 lines · Marek Vasut
Pass
parent_datato ETHRX clock with newfw_name= "ETH_RX_CLK/ETH_REF_CLK". By default, this change has no impact on the operation of the clock driver. However, due to thefw_name, it permits DT to override ETHRX clock parent, which might be needed in case the ETHRX clock are supplied by external clock source.Example of MCO2 supplying clock to
ETH_RX_CLKvia external pad-to-pad wire:&rcc { clocks = <&rcc CK_MCO2>; clock-names = "ETH_RX_CLK/ETH_REF_CLK"; };Note that while this patch permits to implement this rare usecase, the issue with ethernet RX and TX input clock modeling on MP1 is far more complex and requires more core plumbing.
[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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- drivers/clk/clk-stm32mp1.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)drivers/clk/clk-stm32mp1.c +32
-4@@ -155,6 +155,10 @@ static const char * const eth_src[] = { "pll4_p", "pll3_q" }; +const struct clk_parent_data ethrx_src[] = { + { .name ="ethck_k" , .fw_name ="ETH_RX_CLK/ETH_REF_CLK" }, +}; +static const char *const rng_src[] = {"ck_csi" ,"pll4_r" ,"ck_lse" ,"ck_lsi" };@@ -317,6 +321,7 @@ struct clock_config {const char *name;const char *parent_name;const char *const *parent_names; +const struct clk_parent_data *parent_data;int num_parents;unsigned long flags;void *cfg;@@ -576,6 +581,7 @@ static struct clk_hw * clk_stm32_register_gate_ops(struct device *dev, const char *name, const char *parent_name, + const struct clk_parent_data *parent_data, unsigned long flags, void __iomem *base, const struct stm32_gate_cfg *cfg,@@ -586,7 +592,10 @@ clk_stm32_register_gate_ops(struct device *dev,int ret; init.name = name; - init.parent_names = &parent_name; +if (parent_name) + init.parent_names = &parent_name; +if (parent_data) + init.parent_data = parent_data; init.num_parents =1 ; init.flags = flags;@@ -611,6 +620,7 @@ clk_stm32_register_gate_ops(struct device *dev,static struct clk_hw *clk_stm32_register_composite (struct device *dev,const char *name,const char *const *parent_names, +const struct clk_parent_data *parent_data,int num_parents,void __iomem *base,const struct stm32_composite_cfg *cfg,unsigned long flags,spinlock_t *lock)@@ -1135,6 +1145,7 @@ _clk_stm32_register_gate(struct device *dev, return clk_stm32_register_gate_ops(dev, cfg->name, cfg->parent_name, + cfg->parent_data, cfg->flags, base, cfg->cfg,@@ -1148,8 +1159,8 @@ _clk_stm32_register_composite(struct device *dev, const struct clock_config *cfg) {return clk_stm32_register_composite (dev, cfg->name, cfg->parent_names, - cfg->num_parents, base, cfg->cfg, - cfg->flags, lock); + cfg->parent_data, cfg->num_parents, + base, cfg->cfg, cfg->flags, lock); }#define GATE (_id, _name, _parent, _flags, _offset, _bit_idx, _gate_flags)\@@ -1258,6 +1269,16 @@ _clk_stm32_register_composite(struct device *dev, .func = _clk_stm32_register_gate,\ } +#define STM32_GATE_PDATA (_id, _name, _parent, _flags, _gate)\ +{\ + .id = _id,\ + .name = _name,\ + .parent_data = _parent,\ + .flags = _flags,\ + .cfg = (struct stm32_gate_cfg *) {_gate},\ + .func = _clk_stm32_register_gate,\ +} +#define _STM32_GATE (_gate_offset, _gate_bit_idx, _gate_flags, _mgate, _ops)\ (&(struct stm32_gate_cfg) {\ &(struct gate_cfg) {\@@ -1291,6 +1312,10 @@ _clk_stm32_register_composite(struct device *dev,STM32_GATE (_id, _name, _parent, _flags,\ _STM32_MGATE(_mgate)) +#define MGATE_MP1_PDATA (_id, _name, _parent, _flags, _mgate)\ + STM32_GATE_PDATA(_id, _name, _parent, _flags,\ + _STM32_MGATE(_mgate)) +#define _STM32_DIV (_div_offset, _div_shift, _div_width,\ _div_flags, _div_table, _ops)\ .div = &(struct stm32_div_cfg) {\@@ -1354,6 +1379,9 @@ _clk_stm32_register_composite(struct device *dev,#define PCLK (_id, _name, _parent, _flags, _mgate)\ MGATE_MP1(_id, _name, _parent, _flags, _mgate) +#define PCLK_PDATA (_id, _name, _parent, _flags, _mgate)\ + MGATE_MP1_PDATA(_id, _name, _parent, _flags, _mgate) +#define KCLK (_id, _name, _parents, _flags, _mgate, _mmux)\ COMPOSITE(_id, _name, _parents, CLK_OPS_PARENT_ENABLE |\ CLK_SET_RATE_NO_REPARENT | _flags,\@@ -1951,7 +1979,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_PDATA (ETHRX ,"ethrx" , ethrx_src,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),
Re: [PATCH 2/5] clk: stm32mp1: Add parent_data to ETHRX clock
In reply to Marek VasutQuoting Marek Vasut (2022-01-18 12:29:55)
Quoted 29 lines
Pass
parent_datato ETHRX clock with newfw_name= "ETH_RX_CLK/ETH_REF_CLK". By default, this change has no impact on the operation of the clock driver. However, due to thefw_name, it permits DT to override ETHRX clock parent, which might be needed in case the ETHRX clock are supplied by external clock source.Example of MCO2 supplying clock to
ETH_RX_CLKvia external pad-to-pad wire:&rcc { clocks = <&rcc CK_MCO2>; clock-names = "ETH_RX_CLK/ETH_REF_CLK"; };Note that while this patch permits to implement this rare usecase, the issue with ethernet RX and TX input clock modeling on MP1 is far more complex and requires more core plumbing.
[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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>
Quoted 2 lines
To: [email protected]
---
Applied to clk-next
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/5 ARM: dts: stm32: Add alternate pinmux for ethernet0 pins
In reply to Marek VasutAdd another mux option for ethernet0 pins, this is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin and then fed back via PA1 pin.
--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +34 -0
@@ -338,6 +338,40 @@ pins1 { }; }; + ethernet0_rmii_pins_b: rmii-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 1, AF11)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 2, AF11)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, AF11)>; /* ETH1_MDC */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + pins2 { + pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, AF11)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 7, AF11)>; /* ETH1_RMII_CRS_DV */ + bias-disable; + }; + }; + + ethernet0_rmii_sleep_pins_b: rmii-sleep-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, ANALOG)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */ + <STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 7, ANALOG)>; /* ETH1_RMII_CRS_DV */ + }; + }; + fmc_pins_a: fmc-0 { pins1 { pinmux = <STM32_PINMUX('D', 4, AF12)>, /* FMC_NOE */
Signature · 1 line
2.34.1
RE: [PATCH 3/5] ARM: dts: stm32: Add alternate pinmux for ethernet0 pins
Quoted 67 lines
From: Marek Vasut [mailto:[email protected]]
Sent: Tuesday, January 18, 2022 9:30 PMAdd another mux option for ethernet0 pins, this is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin and then fed back via PA1 pin.
Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+)arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +34
-1@@ -338,6 +338,40 @@ pins1 { }; }; + ethernet0_rmii_pins_b: rmii-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 1, AF11)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 2, AF11)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, AF11)>; /* ETH1_MDC */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + pins2 { + pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, AF11)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 7, AF11)>; /* ETH1_RMII_CRS_DV */ + bias-disable; + }; + }; + + ethernet0_rmii_sleep_pins_b: rmii-sleep-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, ANALOG)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */ + <STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 7, ANALOG)>; /* ETH1_RMII_CRS_DV */ + }; + }; + fmc_pins_a: fmc-0 { pins1 { pinmux = <STM32_PINMUX('D', 4, AF12)>, /* FMC_NOE */ --
Quoted 1 line
2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Alexandre TORGUE
maintainerRe: [PATCH 3/5] ARM: dts: stm32: Add alternate pinmux for ethernet0 pins
In reply to Marek VasutHi Marek
Quoted 53 lines · Marek Vasut
Add another mux option for ethernet0 pins, this is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin and then fed back via PA1 pin.
Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+)arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +27
-0@@ -338,6 +338,40 @@ pins1 { }; }; + ethernet0_rmii_pins_b: rmii-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 1, AF11)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 2, AF11)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, AF11)>; /* ETH1_MDC */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + pins2 { + pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, AF11)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 7, AF11)>; /* ETH1_RMII_CRS_DV */ + bias-disable; + }; + }; + + ethernet0_rmii_sleep_pins_b: rmii-sleep-1 { + pins1 { + pinmux = <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_RMII_TXD0 */ + <STM32_PINMUX('G', 14, ANALOG)>, /* ETH1_RMII_TXD1 */ + <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_RMII_TX_EN */ + <STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */ + <STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi pins1 { · line 377
Quoted 10 lines
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +7
-0+ <STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RMII_RXD0 */ + <STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RMII_RXD1 */ + <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_RMII_REF_CLK */ + <STM32_PINMUX('A', 7, ANALOG)>; /* ETH1_RMII_CRS_DV */ + }; + }; + fmc_pins_a: fmc-0 { pins1 { pinmux = <STM32_PINMUX('D', 4, AF12)>, /* FMC_NOE */
Applied on stm32-next with as discussed small modifications (use xxxx_pins_c instead of xxxx_pins_b) due to conflicts with emSBC-Argon series.
cheers
Alex
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/5 ARM: dts: stm32: Add alternate pinmux for mco2 pins
In reply to Marek VasutAdd pinmux option for MCO2 pin. This is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin.
--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +15 -0
@@ -882,6 +882,21 @@ pins { }; }; + mco2_pins_a: mco2-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, AF1)>; /* MCO2 */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + }; + + mco2_sleep_pins_a: mco2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* MCO2 */ + }; + }; + m_can1_pins_a: m-can1-0 { pins1 { pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */
Signature · 1 line
2.34.1
RE: [PATCH 4/5] ARM: dts: stm32: Add alternate pinmux for mco2 pins
Quoted 47 lines
From: Marek Vasut [mailto:[email protected]]
Sent: Tuesday, January 18, 2022 9:30 PMAdd pinmux option for MCO2 pin. This is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin.
Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +15
-1@@ -882,6 +882,21 @@ pins { }; }; + mco2_pins_a: mco2-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, AF1)>; /* MCO2 */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + }; + + mco2_sleep_pins_a: mco2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* MCO2 */ + }; + }; + m_can1_pins_a: m-can1-0 { pins1 { pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */ --
Quoted 1 line
2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Alexandre TORGUE
maintainerRe: [PATCH 4/5] ARM: dts: stm32: Add alternate pinmux for mco2 pins
In reply to Marek VasutQuoted 33 lines · Marek Vasut
Add pinmux option for MCO2 pin. This is used on DHCOM when the ethernet PHY 50 MHz clock is generated by the MCO2 on PG2 pin.
Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+)arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +8
-0@@ -882,6 +882,21 @@ pins { }; }; + mco2_pins_a: mco2-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, AF1)>; /* MCO2 */ + bias-disable; + drive-push-pull; + slew-rate = <2>; + }; + };
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi pins { · line 902
Quoted 10 lines
arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +7
-0+ + mco2_sleep_pins_a: mco2-sleep-0 { + pins { + pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* MCO2 */ + }; + }; + m_can1_pins_a: m-can1-0 { pins1 { pinmux = <STM32_PINMUX('H', 13, AF9)>; /* CAN1_TX */
Applied on stm32-next
thanks
Alex
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 5/5 ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM
In reply to Marek VasutThe 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.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +18 -4
@@ -116,15 +116,29 @@ &dts { status = "okay"; }; +&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>; +}; + ðernet0 { status = "okay"; - pinctrl-0 = <ðernet0_rmii_pins_a>; - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; + pinctrl-0 = <ðernet0_rmii_pins_b &mco2_pins_a>; + pinctrl-1 = <ðernet0_rmii_sleep_pins_b &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 +150,7 @@ phy0: ethernet-phy@1 { /* 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>;
Signature · 1 line
2.34.1
RE: [PATCH 5/5] ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM
Quoted 84 lines
From: Marek Vasut [mailto:[email protected]]
Sent: Tuesday, January 18, 2022 9:30 PMThe DHCOM SoM has two options for supplying ETHRX clock to the DWMAC block and PHY. Either (1)
ETHCK_Kgenerates 50 MHz clock onETH_CLKpad for the PHY and the same 50 MHz clock are fed back to ETHRX via internaleth_clk_fbclock connection OR (2)ETH_CLKis 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 viaETH_RX_CLKinput pad using external pad-to-pad connection.Option (1) has two downsides.
ETHCK_Kis supplied directly from eitherPLL3_QorPLL4_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_Pis 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.Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +18
-5@@ -116,15 +116,29 @@ &dts { status = "okay"; }; +&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>; +}; + ðernet0 { status = "okay"; - pinctrl-0 = <ðernet0_rmii_pins_a>; - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; + pinctrl-0 = <ðernet0_rmii_pins_b &mco2_pins_a>; + pinctrl-1 = <ðernet0_rmii_sleep_pins_b &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 +150,7 @@ phy0: ethernet-phy@1 { /* 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>; --
Quoted 1 line
2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Alexandre TORGUE
maintainerRe: [PATCH 5/5] ARM: dts: stm32: Switch DWMAC RMII clock to MCO2 on DHCOM
In reply to Marek VasutQuoted 72 lines · Marek Vasut
The DHCOM SoM has two options for supplying ETHRX clock to the DWMAC block and PHY. Either (1)
ETHCK_Kgenerates 50 MHz clock onETH_CLKpad for the PHY and the same 50 MHz clock are fed back to ETHRX via internaleth_clk_fbclock connection OR (2)ETH_CLKis 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 viaETH_RX_CLKinput pad using external pad-to-pad connection.Option (1) has two downsides.
ETHCK_Kis supplied directly from eitherPLL3_QorPLL4_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_Pis 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.Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +17
-3@@ -116,15 +116,29 @@ &dts { status = "okay"; }; +&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>; +}; + ðernet0 { status = "okay"; - pinctrl-0 = <ðernet0_rmii_pins_a>; - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; + pinctrl-0 = <ðernet0_rmii_pins_b &mco2_pins_a>; + pinctrl-1 = <ðernet0_rmii_sleep_pins_b &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>;
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi phy0: ethernet-phy@1 { · line 156
Quoted 8 lines
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +1
-1@@ -136,7 +150,7 @@ phy0: ethernet-phy@1 { /* 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>;
Applied on stm32-next using ethernet0_rmii_pins_c instead of ethernet0_rmii_pins_b (same for sleep pins.
Cheers
Alex
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 67 lines
From: Marek Vasut [mailto:[email protected]]
Sent: Tuesday, January 18, 2022 9:30 PMThe
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain 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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- drivers/clk/clk-stm32mp1.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/clk/clk-stm32mp1.c +7
-4@@ -2008,7 +2008,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = {KCLK (DSI_K ,"dsi_k" , dsi_src,0 ,G_DSI ,M_DSI ),KCLK (ADFSDM_K ,"adfsdm_k" , sai_src,0 ,G_ADFSDM ,M_SAI1 ),KCLK (USBO_K ,"usbo_k" , usbo_src,0 ,G_USBO ,M_USBO ), -KCLK (ETHCK_K ,"ethck_k" , eth_src,0 ,G_ETHCK ,M_ETHCK ),/* Particulary Kernel Clocks (no mux or no gate) */ MGATE_MP1(DFSDM_K, "dfsdm_k", "ck_mcu", 0, G_DFSDM),@@ -2017,11 +2016,16 @@ static const struct clock_config stm32mp1_clock_cfg[] = {MGATE_MP1 (GPU_K ,"gpu_k" ,"pll2_q" ,0 ,G_GPU ),MGATE_MP1 (DAC12_K ,"dac12_k" ,"ck_lsi" ,0 ,G_DAC12 ), -COMPOSITE (ETHPTP_K ,"ethptp_k" , eth_src,CLK_OPS_PARENT_ENABLE | +COMPOSITE (NO_ID ,"ck_ker_eth" , eth_src,CLK_OPS_PARENT_ENABLE |CLK_SET_RATE_NO_REPARENT , _NO_GATE,_MMUX (M_ETHCK ), -_DIV (RCC_ETHCKSELR ,4 ,4 ,0 ,NULL )), + _NO_DIV), + +MGATE_MP1 (ETHCK_K ,"ethck_k" ,"ck_ker_eth" ,0 ,G_ETHCK ), + +DIV (ETHPTP_K ,"ethptp_k" ,"ck_ker_eth" ,CLK_OPS_PARENT_ENABLE | +CLK_SET_RATE_NO_REPARENT ,RCC_ETHCKSELR ,4 ,4 ,0 ),/* RTC clock */ COMPOSITE(RTC, "ck_rtc", rtc_src, CLK_OPS_PARENT_ENABLE, --
Quoted 1 line
2.34.1
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Stephen Boyd
maintainerQuoting Marek Vasut (2022-01-18 12:29:54)
Quoted 27 lines
The
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain 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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>
Quoted 2 lines
To: [email protected]
---
Any cover letter? What is the merge strategy of this patch series? Do I need to ack the patches?
Quoted 31 lines · Stephen Boyd
Quoting Marek Vasut (2022-01-18 12:29:54)
Quoted 27 lines
The
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain 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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>Quoted 2 lines
To: [email protected]
---
Quoted 1 line
Any cover letter?
If there is a need for V2, I will send one. Admittedly, I forgot one here.
Quoted 1 line
What is the merge strategy of this patch series?
Clock bits 1/5 and 2/5 can go through clock tree, DT bits through Alex's ST tree.
Quoted 1 line
Do I need to ack the patches?
I am waiting for AB/RB from ST, then they can be merged.
If you want to review the first two patches, sure, the top half of 2/5 is probably the most interesting part, based on your suggestion from almost a year ago. The rest are clock controller hardware details.
Quoted 40 lines · Marek Vasut
Quoted 33 lines · Stephen Boyd
Quoting Marek Vasut (2022-01-18 12:29:54)
Quoted 29 lines
The
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain functional as before.[1] STM32MP1 Reference Manual RM0436 Rev 3, Page 574, Figure 83. Peripheral clock distribution for Ethernet
Signed-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>Quoted 2 lines
To: [email protected]
---Quoted 1 line
Any cover letter?
If there is a need for V2, I will send one. Admittedly, I forgot one here.
Quoted 1 line
What is the merge strategy of this patch series?
Quoted 7 lines
Clock bits 1/5 and 2/5 can go through clock tree, DT bits through Alex's ST tree.
Quoted 1 line
Do I need to ack the patches?
I am waiting for AB/RB from ST, then they can be merged.
If you want to review the first two patches, sure, the top half of 2/5 is probably the most interesting part, based on your suggestion from almost a year ago. The rest are clock controller hardware details.
So if you want to pick 1/5 and 2/5 via clock tree with A-B from Gabriel, please do.
Hi Marek,
The split between ETHCK_K gate, ETHPTPDIV and ck_ker_eth is fine for me. It's reflected much better the clock ethernet distribution.
However the initial code should have let the ethck gate disable if ethck is not used.
You can add
Quoted 64 lines · Marek Vasut
The
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain 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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>--- drivers/clk/clk-stm32mp1.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/clk/clk-stm32mp1.c +7
-3@@ -2008,7 +2008,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = {KCLK (DSI_K ,"dsi_k" , dsi_src,0 ,G_DSI ,M_DSI ),KCLK (ADFSDM_K ,"adfsdm_k" , sai_src,0 ,G_ADFSDM ,M_SAI1 ),KCLK (USBO_K ,"usbo_k" , usbo_src,0 ,G_USBO ,M_USBO ), -KCLK (ETHCK_K ,"ethck_k" , eth_src,0 ,G_ETHCK ,M_ETHCK ),/* Particulary Kernel Clocks (no mux or no gate) */ MGATE_MP1(DFSDM_K, "dfsdm_k", "ck_mcu", 0, G_DFSDM),@@ -2017,11 +2016,16 @@ static const struct clock_config stm32mp1_clock_cfg[] = {MGATE_MP1 (GPU_K ,"gpu_k" ,"pll2_q" ,0 ,G_GPU ),MGATE_MP1 (DAC12_K ,"dac12_k" ,"ck_lsi" ,0 ,G_DAC12 ), -COMPOSITE (ETHPTP_K ,"ethptp_k" , eth_src,CLK_OPS_PARENT_ENABLE | +COMPOSITE (NO_ID ,"ck_ker_eth" , eth_src,CLK_OPS_PARENT_ENABLE |CLK_SET_RATE_NO_REPARENT , _NO_GATE,_MMUX (M_ETHCK ), -_DIV (RCC_ETHCKSELR ,4 ,4 ,0 ,NULL )), + _NO_DIV), + +MGATE_MP1 (ETHCK_K ,"ethck_k" ,"ck_ker_eth" ,0 ,G_ETHCK ), + +DIV (ETHPTP_K ,"ethptp_k" ,"ck_ker_eth" ,CLK_OPS_PARENT_ENABLE | +CLK_SET_RATE_NO_REPARENT ,RCC_ETHCKSELR ,4 ,4 ,0 ),/* RTC clock */ COMPOSITE(RTC, "ck_rtc", rtc_src, CLK_OPS_PARENT_ENABLE,
Quoting Marek Vasut (2022-01-18 12:29:54)
Quoted 27 lines
The
ETHCK_Kare 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 theETHCK_Kmux, 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_Kfrom composite clock into a ETHCKEN gate,ETHPTP_Kfrom composite clock into ETHPTPDIV divider, and adds anotherNO_IDclock "ck_ker_eth" which models the ETHSRC mux and is parent clock to bothETHCK_KandETHPTP_K. Therefore, all references toETHCK_KandETHPTP_Kremain 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.pdfSigned-off-by Marek Vasut <[email protected]>Cc Alexandre Torgue <[email protected]>Cc Christophe Roullier <[email protected]>Cc Gabriel Fernandez <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Stephen Boyd <[email protected]>
Quoted 2 lines
To: [email protected]
---
Applied to clk-next
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel