linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/4] net: l2switch: Provide support for L2 switch on i.MX28 SoC
@ 2020-11-25 23:24 Lukasz Majewski
  2020-11-25 23:24 ` [RFC 1/4] net: fec: Move some defines to ./drivers/net/ethernet/freescale/fec.h header Lukasz Majewski
                   ` (5 more replies)
  0 siblings, 6 replies; 24+ messages in thread
From: Lukasz Majewski @ 2020-11-25 23:24 UTC (permalink / raw)
  To: Fugang Duan, David S . Miller, Jakub Kicinski, netdev,
	Andrew Lunn, Fabio Estevam, Vivien Didelot
  Cc: Peng Fan, Florian Fainelli, stefan.agner, linux-kernel, krzk,
	Lukasz Majewski, NXP Linux Team, Vladimir Oltean, Shawn Guo,
	linux-arm-kernel

This is the first attempt to add support for L2 switch available on some NXP
devices - i.e. iMX287 or VF610. This patch set uses common FEC and DSA code.

This code provides _very_ basic switch functionality (packets are passed
between lan1 and lan2 ports and it is possible to send packets via eth0),
at its main purpose is to establish the way of reusing the FEC driver. When
this is done, one can add more advanced features to the switch (like vlan or
port separation).

I also do have a request for testing on e.g. VF610 if this driver works on
it too.
The L2 switch documentation is very scant on NXP's User Manual [0] and most
understanding of how it really works comes from old (2.6.35) NXP driver [1].
The aforementioned old driver [1] was monolitic and now this patch set tries
to mix FEC and DSA.

Open issues:
- I do have a hard time on understanding how to "disable" ENET-MAC{01} ports
in DSA (via port_disable callback in dsa_switch_ops).
When I disable L2 switch port1,2 or the ENET-MAC{01} in control register, I
cannot simply re-enable it with enabling this bit again. The old driver reset
(and setup again) the whole switch.

- The L2 switch is part of the SoC silicon, so we cannot follow the "normal" DSA
pattern with "attaching" it via mdio device. The switch reuses already well
defined ENET-MAC{01}. For that reason the MoreThanIP switch driver is
registered as platform device

- The question regarding power management - at least for my use case there
is no need for runtime power management. The L2 switch shall work always at
it connects other devices. 

- The FEC clock is also used for L2 switch management and configuration (as
the L2 switch is just in the same, large IP block). For now I just keep it
enabled so DSA code can use it. It looks a bit problematic to export 
fec_enet_clk_enable() to be reused on DSA code.

Links:
[0] - "i.MX28 Applications Processor Reference Manual, Rev. 2, 08/2013"
[1] - https://github.com/lmajewski/linux-imx28-l2switch/commit/e3c7a6eab73401e021aef0070e1935a0dba84fb5

Dependencies:
This patch set depends on one, which adds DTS for XEA board. However, it shall
be also possible to work on any board by adding L2 switch specific description.

https://marc.info/?l=devicetree&m=160632122703785&w=2
https://marc.info/?l=devicetree&m=160632122303783&w=2
https://marc.info/?l=devicetree&m=160632123203787&w=2

Those patches has been tested (applied) on 4.9.130-cip and v5.9 (vanila
mainline kernel)


Lukasz Majewski (4):
  net: fec: Move some defines to ./drivers/net/ethernet/freescale/fec.h
    header
  net: dsa: Provide DSA driver for NXP's More Than IP L2 switch
  net: imx: l2switch: Adjust fec_main.c to provide support for L2 switch
  ARM: dts: imx28: Add description for L2 switch on XEA board

 arch/arm/boot/dts/imx28-xea.dts           |  55 +++
 drivers/net/dsa/Kconfig                   |  11 +
 drivers/net/dsa/Makefile                  |   1 +
 drivers/net/dsa/mtip-l2switch.c           | 399 ++++++++++++++++++++++
 drivers/net/dsa/mtip-l2switch.h           | 239 +++++++++++++
 drivers/net/ethernet/freescale/fec.h      |  42 +++
 drivers/net/ethernet/freescale/fec_main.c | 148 ++++++--
 7 files changed, 874 insertions(+), 21 deletions(-)
 create mode 100644 drivers/net/dsa/mtip-l2switch.c
 create mode 100644 drivers/net/dsa/mtip-l2switch.h

-- 
2.20.1


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

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

end of thread, other threads:[~2021-06-17 13:59 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 23:24 [RFC 0/4] net: l2switch: Provide support for L2 switch on i.MX28 SoC Lukasz Majewski
2020-11-25 23:24 ` [RFC 1/4] net: fec: Move some defines to ./drivers/net/ethernet/freescale/fec.h header Lukasz Majewski
2020-11-25 23:24 ` [RFC 2/4] net: dsa: Provide DSA driver for NXP's More Than IP L2 switch Lukasz Majewski
2020-11-25 23:24 ` [RFC 3/4] net: imx: l2switch: Adjust fec_main.c to provide support for " Lukasz Majewski
2020-11-25 23:24 ` [RFC 4/4] ARM: dts: imx28: Add description for L2 switch on XEA board Lukasz Majewski
2020-11-26  0:00 ` [RFC 0/4] net: l2switch: Provide support for L2 switch on i.MX28 SoC Andrew Lunn
2020-11-26  1:30   ` Florian Fainelli
2020-11-26  3:10     ` Andrew Lunn
2020-11-26 10:10       ` Lukasz Majewski
2020-11-26 14:45         ` Andrew Lunn
2020-11-27  0:03           ` Lukasz Majewski
2020-11-26 12:30 ` Vladimir Oltean
2020-11-26 23:35   ` Lukasz Majewski
2020-11-27  0:55     ` Andrew Lunn
2020-11-27  9:16       ` Lukasz Majewski
2020-11-27  1:08     ` Andrew Lunn
2020-11-27  9:25       ` Lukasz Majewski
2020-11-27 15:10         ` Andrew Lunn
2021-06-17 11:08       ` Lukasz Majewski
2021-06-17 13:57         ` Andrew Lunn
2020-11-27 19:29     ` Vladimir Oltean
2020-11-28  0:33       ` Lukasz Majewski
2020-11-28  4:34         ` Florian Fainelli
2020-11-29 21:59           ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).