public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks
@ 2026-01-27  8:51 Lukasz Majewski
  2026-01-27 14:08 ` Andrew Lunn
  2026-01-27 14:59 ` Peng Fan
  0 siblings, 2 replies; 4+ messages in thread
From: Lukasz Majewski @ 2026-01-27  8:51 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, linux-clk,
	devicetree, linux-kernel, imx, linux-arm-kernel, Lukasz Majewski

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 from dt-bindings, as its number had to
be increased when MTIP L2 switch clocks were added, and defined locally
in clk-vf610.c driver.

Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
---
Changes for v2:
- Squash clock DT bindings to this single patch
- Replace VF610_CLK_END with VF610_CLK_ESW_MAC_TAB3 + 1

Changes for v3:
- Re-define VF610_CLK_END and move it to clk-vf610.c file
---
 drivers/clk/imx/clk-vf610.c             | 7 +++++++
 include/dt-bindings/clock/vf610-clock.h | 6 +++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
index 41eb38552a9c..84a6f907e213 100644
--- a/drivers/clk/imx/clk-vf610.c
+++ b/drivers/clk/imx/clk-vf610.c
@@ -11,6 +11,8 @@
 
 #include "clk.h"
 
+#define VF610_CLK_END 196
+
 #define CCM_CCR			(ccm_base + 0x00)
 #define CCM_CSR			(ccm_base + 0x04)
 #define CCM_CCSR		(ccm_base + 0x08)
@@ -313,6 +315,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));
 
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index 373644e46747..5d94bd561a2e 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -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 */
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks
  2026-01-27  8:51 [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks Lukasz Majewski
@ 2026-01-27 14:08 ` Andrew Lunn
  2026-01-27 14:59 ` Peng Fan
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-01-27 14:08 UTC (permalink / raw)
  To: Lukasz Majewski
  Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, linux-clk, devicetree,
	linux-kernel, imx, linux-arm-kernel

On Tue, Jan 27, 2026 at 09:51:50AM +0100, Lukasz Majewski wrote:
> 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 from dt-bindings, as its number had to
> be increased when MTIP L2 switch clocks were added, and defined locally
> in clk-vf610.c driver.

The nice thing about having it in vf610-clock.h was that it was clear
that whenever a new clock is added, the value needed to change. It is
now hidden away. It could well be more clocks are added, the value
does not get updated, and in use we go passed the end of the clk[]
array, and probably corrupt the struct clk_onecell_data clk_data.

I would probably add a comment in vf610-clock.h about this.

Apart from that:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks
  2026-01-27  8:51 [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks Lukasz Majewski
  2026-01-27 14:08 ` Andrew Lunn
@ 2026-01-27 14:59 ` Peng Fan
  2026-01-28  8:32   ` Łukasz Majewski
  1 sibling, 1 reply; 4+ messages in thread
From: Peng Fan @ 2026-01-27 14:59 UTC (permalink / raw)
  To: Lukasz Majewski, Abel Vesa, Michael Turquette, Stephen Boyd
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org

Hi Lukasz,

> Subject: [PATCH v3] clk: vf610: Add support for the Ethernet switch
> clocks
> 
> 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 from dt-bindings, as its
> number had to be increased when MTIP L2 switch clocks were added,
> and defined locally in clk-vf610.c driver.
> 
> Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> ---
> Changes for v2:
> - Squash clock DT bindings to this single patch

Sorry for not being clear in last comment, dt-binding
update should be in a separate patch. So please
separate into two patches in one patchset.

Thanks,
Peng.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks
  2026-01-27 14:59 ` Peng Fan
@ 2026-01-28  8:32   ` Łukasz Majewski
  0 siblings, 0 replies; 4+ messages in thread
From: Łukasz Majewski @ 2026-01-28  8:32 UTC (permalink / raw)
  To: Peng Fan, Andrew Lunn
  Cc: Abel Vesa, Michael Turquette, Stephen Boyd, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org

Hi Peng,

> Hi Lukasz,
> 
> > Subject: [PATCH v3] clk: vf610: Add support for the Ethernet switch
> > clocks
> > 
> > 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 from dt-bindings, as its
> > number had to be increased when MTIP L2 switch clocks were added,
> > and defined locally in clk-vf610.c driver.
> > 
> > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > ---
> > Changes for v2:
> > - Squash clock DT bindings to this single patch  
> 
> Sorry for not being clear in last comment, dt-binding
> update should be in a separate patch. So please
> separate into two patches in one patchset.
> 

Ok, so I will add dt-binding as a separate comment and as Andrew asked
I will add comment to vf610-clock.h about VF610_CLK_END being moved to
clock driver as a "local" definition.

> Thanks,
> Peng.
> 



-- 
Best regards,

Lukasz Majewski

--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Managing Director : Stefano Babic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-28  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27  8:51 [PATCH v3] clk: vf610: Add support for the Ethernet switch clocks Lukasz Majewski
2026-01-27 14:08 ` Andrew Lunn
2026-01-27 14:59 ` Peng Fan
2026-01-28  8:32   ` Łukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox