clk: vf610: Add support for the Ethernet switch clocks
PATCH v2 1/1 clk: vf610: Add support for the Ethernet switch clocks
From: Lukasz Majewski <[email protected]>
The vf610 device has built in the MoreThanIP L2 switch. For proper operation it is required to enable ESW and MAC table lookup clocks.
The MAC table spans from 0x400E_C000 for 0x4000 and it is necessary to provide clocks for each AIPS1-"slot", which size is 0x1000 (hence four separate entries).
Those can be enabled via clock gating CCM_CCGR10 register (0x4006_B068).
This patch also adds VF610_CLK_ESW and VF610_CLK_ESW_MAC_TAB{0123} macros definitions for L2 switch.
The VF610_CLK_END has been removed as its number had to be increased when MTIP L2 switch clocks were added.
---
Changes for v2:
- Squash clock DT bindings to this single patch
- Replace VF610_CLK_END with VF610_CLK_ESW_MAC_TAB3 + 1
--- drivers/clk/imx/clk-vf610.c | 7 ++++++- include/dt-bindings/clock/vf610-clock.h | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-vf610.c +6 -1
@@ -110,7 +110,7 @@ static const struct clk_div_table pll4_audio_div_table[] = { { } }; -static struct clk *clk[VF610_CLK_END ]; +static struct clk *clk[VF610_CLK_ESW_MAC_TAB3 +1 ];static struct clk_onecell_data clk_data;static u32 cscmr1;
@@ -309,6 +309,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_ENET_TS ] =imx_clk_gate ("enet_ts" ,"enet_ts_sel" ,CCM_CSCDR1 ,23 ); clk[VF610_CLK_ENET0 ] =imx_clk_gate2 ("enet0" ,"ipg_bus" ,CCM_CCGR9 ,CCM_CCGRx_CGn (0 )); clk[VF610_CLK_ENET1 ] =imx_clk_gate2 ("enet1" ,"ipg_bus" ,CCM_CCGR9 ,CCM_CCGRx_CGn (1 )); + clk[VF610_CLK_ESW ] =imx_clk_gate2 ("esw" ,"ipg_bus" ,CCM_CCGR10 ,CCM_CCGRx_CGn (8 )); + clk[VF610_CLK_ESW_MAC_TAB0 ] =imx_clk_gate2 ("esw_tab0" ,"ipg_bus" ,CCM_CCGR10 ,CCM_CCGRx_CGn (12 )); + clk[VF610_CLK_ESW_MAC_TAB1 ] =imx_clk_gate2 ("esw_tab1" ,"ipg_bus" ,CCM_CCGR10 ,CCM_CCGRx_CGn (13 )); + clk[VF610_CLK_ESW_MAC_TAB2 ] =imx_clk_gate2 ("esw_tab2" ,"ipg_bus" ,CCM_CCGR10 ,CCM_CCGRx_CGn (14 )); + clk[VF610_CLK_ESW_MAC_TAB3 ] =imx_clk_gate2 ("esw_tab3" ,"ipg_bus" ,CCM_CCGR10 ,CCM_CCGRx_CGn (15 )); clk[VF610_CLK_PIT ] =imx_clk_gate2 ("pit" ,"ipg_bus" ,CCM_CCGR1 ,CCM_CCGRx_CGn (7 ));
include/dt-bindings/clock/vf610-clock.h +5 -1
@@ -197,6 +197,10 @@#define VF610_CLK_TCON1 188#define VF610_CLK_CAAM 189#define VF610_CLK_CRC 190 -#define VF610_CLK_END 191 +#define VF610_CLK_ESW 191 +#define VF610_CLK_ESW_MAC_TAB0 192 +#define VF610_CLK_ESW_MAC_TAB1 193 +#define VF610_CLK_ESW_MAC_TAB2 194 +#define VF610_CLK_ESW_MAC_TAB3 195#endif /* __DT_BINDINGS_CLOCK_VF610_H */
Signature · 1 line
2.39.5
Quoted 14 lines · Lukasz Majewski
From: Lukasz Majewski <[email protected]>
The vf610 device has built in the MoreThanIP L2 switch. For proper operation it is required to enable ESW and MAC table lookup clocks.
The MAC table spans from 0x400E_C000 for
0x4000and it is necessary to provide clocks for each AIPS1-"slot", which size is0x1000(hence four separate entries).Those can be enabled via clock gating
CCM_CCGR10register (0x4006_B068).This patch also adds
VF610_CLK_ESWand VF610_CLK_ESW_MAC_TAB{0123} macros definitions for L2 switch.
Quoted 8 lines
The
VF610_CLK_ENDhas been removed as its number had to be increased when MTIP L2 switch clocks were added.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Squash clock DT bindings to this single patch
- ReplaceVF610_CLK_ENDwithVF610_CLK_ESW_MAC_TAB3+ 1
I'm not sure this is the correct thing to do. Normally these _END values are there so you don't need to change any code when new things are added to the list.
Why not just keep VF610_CLK_END at the end, with the value of 196?
Andrew
Hi Andrew,
Quoted 25 lines · Lukasz Majewski
Quoted 15 lines
From: Lukasz Majewski <[email protected]>
The vf610 device has built in the MoreThanIP L2 switch. For proper operation it is required to enable ESW and MAC table lookup clocks.
The MAC table spans from 0x400E_C000 for
0x4000and it is necessary to provide clocks for each AIPS1-"slot", which size is0x1000(hence four separate entries).Those can be enabled via clock gating
CCM_CCGR10register (0x4006_B068).This patch also adds
VF610_CLK_ESWand VF610_CLK_ESW_MAC_TAB{0123} macros definitions for L2 switch.Quoted 8 lines
The
VF610_CLK_ENDhas been removed as its number had to be increased when MTIP L2 switch clocks were added.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Squash clock DT bindings to this single patch
- ReplaceVF610_CLK_ENDwithVF610_CLK_ESW_MAC_TAB3+ 1
Quoted 7 lines
I'm not sure this is the correct thing to do. Normally these
_ENDvalues are there so you don't need to change any code when new things are added to the list.Why not just keep
VF610_CLK_ENDat the end, with the value of 196?Andrew
Conor (on CC) explicitly asked to remove VF610_CLK_END:
"[PATCH] dt-bindings: clock: vf610: Add definitions for MTIP L2 switch"
------>8------------
Quoted 1 line
-#define
VF610_CLK_END191
If end is modifiable, it is removable. If you need the define for the driver, please move it there.
------8<------------
I just follow what he asked.
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Managing Director : Stefano Babic
Fabio Estevam
reviewerHi Łukasz,
Quoted 11 lines · Łukasz Majewski
Conor (on CC) explicitly asked to remove
VF610_CLK_END:
"[PATCH] dt-bindings: clock: vf610: Add definitions for MTIP L2 switch"------>8------------
Quoted 1 line
-#define
VF610_CLK_END191If end is modifiable, it is removable. If you need the define for the driver, please move it there.
------8<------------I just follow what he asked.
You should still use VF610_CLK_END. Just define it inside the clk driver instead of in the dt-bindings.
Please check these two i.MX93 patches that explain the rationale:
Hi Fabio,
Quoted 17 lines
Hi Łukasz,
Quoted 11 lines · Łukasz Majewski
Conor (on CC) explicitly asked to remove
VF610_CLK_END:
"[PATCH] dt-bindings: clock: vf610: Add definitions for MTIP L2 switch"
------>8------------Quoted 1 line
-#define
VF610_CLK_END191If end is modifiable, it is removable. If you need the define for the driver, please move it there.
------8<------------I just follow what he asked.
Quoted 8 lines
You should still use
VF610_CLK_END. Just define it inside the clk driver instead of in the dt-bindings.Please check these two i.MX93 patches that explain the rationale:
Ok, if this is the agreed approach, I'm going to use it.
Thanks for pointing this out.
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Managing Director : Stefano Babic