Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
@ 2026-12-02  9:33 Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 01/15] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi all,

The RZ/T2H and RZ/N2H SoCs integrate an Ethernet switch derived from the
RZ/N1 A5PSW, but with a different port topology, additional clock and
reset resources, and different tag control-data semantics.

This series extends the existing A5PSW DSA driver to support the ETHSW
variant while preserving RZ/N1 behavior. It adds a distinct DSA tag
protocol for ETHSW, selects switch topology and tag protocol through
SoC match data, handles the ETHSW clock and reset resources, and applies
a management-port frame-length workaround for an ETHSW hardware issue.
The binding and Kconfig entries are updated to describe and enable the
new variants.

v5->v6:
- Dropped the fixes patches which were part of v5 as they were posted
  separately (and now are merged)
- Patch #2 is newely added to fix module alias.
- In patch #3
  - Squashed the kconfig changes into this patch
  - Updated commit message to reflect the Kconfig changes
- In patch #4
  - Updated the comment to clarify the SWCTRL port speed selection
    mechanism
-In patch #6
  - Added reviewed-by tag
- In patch #11
  - Squashed patch #15 and #16 from v5 to limit the number of patches
  - Updated the commit message
  - Added reviewed-by tag
- In patch #13
  - Squashed patches #18, #19 and #20 from v5 to limit the number
    of patches
  - Updated the commit message
  - Dropped reviewed-by tag as patches were squashed and patch #20 wasn't
    reviewed
- In patch #14
  - Added comment about TX_ENA being kept set on RZ/T2H
    of patches
  - In a5psw_setup, explicitly set TX_ENA while disabling RX_ENA
- In patch #15
  - Squashed patches #21 and #24 to limit the number of patches in
    the series
  - Updated commit message

v4->v5: https://lore.kernel.org/all/20261120002549.1908299-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
- Rebased on next so DSA_TAG_PROTO_RZT2H_ETHSW_VALUE is updated
- patch #4. #8, #9, #10, #11, #18, #19, #20, #21 and #22 are new
- Added RB tag from Rob for patch #5
- Updated patch #6
  - Replaced the patternProperties expression
  - Added maximum constraint for reg values
  - Updated commit subject and description
- Updated patch #7
  - Rebased the patch due to previous changes in the binding
  - Replaced the patternProperties expression for ethernet-ports
  - Set the maximum constraint for reg values on ethernet-ports
  - Restored the RB tag from Rob
- Updated rzt2h_of_data to match the RZ/T2H hardware configuration

v3->v4: https://lore.kernel.org/all/20261104182105.1102555-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
- Added new patch to DT binding to restrict to use only ethernet ports
- Added restriction to validate the reg property in ethernet ports
- Restricted the reg property for ethernet-ports to maximum 3 for RZ/T2H
- Added RB tag from Rob for the DT binding changes
- Added return value check for of_device_get_match_data()

v2->v3: https://lore.kernel.org/all/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
- Added new patch to restrict ports beyond port@4
- Added a restriction to disallow port@4 on T2H SoC
- Updated commit message for patch #5
- Fixed typo in commit message: swicth -> switch
- Marked of_data as const pointer to avoid build warning

v1->v2: https://lore.kernel.org/all/20261001154326.754314-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
- Added RB tag
- Fixed review comments from Vladimir.
- Added info about the IP issue and the workaround

v1: https://lore.kernel.org/all/20251121113553.2955854-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

Cheers,
Prabhakar

Lad Prabhakar (15):
  net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition
  net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias
  net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support
  net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL
  dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node
  dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values
  dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW
    support
  net: dsa: rzn1-a5psw: Add support for optional reset control
  net: dsa: rzn1-a5psw: Add support for optional timestamp clock
  net: dsa: rzn1-a5psw: Make use dev_err_probe()
  net: dsa: rzn1-a5psw: Get switch configuration from OF data
  net: dsa: rzn1-a5psw: Add fixed frame length workaround for management
    port
  net: dsa: rzn1-a5psw: Get register layout from OF data
  net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H
  net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch

 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  | 165 ++++++++++++--
 drivers/net/dsa/Kconfig                       |   9 +-
 drivers/net/dsa/rzn1_a5psw.c                  | 209 +++++++++++++++---
 drivers/net/dsa/rzn1_a5psw.h                  |  51 ++++-
 drivers/net/pcs/pcs-rzn1-miic.c               |  46 +++-
 include/net/dsa.h                             |   2 +
 include/uapi/linux/if_ether.h                 |   2 +-
 net/dsa/Kconfig                               |   9 +-
 net/dsa/tag_rzn1_a5psw.c                      |  24 +-
 9 files changed, 432 insertions(+), 85 deletions(-)

-- 
2.56.1


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

* [PATCH net-next v6 01/15] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias Prabhakar
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Remove the locally defined ETH_P_DSA_A5PSW protocol value from
tag_rzn1_a5psw.c. The macro is already provided by <linux/if_ether.h>,
which is included by this file, making the local definition redundant.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-2-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v4: https://lore.kernel.org/all/20261104182105.1102555-2-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-2-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-2-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added reviewed-by tag
v1: https://lore.kernel.org/all/20251121113553.2955854-2-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 net/dsa/tag_rzn1_a5psw.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
index 734910156dc3..aab0ec143c77 100644
--- a/net/dsa/tag_rzn1_a5psw.c
+++ b/net/dsa/tag_rzn1_a5psw.c
@@ -24,7 +24,6 @@
 
 #define A5PSW_NAME			"a5psw"
 
-#define ETH_P_DSA_A5PSW			0xE001
 #define A5PSW_TAG_LEN			8
 #define A5PSW_CTRL_DATA_FORCE_FORWARD	BIT(0)
 /* This is both used for xmit tag and rcv tagging */
-- 
2.56.1


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

* [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 01/15] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:39   ` Clement Leger
  2026-12-02  9:33 ` [PATCH net-next v6 03/15] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The tagger uses DSA_TAG_PROTO_RZN1_A5PSW, but its module alias
references DSA_TAG_PROTO_A5PSW, which is not the correct protocol
identifier. Consequently, the generated alias does not match the
RZ/N1 tag protocol, preventing automatic module loading.

Use DSA_TAG_PROTO_RZN1_A5PSW when generating the module alias.

Fixes: a08d6a6dc820 ("net: dsa: add Renesas RZ/N1 switch tag driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
Note, Ive not considered this as a fix to net and instead posting it to
net-next as this issue has been since day one. Other fixes which have
been lingering from the first revision were also applied to net-next
see [0].
[0] https://lore.kernel.org/all/20261123130852.3420491-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

v6:
  - New patch
---
 net/dsa/tag_rzn1_a5psw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
index aab0ec143c77..957663c7c101 100644
--- a/net/dsa/tag_rzn1_a5psw.c
+++ b/net/dsa/tag_rzn1_a5psw.c
@@ -114,5 +114,5 @@ static const struct dsa_device_ops a5psw_netdev_ops = {
 
 MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW switch");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW, A5PSW_NAME);
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME);
 module_dsa_tag_driver(a5psw_netdev_ops);
-- 
2.56.1


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

* [PATCH net-next v6 03/15] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 01/15] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 04/15] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add a distinct DSA tag protocol for the RZ/T2H ETHSW to separate its
semantics from the RZ/N1 A5PSW, even though both use the same tagged
frame structure. The on wire layout is identical, but the ControlData
bit assignments differ between the two switch families.

The common tagged frame format is:

  +----------------------+-------------------------------+
  | Field                | Size (octets)                 |
  +----------------------+-------------------------------+
  | Preamble             | 7                             |
  | SFD                  | 1                             |
  | Destination Address  | 6                             |
  | Source Address       | 6                             |
  | ControlTag (0xE001)  | 2                             |
  | ControlData          | 2                             |
  | ControlData2         | 4 (timestamp, portmask)       |
  | Type/Length          | 2                             |
  | Payload              | 0..1500 / 0..9000             |
  | Pad                  | 0..42                         |
  | FCS                  | 4                             |
  +----------------------+-------------------------------+

The differences arise in the ControlData interpretation:

  ControlData field (bits):
    +---------+-----------------------------+
    | SoC     | Meaning                     |
    +---------+-----------------------------+
    | RZ/N1   | [0-3]: ingress port         |
    |         | [4-15]: reserved            |
    +---------+-----------------------------+
    | RZ/T2H  | [0-3]: ingress port         |
    |         | [4]: timestamp timer select |
    |         | [5]: reserved               |
    |         | [6]: RED period indicator   |
    |         | [7-15]: reserved            |
    +---------+-----------------------------+

Because these semantics diverge, register a new
DSA_TAG_PROTO_RZT2H_ETHSW protocol and corresponding tag driver.
Update the Kconfig help and module description to reflect the additional
switch support.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - Squashed the kconfig changes into this patch
  - Updated commit message to reflect the Kconfig changes
v5: https://lore.kernel.org/all/20261120002549.1908299-3-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Rebased on next so DSA_TAG_PROTO_RZT2H_ETHSW_VALUE is updated
v4: https://lore.kernel.org/all/20261104182105.1102555-3-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-3-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-3-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Updated commit message
v1: https://lore.kernel.org/all/20251121113553.2955854-3-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 include/net/dsa.h             |  2 ++
 include/uapi/linux/if_ether.h |  2 +-
 net/dsa/Kconfig               |  9 +++++----
 net/dsa/tag_rzn1_a5psw.c      | 23 ++++++++++++++++++++---
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 09f3043d57f0..a81fe7ae4d18 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -63,6 +63,7 @@ struct tc_action;
 #define DSA_TAG_PROTO_MT7628_VALUE		35
 #define DSA_TAG_PROTO_KS8995_VALUE		36
 #define DSA_TAG_PROTO_LAN9645X_VALUE		37
+#define DSA_TAG_PROTO_RZT2H_ETHSW_VALUE		38
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -103,6 +104,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_MT7628		= DSA_TAG_PROTO_MT7628_VALUE,
 	DSA_TAG_PROTO_KS8995		= DSA_TAG_PROTO_KS8995_VALUE,
 	DSA_TAG_PROTO_LAN9645X		= DSA_TAG_PROTO_LAN9645X_VALUE,
+	DSA_TAG_PROTO_RZT2H_ETHSW	= DSA_TAG_PROTO_RZT2H_ETHSW_VALUE,
 };
 
 struct dsa_switch;
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 1ffac52c39df..9fd25c5d96c9 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -121,7 +121,7 @@
 #define ETH_P_YT921X	0x9988		/* Motorcomm YT921x DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_EDSA	0xDADA		/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_DSA_8021Q	0xDADB		/* Fake VLAN Header for DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
-#define ETH_P_DSA_A5PSW	0xE001		/* A5PSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_DSA_A5PSW	0xE001		/* A5PSW/ETHSW Tag Value [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_IFE	0xED3E		/* ForCES inter-FE LFB type */
 #define ETH_P_AF_IUCV   0xFBFB		/* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
 #define ETH_P_NXP_NETC  0xFD3A		/* NXP NETC DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index bdeb60af764b..3c18314aee95 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -199,11 +199,12 @@ config NET_DSA_TAG_RTL8_4
 	  switches with 8 byte protocol 4 tags, such as the Realtek RTL8365MB-VC.
 
 config NET_DSA_TAG_RZN1_A5PSW
-	tristate "Tag driver for Renesas RZ/N1 A5PSW switch"
+	tristate "Tag driver for Renesas RZ/N1 A5PSW and RZ/T2H, RZ/N2H ETHSW"
 	help
-	  Say Y or M if you want to enable support for tagging frames for
-	  Renesas RZ/N1 embedded switch that uses an 8 byte tag located after
-	  destination MAC address.
+	  Say Y or M if you want to enable frame tagging support for embedded
+	  switches found on Renesas RZ/N1 (A5PSW) and RZ/T2H, RZ/N2H (ETHSW)
+	  SoCs. These switches use an 8-byte tag located after the destination
+	  MAC address.
 
 config NET_DSA_TAG_LAN9303
 	tristate "Tag driver for SMSC/Microchip LAN9303 family of switches"
diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
index 957663c7c101..fc84f9f109f0 100644
--- a/net/dsa/tag_rzn1_a5psw.c
+++ b/net/dsa/tag_rzn1_a5psw.c
@@ -23,6 +23,7 @@
  */
 
 #define A5PSW_NAME			"a5psw"
+#define ETHSW_NAME			"ethsw"
 
 #define A5PSW_TAG_LEN			8
 #define A5PSW_CTRL_DATA_FORCE_FORWARD	BIT(0)
@@ -111,8 +112,24 @@ static const struct dsa_device_ops a5psw_netdev_ops = {
 	.rcv	= a5psw_tag_rcv,
 	.needed_headroom = A5PSW_TAG_LEN,
 };
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME);
+DSA_TAG_DRIVER(a5psw_netdev_ops);
 
-MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW switch");
+static const struct dsa_device_ops ethsw_netdev_ops = {
+	.name	= ETHSW_NAME,
+	.proto	= DSA_TAG_PROTO_RZT2H_ETHSW,
+	.xmit	= a5psw_tag_xmit,
+	.rcv	= a5psw_tag_rcv,
+	.needed_headroom = A5PSW_TAG_LEN,
+};
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZT2H_ETHSW, ETHSW_NAME);
+DSA_TAG_DRIVER(ethsw_netdev_ops);
+
+static struct dsa_tag_driver *dsa_tag_driver_array[] = {
+	&DSA_TAG_DRIVER_NAME(a5psw_netdev_ops),
+	&DSA_TAG_DRIVER_NAME(ethsw_netdev_ops),
+};
+module_dsa_tag_drivers(dsa_tag_driver_array);
+
+MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW and RZ/T2H ETHSW switches");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME);
-module_dsa_tag_driver(a5psw_netdev_ops);
-- 
2.56.1


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

* [PATCH net-next v6 04/15] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (2 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 03/15] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 05/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

On RZ/T2H and RZ/N2H, the ETHSW MAC speed is not fully controlled
through the switch registers. COMMAND_CONFIG_Pn.ENA_10 has no effect
on the actual MAC speed, and 10 Mbps and 1000 Mbps operation must
instead be selected through SWCTRL.SET10 and SWCTRL.SET1000,
respectively.

Without updating SWCTRL when the link speed changes, ETHSW ports
cannot operate correctly at 10 Mbps.

Select the ETHSW port speed through SWCTRL when bringing up the link
to ensure the MAC operates at the negotiated speed. Limit this
behaviour to the converters routed to ETHSW ports so that RZ/N1
remains unaffected.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - Updated the comment to clarify the SWCTRL port speed selection mechanism
v5: https://lore.kernel.org/all/20261120002549.1908299-5-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 drivers/net/pcs/pcs-rzn1-miic.c | 46 ++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 682a73cf5a87..47ca29084910 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -11,6 +11,7 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/device/devres.h>
+#include <linux/ethtool.h>
 #include <linux/mdio.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
@@ -52,6 +53,10 @@
 #define MIIC_CONVRST_PHYIF_RST_MASK	GENMASK(4, 0)
 
 #define MIIC_SWCTRL			0x304
+#define MIIC_SWCTRL_SET_SPEED_10(x)	(BIT(0) << (x))
+#define MIIC_SWCTRL_SET_SPEED_1000(x)	(BIT(4) << (x))
+#define MIIC_SWCTRL_SET_SPEED_MASK(x)	((BIT(0) | BIT(4)) << (x))
+
 #define MIIC_SWDUPC			0x308
 
 #define MIIC_MODCTRL_CONF_CONV_MAX	6
@@ -197,6 +202,7 @@ struct miic_phy_link_cfg {
  * @rsts: Reset controls for the MII converter
  * @of_data: Pointer to OF data
  * @link_cfg: MIIC PHY_LINK configuration
+ * @conv_conf: Matched MODCTRL configuration of the ethernet port muxes
  */
 struct miic {
 	void __iomem *base;
@@ -205,6 +211,7 @@ struct miic {
 	struct reset_control_bulk_data rsts[MIIC_MAX_NUM_RSTS];
 	const struct miic_of_data *of_data;
 	struct miic_phy_link_cfg link_cfg;
+	const u8 *conv_conf;
 };
 
 enum miic_type {
@@ -230,6 +237,10 @@ enum miic_type {
  *  before access.
  * @miic_write: Function pointer to write a value to a MIIC register
  * @type: Type of MIIC
+ * @swctrl_conf_start: First configuration value of the switch ports whose
+ *  speed has to be selected through SWCTRL
+ * @swctrl_conf_count: Number of switch ports whose speed has to be selected
+ *  through SWCTRL, 0 if not needed
  */
 struct miic_of_data {
 	struct modctrl_match *match_table;
@@ -247,6 +258,8 @@ struct miic_of_data {
 	bool init_unlock_lock_regs;
 	void (*miic_write)(struct miic *miic, int offset, u32 value);
 	enum miic_type type;
+	u8 swctrl_conf_start;
+	u8 swctrl_conf_count;
 };
 
 /**
@@ -383,6 +396,27 @@ static int miic_config(struct phylink_pcs *pcs, unsigned int neg_mode,
 	return 0;
 }
 
+static void miic_swctrl_set_speed(struct miic *miic, int port, int speed)
+{
+	const struct miic_of_data *of_data = miic->of_data;
+	u8 conf = miic->conv_conf[port + 1];
+	u32 val = 0;
+	int sw_port;
+
+	if (conf < of_data->swctrl_conf_start ||
+	    conf >= of_data->swctrl_conf_start + of_data->swctrl_conf_count)
+		return;
+
+	sw_port = conf - of_data->swctrl_conf_start;
+
+	if (speed == SPEED_1000)
+		val = MIIC_SWCTRL_SET_SPEED_1000(sw_port);
+	else if (speed == SPEED_10)
+		val = MIIC_SWCTRL_SET_SPEED_10(sw_port);
+
+	miic_reg_rmw(miic, MIIC_SWCTRL, MIIC_SWCTRL_SET_SPEED_MASK(sw_port), val);
+}
+
 static void miic_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
 			 phy_interface_t interface, int speed, int duplex)
 {
@@ -415,6 +449,8 @@ static void miic_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
 
 	miic_reg_rmw(miic, MIIC_CONVCTRL(port),
 		     (MIIC_CONVCTRL_CONV_SPEED | MIIC_CONVCTRL_FULLD), val);
+
+	miic_swctrl_set_speed(miic, port, speed);
 }
 
 static int miic_pre_init(struct phylink_pcs *pcs)
@@ -544,9 +580,10 @@ static int miic_init_hw(struct miic *miic, u32 cfg_mode)
 
 	for (port = 0; port < num_ports; port++) {
 		miic_converter_enable(miic, port, 0);
-		/* Disable speed/duplex control from these registers, datasheet
-		 * says switch registers should be used to setup switch port
-		 * speed and duplex.
+		/* RZ/N1 port speed and duplex are configured through the
+		 * switch registers. On RZ/T2H, SWCTRL selects port speed and
+		 * is updated at link-up. Keep SWDUPC at 0 so duplex is
+		 * controlled through COMMAND_CONFIG_Pn.HD_ENA.
 		 */
 		miic_reg_writel(miic, MIIC_SWCTRL, 0x0);
 		miic_reg_writel(miic, MIIC_SWDUPC, 0x0);
@@ -599,6 +636,7 @@ static int miic_match_dt_conf(struct miic *miic, s8 *dt_val, u32 *mode_cfg)
 		if (miic_modctrl_match(table_entry->conv, dt_val,
 				       miic->of_data->conf_conv_count)) {
 			*mode_cfg = table_entry->mode_cfg;
+			miic->conv_conf = table_entry->conv;
 			return 0;
 		}
 	}
@@ -875,6 +913,8 @@ static struct miic_of_data rzt2h_miic_of_data = {
 	.reset_count = ARRAY_SIZE(rzt2h_reset_ids),
 	.miic_write = miic_reg_writel_locked,
 	.type = MIIC_TYPE_RZT2H,
+	.swctrl_conf_start = ETHSS_ETHSW_PORT0,
+	.swctrl_conf_count = 3,
 };
 
 static const struct of_device_id miic_of_mtable[] = {
-- 
2.56.1


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

* [PATCH net-next v6 05/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (3 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 04/15] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 06/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

dsa.yaml accepts either a "ports" or an "ethernet-ports" property. A
devicetree using "ports" therefore passes validation.

Replace the top-level unevaluatedProperties with additionalProperties
to reject the unsupported "ports". Also explicitly declare dsa,member
to keep existing devicetrees validating.

Also Add ethernet-ports to the required list.

Existing in-tree device trees use ethernet-ports, so they are unaffected.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-6-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added RB tag
v4: https://lore.kernel.org/all/20261104182105.1102555-5-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index fab6aa6237e9..9c477ceb170b 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -45,6 +45,8 @@ properties:
   power-domains:
     maxItems: 1
 
+  dsa,member: true
+
   mdio:
     $ref: /schemas/net/mdio.yaml#
     unevaluatedProperties: false
@@ -73,7 +75,7 @@ properties:
               phandle pointing to a PCS sub-node compatible with
               renesas,rzn1-miic.yaml#
 
-unevaluatedProperties: false
+additionalProperties: false
 
 required:
   - compatible
@@ -81,6 +83,7 @@ required:
   - clocks
   - clock-names
   - power-domains
+  - ethernet-ports
 
 examples:
   - |
-- 
2.56.1


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

* [PATCH net-next v6 06/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (4 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 05/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 07/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar, Krzysztof Kozlowski

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The A5PSW has four external ports and a CPU management port, using
port numbers from 0 to 4.

Previously, the patternProperties expression only matched port nodes
with unit addresses from 0 to 4. This allowed port nodes with other
unit addresses to bypass the port-specific schema constraints.

Update the pattern to match all port nodes and limit their reg values
to a maximum of 4. This ensures the constraint is applied regardless
of the unit address.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
v6:
  - Added reviewed-by tag
v5: https://lore.kernel.org/all/20261120002549.1908299-7-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml       | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 9c477ceb170b..30f25b06d62c 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -65,10 +65,12 @@ properties:
     type: object
     additionalProperties: true
     patternProperties:
-      "^(ethernet-)?port@[0-4]$":
+      "^(ethernet-)?port@":
         type: object
         additionalProperties: true
         properties:
+          reg:
+            maximum: 4
           pcs-handle:
             maxItems: 1
             description:
-- 
2.56.1


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

* [PATCH net-next v6 07/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (5 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 06/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 08/15] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Extend the A5PSW DSA binding to cover the ETHSW variant used on newer
Renesas RZ/T2H and RZ/N2H SoCs. ETHSW is derived from the A5PSW switch
found on RZ/N1 but differs in register layout, clocking and interrupt
topology, and exposes four ports in total (including the CPU/management
port) instead of five.

Update the schema to describe these differences by adding dedicated
compatible strings for RZ/T2H and RZ/N2H.

Use the RZ/T2H compatible string as the fallback for RZ/N2H, reflecting
that both SoCs integrate the same ETHSW IP.

Add myself as a co-maintainer of the binding to support ongoing work on
the ETHSW family across RZ/T2H and RZ/N2H devices.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-8-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Rebased the patch due to previous changes in the binding
  - Replaced the patternProperties expression for ethernet-ports
  - Set the maximum constraint for reg values on ethernet-ports
  - Restored the RB tag from Rob
v4: https://lore.kernel.org/all/20261104182105.1102555-7-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Restricted the reg property for ethernet-ports to maximum 3 for RZ/T2H
  - Added RB tag from Rob
v3: https://lore.kernel.org/all/20261014131906.990077-6-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added a restriction to disallow port@4
  - Updated commit message
v2: https://lore.kernel.org/all/20261001154326.754314-5-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added full names for SoCs
v1: https://lore.kernel.org/all/20251121113553.2955854-5-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  | 156 +++++++++++++++---
 1 file changed, 134 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 30f25b06d62c..c08729136176 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -4,43 +4,108 @@
 $id: http://devicetree.org/schemas/net/dsa/renesas,rzn1-a5psw.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Renesas RZ/N1 Advanced 5 ports ethernet switch
+title: Renesas RZ/N1 A5PSW and RZ/T2H, RZ/N2H ETHSW Ethernet Switch
 
 maintainers:
   - Clément Léger <clement.leger@bootlin.com>
+  - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
 
-description: |
-  The advanced 5 ports switch is present on the Renesas RZ/N1 SoC family and
-  handles 4 ports + 1 CPU management port.
+description: >
+  This binding describes the Ethernet switch IPs used on Renesas SoCs:
 
-allOf:
-  - $ref: dsa.yaml#/$defs/ethernet-ports
+  - The A5PSW (Advanced 5-Port Switch) found on the RZ/N1 family, which
+    provides 4 external ports and 1 CPU/management port.
+  - The ETHSW (Ethernet Switch) found on the RZ/T2H and RZ/N2H families,
+    which is derived from the A5PSW IP with some register layout
+    differences, additional timestamping support, and a total of 4 ports
+    including the CPU/management port.
 
 properties:
   compatible:
-    items:
-      - enum:
-          - renesas,r9a06g032-a5psw
-      - const: renesas,rzn1-a5psw
+    oneOf:
+      - items:
+          - enum:
+              - renesas,r9a06g032-a5psw
+          - const: renesas,rzn1-a5psw
+
+      - const: renesas,r9a09g077-ethsw
+
+      - items:
+          - const: renesas,r9a09g087-ethsw
+          - const: renesas,r9a09g077-ethsw
 
   reg:
     maxItems: 1
 
   interrupts:
-    items:
-      - description: Device Level Ring (DLR) interrupt
-      - description: Switch interrupt
-      - description: Parallel Redundancy Protocol (PRP) interrupt
-      - description: Integrated HUB module interrupt
-      - description: Receive Pattern Match interrupt
+    oneOf:
+      - items:
+          - description: Device Level Ring (DLR) interrupt
+          - description: Switch interrupt
+          - description: Parallel Redundancy Protocol (PRP) interrupt
+          - description: Integrated HUB module interrupt
+          - description: Receive Pattern Match interrupt
+
+      - items:
+          - description: Switch interrupt
+          - description: Device Level Ring (DLR) interrupt
+          - description: Parallel Redundancy Protocol (PRP) interrupt
+          - description: Integrated HUB module interrupt
+          - description: Receive Pattern Match interrupt 0
+          - description: Receive Pattern Match interrupt 1
+          - description: Receive Pattern Match interrupt 2
+          - description: Receive Pattern Match interrupt 3
+          - description: Receive Pattern Match interrupt 4
+          - description: Receive Pattern Match interrupt 5
+          - description: Receive Pattern Match interrupt 6
+          - description: Receive Pattern Match interrupt 7
+          - description: Receive Pattern Match interrupt 8
+          - description: Receive Pattern Match interrupt 9
+          - description: Receive Pattern Match interrupt 10
+          - description: Receive Pattern Match interrupt 11
+          - description: Switch timer pulse output interrupt 0
+          - description: Switch timer pulse output interrupt 1
+          - description: Switch timer pulse output interrupt 2
+          - description: Switch timer pulse output interrupt 3
+          - description: Switch TDMA timer output interrupt 0
+          - description: Switch TDMA timer output interrupt 1
+          - description: Switch TDMA timer output interrupt 2
+          - description: Switch TDMA timer output interrupt 3
 
   interrupt-names:
-    items:
-      - const: dlr
-      - const: switch
-      - const: prp
-      - const: hub
-      - const: ptrn
+    oneOf:
+      - items:
+          - const: dlr
+          - const: switch
+          - const: prp
+          - const: hub
+          - const: ptrn
+
+      - items:
+          - const: switch
+          - const: dlr
+          - const: prp
+          - const: hub
+          - const: ptrn0
+          - const: ptrn1
+          - const: ptrn2
+          - const: ptrn3
+          - const: ptrn4
+          - const: ptrn5
+          - const: ptrn6
+          - const: ptrn7
+          - const: ptrn8
+          - const: ptrn9
+          - const: ptrn10
+          - const: ptrn11
+          - const: tp0
+          - const: tp1
+          - const: tp2
+          - const: tp3
+          - const: tdma0
+          - const: tdma1
+          - const: tdma2
+          - const: tdma3
 
   power-domains:
     maxItems: 1
@@ -52,14 +117,21 @@ properties:
     unevaluatedProperties: false
 
   clocks:
+    minItems: 2
     items:
       - description: AHB clock used for the switch register interface
       - description: Switch system clock
+      - description: Timestamp clock
 
   clock-names:
+    minItems: 2
     items:
       - const: hclk
       - const: clk
+      - const: ts
+
+  resets:
+    maxItems: 1
 
   ethernet-ports:
     type: object
@@ -86,6 +158,46 @@ required:
   - clock-names
   - power-domains
   - ethernet-ports
+  - interrupts
+  - interrupt-names
+
+allOf:
+  - $ref: dsa.yaml#/$defs/ethernet-ports
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a09g077-ethsw
+    then:
+      properties:
+        interrupts:
+          minItems: 24
+        interrupt-names:
+          minItems: 24
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
+        ethernet-ports:
+          patternProperties:
+            "^(ethernet-)?port@":
+              properties:
+                reg:
+                  maximum: 3
+      required:
+        - resets
+    else:
+      properties:
+        interrupts:
+          maxItems: 5
+        interrupt-names:
+          maxItems: 5
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+        resets: false
 
 examples:
   - |
-- 
2.56.1


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

* [PATCH net-next v6 08/15] net: dsa: rzn1-a5psw: Add support for optional reset control
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (6 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 07/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 09/15] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add support for an optional reset control to the RZN1 A5PSW driver.
Obtain the reset line using
devm_reset_control_get_optional_exclusive_deasserted() during probe
to ensure that the Ethernet switch (ETHSW) block is properly released
from reset before initialization.

This change prepares the driver for use on Renesas RZ/T2H and RZ/N2H
SoCs, where the ETHSW IP block is connected to a dedicated reset line
that must be controlled by software.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-13-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v4: https://lore.kernel.org/all/20261104182105.1102555-8-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-7-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-6-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added RB tags
v1: https://lore.kernel.org/all/20251121113553.2955854-6-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 drivers/net/dsa/rzn1_a5psw.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 4925d24ec2a3..038b6b963761 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_mdio.h>
+#include <linux/reset.h>
 #include <net/dsa.h>
 
 #include "rzn1_a5psw.h"
@@ -1210,6 +1211,7 @@ static int a5psw_pcs_get(struct a5psw *a5psw)
 static int a5psw_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct reset_control *reset;
 	struct device_node *mdio;
 	struct dsa_switch *ds;
 	struct a5psw *a5psw;
@@ -1247,6 +1249,12 @@ static int a5psw_probe(struct platform_device *pdev)
 		goto free_pcs;
 	}
 
+	reset = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
+	if (IS_ERR(reset)) {
+		ret = PTR_ERR(reset);
+		goto free_pcs;
+	}
+
 	mdio = of_get_available_child_by_name(dev->of_node, "mdio");
 	if (mdio) {
 		ret = a5psw_probe_mdio(a5psw, mdio);
-- 
2.56.1


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

* [PATCH net-next v6 09/15] net: dsa: rzn1-a5psw: Add support for optional timestamp clock
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (7 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 08/15] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 10/15] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add support for an optional "ts" (timestamp) clock to the RZN1 A5PSW
driver. Some SoC variants provide a dedicated clock source for
timestamping or time synchronization features within the Ethernet
switch IP.

Request and enable this clock during probe if defined in the device tree.
If the clock is not present, the driver continues to operate normally.

This change prepares the driver for Renesas RZ/T2H and RZ/N2H SoCs, where
the Ethernet switch includes a timestamp clock input.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-14-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v4: https://lore.kernel.org/all/20261104182105.1102555-9-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-8-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-7-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v1: https://lore.kernel.org/all/20251121113553.2955854-7-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 drivers/net/dsa/rzn1_a5psw.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 038b6b963761..fef107c9627c 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1215,6 +1215,7 @@ static int a5psw_probe(struct platform_device *pdev)
 	struct device_node *mdio;
 	struct dsa_switch *ds;
 	struct a5psw *a5psw;
+	struct clk *ts;
 	int ret;
 
 	a5psw = devm_kzalloc_obj(dev, *a5psw);
@@ -1249,6 +1250,13 @@ static int a5psw_probe(struct platform_device *pdev)
 		goto free_pcs;
 	}
 
+	ts = devm_clk_get_optional_enabled(dev, "ts");
+	if (IS_ERR(ts)) {
+		ret = PTR_ERR(ts);
+		dev_err_probe(dev, ret, "failed get ts clock\n");
+		goto free_pcs;
+	}
+
 	reset = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
 	if (IS_ERR(reset)) {
 		ret = PTR_ERR(reset);
-- 
2.56.1


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

* [PATCH net-next v6 10/15] net: dsa: rzn1-a5psw: Make use dev_err_probe()
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (8 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 09/15] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 11/15] net: dsa: rzn1-a5psw: Get switch configuration from OF data Prabhakar
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Replace dev_err() with dev_err_probe() when reporting failures from
devm_clk_get_enabled(). Clock retrieval may legitimately return
-EPROBE_DEFER, and the current use of dev_err() incorrectly reports
such cases as hard errors.

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Clément Léger <clement.leger@linux.dev>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-15-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added reviewed-by tag
v4: https://lore.kernel.org/all/20261104182105.1102555-10-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-9-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-8-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index fef107c9627c..679242c1a8be 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1238,15 +1238,15 @@ static int a5psw_probe(struct platform_device *pdev)
 
 	a5psw->hclk = devm_clk_get_enabled(dev, "hclk");
 	if (IS_ERR(a5psw->hclk)) {
-		dev_err(dev, "failed get hclk clock\n");
 		ret = PTR_ERR(a5psw->hclk);
+		dev_err_probe(dev, ret, "failed get hclk clock\n");
 		goto free_pcs;
 	}
 
 	a5psw->clk = devm_clk_get_enabled(dev, "clk");
 	if (IS_ERR(a5psw->clk)) {
-		dev_err(dev, "failed get clk_switch clock\n");
 		ret = PTR_ERR(a5psw->clk);
+		dev_err_probe(dev, ret, "failed get clk_switch clock\n");
 		goto free_pcs;
 	}
 
-- 
2.56.1


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

* [PATCH net-next v6 11/15] net: dsa: rzn1-a5psw: Get switch configuration from OF data
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (9 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 10/15] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The driver hardcodes the switch port topology and uses a fixed DSA tag
protocol. Store the number of ports, number of PCS instances, CPU port
and tag protocol in per-SoC OF match data, and use those values in the
driver.

This allows variants with different port layouts or tag protocols to
use the driver while preserving the existing RZ/N1 configuration.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Clément Léger <clement.leger@linux.dev>
---
v6:
  - Squashed patch #15 and #16 from v5 to limit the number of patches
  - Updated the commit message
  - Added reviewed-by tag
v5: https://lore.kernel.org/all/20261120002549.1908299-16-prabhakar.mahadev-lad.rj@bp.renesas.com/
    https://lore.kernel.org/all/20261120002549.1908299-17-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 36 ++++++++++++++++++++++++++----------
 drivers/net/dsa/rzn1_a5psw.h | 22 +++++++++++++++++++---
 2 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 679242c1a8be..a768b0545e02 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -99,7 +99,9 @@ static enum dsa_tag_protocol a5psw_get_tag_protocol(struct dsa_switch *ds,
 						    int port,
 						    enum dsa_tag_protocol mp)
 {
-	return DSA_TAG_PROTO_RZN1_A5PSW;
+	struct a5psw *a5psw = ds->priv;
+
+	return a5psw->of_data->tag_proto;
 }
 
 static void a5psw_port_pattern_set(struct a5psw *a5psw, int port, int pattern,
@@ -390,13 +392,14 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port,
 				    struct dsa_bridge bridge)
 {
 	struct a5psw *a5psw = ds->priv;
+	unsigned int cpu_port = a5psw->of_data->cpu_port;
 
 	a5psw->bridged_ports &= ~BIT(port);
 
 	a5psw_port_set_standalone(a5psw, port, true);
 
 	/* No more ports bridged */
-	if (a5psw->bridged_ports == BIT(A5PSW_CPU_PORT))
+	if (a5psw->bridged_ports == BIT(cpu_port))
 		a5psw->br_dev = NULL;
 }
 
@@ -928,20 +931,21 @@ static void a5psw_vlan_setup(struct a5psw *a5psw, int port)
 static int a5psw_setup(struct dsa_switch *ds)
 {
 	struct a5psw *a5psw = ds->priv;
+	unsigned int cpu_port = a5psw->of_data->cpu_port;
 	int port, vlan, ret;
 	struct dsa_port *dp;
 	u32 reg;
 
-	/* Validate that there is only 1 CPU port with index A5PSW_CPU_PORT */
+	/* Validate that there is only 1 CPU port with index matching cpu_port */
 	dsa_switch_for_each_cpu_port(dp, ds) {
-		if (dp->index != A5PSW_CPU_PORT) {
+		if (dp->index != cpu_port) {
 			dev_err(a5psw->dev, "Invalid CPU port\n");
 			return -EINVAL;
 		}
 	}
 
 	/* Configure management port */
-	reg = A5PSW_CPU_PORT | A5PSW_MGMT_CFG_ENABLE;
+	reg = cpu_port | A5PSW_MGMT_CFG_ENABLE;
 	a5psw_reg_writel(a5psw, A5PSW_MGMT_CFG, reg);
 
 	/* Set pattern 0 to forward all frame to mgmt port */
@@ -1152,7 +1156,7 @@ static void a5psw_pcs_free(struct a5psw *a5psw)
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(a5psw->pcs); i++) {
+	for (i = 0; i < a5psw->of_data->npcs; i++) {
 		if (a5psw->pcs[i])
 			miic_destroy(a5psw->pcs[i]);
 	}
@@ -1179,7 +1183,7 @@ static int a5psw_pcs_get(struct a5psw *a5psw)
 			goto free_pcs;
 		}
 
-		if (reg >= ARRAY_SIZE(a5psw->pcs)) {
+		if (reg >= a5psw->of_data->npcs) {
 			ret = -ENODEV;
 			goto free_pcs;
 		}
@@ -1226,11 +1230,16 @@ static int a5psw_probe(struct platform_device *pdev)
 	a5psw->dev = dev;
 	mutex_init(&a5psw->lk_lock);
 	spin_lock_init(&a5psw->reg_lock);
+
+	a5psw->of_data = of_device_get_match_data(dev);
+	if (!a5psw->of_data)
+		return -ENODEV;
+
 	a5psw->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(a5psw->base))
 		return PTR_ERR(a5psw->base);
 
-	a5psw->bridged_ports = BIT(A5PSW_CPU_PORT);
+	a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
 
 	ret = a5psw_pcs_get(a5psw);
 	if (ret)
@@ -1275,7 +1284,7 @@ static int a5psw_probe(struct platform_device *pdev)
 
 	ds = &a5psw->ds;
 	ds->dev = dev;
-	ds->num_ports = A5PSW_PORTS_NUM;
+	ds->num_ports = a5psw->of_data->nports;
 	ds->ops = &a5psw_switch_ops;
 	ds->phylink_mac_ops = &a5psw_phylink_mac_ops;
 	ds->priv = a5psw;
@@ -1317,8 +1326,15 @@ static void a5psw_shutdown(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 }
 
+static const struct a5psw_of_data rzn1_of_data = {
+	.nports = 5,
+	.npcs = 4,
+	.cpu_port = 4,
+	.tag_proto = DSA_TAG_PROTO_RZN1_A5PSW,
+};
+
 static const struct of_device_id a5psw_of_mtable[] = {
-	{ .compatible = "renesas,rzn1-a5psw", },
+	{ .compatible = "renesas,rzn1-a5psw", .data = &rzn1_of_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, a5psw_of_mtable);
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index 9693f8503b0b..58690f5f3887 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -195,8 +195,8 @@
 #define A5PSW_aCarrierSenseErrors		0x924
 
 #define A5PSW_VLAN_TAG(prio, id)	(((prio) << 12) | (id))
-#define A5PSW_PORTS_NUM			5
-#define A5PSW_CPU_PORT			(A5PSW_PORTS_NUM - 1)
+/* Maximum number of PCS instances (excludes CPU port) */
+#define A5PSW_MAX_NUM_PCS			4
 #define A5PSW_MDIO_DEF_FREQ		2500000
 #define A5PSW_MDIO_TIMEOUT		100
 #define A5PSW_JUMBO_LEN			(10 * SZ_1K)
@@ -231,12 +231,27 @@ union lk_data {
 	struct fdb_entry entry;
 };
 
+/**
+ * struct a5psw_of_data - OF data structure
+ * @nports: Number of ports in the switch
+ * @npcs: Number of PCS connected to the switch
+ * @cpu_port: CPU port number
+ * @tag_proto: DSA tag protocol used by the switch
+ */
+struct a5psw_of_data {
+	unsigned int nports;
+	unsigned int npcs;
+	unsigned int cpu_port;
+	enum dsa_tag_protocol tag_proto;
+};
+
 /**
  * struct a5psw - switch struct
  * @base: Base address of the switch
  * @hclk: hclk_switch clock
  * @clk: clk_switch clock
  * @dev: Device associated to the switch
+ * @of_data: Pointer to OF data
  * @mii_bus: MDIO bus struct
  * @mdio_freq: MDIO bus frequency requested
  * @pcs: Array of PCS connected to the switch ports (not for the CPU)
@@ -252,8 +267,9 @@ struct a5psw {
 	struct clk *hclk;
 	struct clk *clk;
 	struct device *dev;
+	const struct a5psw_of_data *of_data;
 	struct mii_bus	*mii_bus;
-	struct phylink_pcs *pcs[A5PSW_PORTS_NUM - 1];
+	struct phylink_pcs *pcs[A5PSW_MAX_NUM_PCS];
 	struct dsa_switch ds;
 	struct mutex lk_lock;
 	spinlock_t reg_lock;
-- 
2.56.1


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

* [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (10 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 11/15] net: dsa: rzn1-a5psw: Get switch configuration from OF data Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:42   ` Clement Leger
  2026-12-02  9:33 ` [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data Prabhakar
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The ETHSW IP used in SoCs such as RZ/T2H and RZ/N2H has a hardware issue
where the internal mgmt_tag_vld signal is asserted as a level instead of
a single-cycle pulse. This causes the frame length counter on the
management (CPU) port to over-increment, so valid frames are falsely
detected as oversized and dropped.

The recommended workaround is to program the maximum frame length
register (FRM_LENGTH) of the management port with a fixed, large value.

Add a management_port_fixed_frame_len member to struct a5psw_of_data to
hold the SoC-specific value. When it is set, program A5PSW_FRM_LENGTH
for the CPU port with this value in a5psw_setup(), and skip updating
FRM_LENGTH for the CPU port in a5psw_port_change_mtu() so that MTU
changes do not override the workaround.

No functional change for existing SoCs, which leave the value unset.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - No change
v5: https://lore.kernel.org/all/20261120002549.1908299-18-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v4: https://lore.kernel.org/all/20261104182105.1102555-13-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-12-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Marked of_data as const pointer to avoid build warning
v2: https://lore.kernel.org/all/20261001154326.754314-11-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added info about the IP issue and the workaround.
  - Updated commit message
v1: https://lore.kernel.org/all/20251121113553.2955854-10-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 drivers/net/dsa/rzn1_a5psw.c | 17 ++++++++++++++++-
 drivers/net/dsa/rzn1_a5psw.h |  3 +++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index a768b0545e02..05753538c5ed 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -217,6 +217,10 @@ static int a5psw_port_enable(struct dsa_switch *ds, int port,
 static int a5psw_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
 {
 	struct a5psw *a5psw = ds->priv;
+	const struct a5psw_of_data *of_data = a5psw->of_data;
+
+	if (dsa_is_cpu_port(ds, port) && of_data->management_port_fixed_frame_len)
+		return 0;
 
 	new_mtu += ETH_HLEN + A5PSW_EXTRA_MTU_LEN + ETH_FCS_LEN;
 	a5psw_reg_writel(a5psw, A5PSW_FRM_LENGTH(port), new_mtu);
@@ -993,8 +997,19 @@ static int a5psw_setup(struct dsa_switch *ds)
 		if (dsa_port_is_unused(dp))
 			continue;
 
-		/* Enable egress flooding and learning for CPU port */
 		if (dsa_port_is_cpu(dp)) {
+			/*
+			 * Workaround for ETHSW IP issue, mgmt_tag_vld is asserted as a level
+			 * instead of a single-cycle pulse, causing the frame length counter
+			 * to over-increment and trigger false oversize frame drops.
+			 * The recommended workaround is to set the maximum frame
+			 * length on the management port.
+			 */
+			if (a5psw->of_data->management_port_fixed_frame_len)
+				a5psw_reg_writel(a5psw, A5PSW_FRM_LENGTH(port),
+						 a5psw->of_data->management_port_fixed_frame_len);
+
+			/* Enable egress flooding and learning for CPU port */
 			a5psw_flooding_set_resolution(a5psw, port, true);
 			a5psw_port_learning_set(a5psw, port, true);
 		}
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index 58690f5f3887..942931cbc402 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -237,12 +237,15 @@ union lk_data {
  * @npcs: Number of PCS connected to the switch
  * @cpu_port: CPU port number
  * @tag_proto: DSA tag protocol used by the switch
+ * @management_port_fixed_frame_len: Fixed frame length for the management
+ *   port to account for the HW issue.
  */
 struct a5psw_of_data {
 	unsigned int nports;
 	unsigned int npcs;
 	unsigned int cpu_port;
 	enum dsa_tag_protocol tag_proto;
+	unsigned int management_port_fixed_frame_len;
 };
 
 /**
-- 
2.56.1


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

* [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (11 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:37   ` Clement Leger
  2026-12-02  9:33 ` [PATCH net-next v6 14/15] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

RZ/T2H and RZ/N2H differ from RZ/N1 in the RX pattern matcher register
offsets, VLAN_RES field layout and lookup table size. Move these
properties into per-SoC OF match data and use them when accessing the
pattern matcher, VLAN entries and lookup table.

Keep the existing RZ/N1 values in its match data.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - Squashed patches #18, #19 and #20 from v5 to limit the number
    of patches
  - Updated the commit message
  - Dropped reviewed-by tag as patches were squashed and patch #20 wasnt
    reviewed
v5: https://lore.kernel.org/all/20261120002549.1908299-16-prabhakar.mahadev-lad.rj@bp.renesas.com/
    https://lore.kernel.org/all/20261120002549.1908299-20-prabhakar.mahadev-lad.rj@bp.renesas.com/
    https://lore.kernel.org/all/20261120002549.1908299-21-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 29 ++++++++++++++++++++---------
 drivers/net/dsa/rzn1_a5psw.h | 18 ++++++++++++------
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 05753538c5ed..03d7f928e3e6 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -112,7 +112,9 @@ static void a5psw_port_pattern_set(struct a5psw *a5psw, int port, int pattern,
 	if (enable)
 		rx_match |= A5PSW_RXMATCH_CONFIG_PATTERN(pattern);
 
-	a5psw_reg_rmw(a5psw, A5PSW_RXMATCH_CONFIG(port),
+	a5psw_reg_rmw(a5psw,
+		      A5PSW_RXMATCH_CONFIG(a5psw->of_data->rxmatch_config_base,
+					   port),
 		      A5PSW_RXMATCH_CONFIG_PATTERN(pattern), rx_match);
 }
 
@@ -315,18 +317,19 @@ static void a5psw_phylink_mac_link_up(struct phylink_config *config,
 static int a5psw_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
 {
 	struct a5psw *a5psw = ds->priv;
+	unsigned int entries = a5psw->of_data->lk_table_entries;
 	unsigned long rate;
 	u64 max, tmp;
 	u32 agetime;
 
 	rate = clk_get_rate(a5psw->clk);
-	max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * A5PSW_TABLE_ENTRIES * 1024),
+	max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * entries * 1024),
 		       rate) * 1000;
 	if (msecs > max)
 		return -EINVAL;
 
 	tmp = div_u64(rate, MSEC_PER_SEC);
-	agetime = div_u64(msecs * tmp, 1024 * A5PSW_TABLE_ENTRIES);
+	agetime = div_u64(msecs * tmp, 1024 * entries);
 
 	a5psw_reg_writel(a5psw, A5PSW_LK_AGETIME, agetime);
 
@@ -515,7 +518,7 @@ static int a5psw_lk_execute_lookup(struct a5psw *a5psw, union lk_data *lk_data,
 	if (ret)
 		return ret;
 
-	*entry = ctrl & A5PSW_LK_ADDR_CTRL_ADDRESS;
+	*entry = ctrl & (a5psw->of_data->lk_table_entries - 1);
 
 	return 0;
 }
@@ -636,7 +639,7 @@ static int a5psw_port_fdb_dump(struct dsa_switch *ds, int port,
 
 	mutex_lock(&a5psw->lk_lock);
 
-	for (i = 0; i < A5PSW_TABLE_ENTRIES; i++) {
+	for (i = 0; i < a5psw->of_data->lk_table_entries; i++) {
 		reg = A5PSW_LK_ADDR_CTRL_READ | A5PSW_LK_ADDR_CTRL_WAIT | i;
 
 		ret = a5psw_lk_execute_ctrl(a5psw, &reg);
@@ -689,7 +692,7 @@ static int a5psw_find_vlan_entry(struct a5psw *a5psw, u16 vid)
 	/* Find vlan for this port */
 	for (i = 0; i < A5PSW_VLAN_COUNT; i++) {
 		vlan_res = a5psw_reg_readl(a5psw, A5PSW_VLAN_RES(i));
-		if (FIELD_GET(A5PSW_VLAN_RES_VLANID, vlan_res) == vid)
+		if (field_get(a5psw->of_data->vlan_res_vlanid, vlan_res) == vid)
 			return i;
 	}
 
@@ -704,8 +707,9 @@ static int a5psw_new_vlan_res_entry(struct a5psw *a5psw, u16 newvid)
 	/* Find a free VLAN entry */
 	for (i = 0; i < A5PSW_VLAN_COUNT; i++) {
 		vlan_res = a5psw_reg_readl(a5psw, A5PSW_VLAN_RES(i));
-		if (!(FIELD_GET(A5PSW_VLAN_RES_PORTMASK, vlan_res))) {
-			vlan_res = FIELD_PREP(A5PSW_VLAN_RES_VLANID, newvid);
+		if (!field_get(a5psw->of_data->vlan_res_portmask, vlan_res)) {
+			vlan_res = field_prep(a5psw->of_data->vlan_res_vlanid,
+					      newvid);
 			a5psw_reg_writel(a5psw, A5PSW_VLAN_RES(i), vlan_res);
 			return i;
 		}
@@ -953,7 +957,9 @@ static int a5psw_setup(struct dsa_switch *ds)
 	a5psw_reg_writel(a5psw, A5PSW_MGMT_CFG, reg);
 
 	/* Set pattern 0 to forward all frame to mgmt port */
-	a5psw_reg_writel(a5psw, A5PSW_PATTERN_CTRL(A5PSW_PATTERN_MGMTFWD),
+	a5psw_reg_writel(a5psw,
+			 A5PSW_PATTERN_CTRL(a5psw->of_data->pattern_ctrl_base,
+					    A5PSW_PATTERN_MGMTFWD),
 			 A5PSW_PATTERN_CTRL_MGMTFWD);
 
 	/* Enable port tagging */
@@ -1346,6 +1352,11 @@ static const struct a5psw_of_data rzn1_of_data = {
 	.npcs = 4,
 	.cpu_port = 4,
 	.tag_proto = DSA_TAG_PROTO_RZN1_A5PSW,
+	.rxmatch_config_base = 0x3e80,
+	.pattern_ctrl_base = 0x3eb0,
+	.vlan_res_vlanid = GENMASK(16, 5),
+	.vlan_res_portmask = GENMASK(4, 0),
+	.lk_table_entries = 8192,
 };
 
 static const struct of_device_id a5psw_of_mtable[] = {
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index 942931cbc402..fd523fe7bf47 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -71,13 +71,11 @@
 #define A5PSW_VLAN_RES_WR_PORTMASK	BIT(30)
 #define A5PSW_VLAN_RES_WR_TAGMASK	BIT(29)
 #define A5PSW_VLAN_RES_RD_TAGMASK	BIT(28)
-#define A5PSW_VLAN_RES_VLANID		GENMASK(16, 5)
-#define A5PSW_VLAN_RES_PORTMASK		GENMASK(4, 0)
 
-#define A5PSW_RXMATCH_CONFIG(port)	(0x3e80 + 4 * (port))
+#define A5PSW_RXMATCH_CONFIG(base, port)	((base) + 4 * (port))
 #define A5PSW_RXMATCH_CONFIG_PATTERN(p)	BIT(p)
 
-#define A5PSW_PATTERN_CTRL(p)		(0x3eb0 + 4  * (p))
+#define A5PSW_PATTERN_CTRL(base, p)	((base) + 4 * (p))
 #define A5PSW_PATTERN_CTRL_MGMTFWD	BIT(1)
 
 #define A5PSW_LK_CTRL		0x400
@@ -95,7 +93,6 @@
 #define A5PSW_LK_ADDR_CTRL_WAIT		BIT(27)
 #define A5PSW_LK_ADDR_CTRL_READ		BIT(26)
 #define A5PSW_LK_ADDR_CTRL_WRITE	BIT(25)
-#define A5PSW_LK_ADDR_CTRL_ADDRESS	GENMASK(12, 0)
 
 #define A5PSW_LK_DATA_LO		0x40C
 #define A5PSW_LK_DATA_HI		0x410
@@ -212,7 +209,6 @@
 
 #define A5PSW_LK_BUSY_USEC_POLL		10
 #define A5PSW_CTRL_TIMEOUT		1000
-#define A5PSW_TABLE_ENTRIES		8192
 
 struct fdb_entry {
 	u8 mac[ETH_ALEN];
@@ -239,6 +235,11 @@ union lk_data {
  * @tag_proto: DSA tag protocol used by the switch
  * @management_port_fixed_frame_len: Fixed frame length for the management
  *   port to account for the HW issue.
+ * @rxmatch_config_base: Offset of the RXMATCH_CONFIG register of port 0
+ * @pattern_ctrl_base: Offset of the PATTERN_CTRL register of pattern 0
+ * @vlan_res_vlanid: VLANID field mask of the VLAN_RES registers
+ * @vlan_res_portmask: PORTMASK field mask of the VLAN_RES registers
+ * @lk_table_entries: Number of entries in the lookup table (power of 2)
  */
 struct a5psw_of_data {
 	unsigned int nports;
@@ -246,6 +247,11 @@ struct a5psw_of_data {
 	unsigned int cpu_port;
 	enum dsa_tag_protocol tag_proto;
 	unsigned int management_port_fixed_frame_len;
+	u16 rxmatch_config_base;
+	u16 pattern_ctrl_base;
+	u32 vlan_res_vlanid;
+	u32 vlan_res_portmask;
+	unsigned int lk_table_entries;
 };
 
 /**
-- 
2.56.1


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

* [PATCH net-next v6 14/15] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (12 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:33 ` [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
  2026-12-02  9:40 ` [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs netdev-bot+sinfo
  15 siblings, 0 replies; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The RZ/T2H and RZ/N2H hardware manual requires
COMMAND_CONFIG_Pn.TX_ENA to remain set. Clearing this bit during
link-down handling or indirectly through CMD_CFG.SW_RESET during
setup violates this restriction.

Keep the MAC TX enable bit set and use PORT_ENA.TXENA to gate port
transmission instead. During setup, explicitly set TX_ENA while
disabling RX_ENA, so the invariant does not depend on the hardware
reset value. Account for both the administrative/STP state and link
state when updating PORT_ENA.TXENA, so that a link-up event does not
re-enable transmission on a port blocked by STP. Keep the CPU port
independent of link state.

Avoid CMD_CFG.SW_RESET during setup, as it also clears TX_ENA.
Since SW_RESET is also responsible for clearing the statistics
counters, pulse the switch reset line during probe to ensure the
hardware starts from a clean state.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - Added comment about TX_ENA being kept set on RZ/T2H
    of patches
  - In a5psw_setup, explicitly set TX_ENA while disabling RX_ENA
v5: https://lore.kernel.org/all/20261120002549.1908299-23-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 87 +++++++++++++++++++++++++++++++-----
 drivers/net/dsa/rzn1_a5psw.h |  8 ++++
 2 files changed, 83 insertions(+), 12 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 03d7f928e3e6..e4fd4425f52e 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -133,11 +133,20 @@ static void a5psw_set_learncount(struct a5psw *a5psw, u32 mode)
 			 FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE, mode));
 }
 
-static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool enable)
+/* Must be called with reg_lock held */
+static void a5psw_port_tx_update(struct a5psw *a5psw, int port)
 {
 	u32 mask = A5PSW_PORT_ENA_TX(port);
-	u32 reg = enable ? mask : 0;
+	u32 reg;
 
+	reg = a5psw_reg_readl(a5psw, A5PSW_PORT_ENA) & ~mask;
+	if (a5psw->tx_allowed & a5psw->link_up & BIT(port))
+		reg |= mask;
+	a5psw_reg_writel(a5psw, A5PSW_PORT_ENA, reg);
+}
+
+static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool enable)
+{
 	/* Even though the port TX is disabled through TXENA bit in the
 	 * PORT_ENA register, it can still send BPDUs. This depends on the tag
 	 * configuration added when sending packets from the CPU port to the
@@ -146,18 +155,38 @@ static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool enable)
 	 * This allows to implement STP support when ports are in a state where
 	 * forwarding traffic should be stopped but BPDUs should still be sent.
 	 */
-	a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, mask, reg);
+	spin_lock(&a5psw->reg_lock);
+
+	if (enable)
+		a5psw->tx_allowed |= BIT(port);
+	else
+		a5psw->tx_allowed &= ~BIT(port);
+
+	a5psw_port_tx_update(a5psw, port);
+
+	spin_unlock(&a5psw->reg_lock);
 }
 
-static void a5psw_port_enable_set(struct a5psw *a5psw, int port, bool enable)
+static void a5psw_port_link_set(struct a5psw *a5psw, int port, bool up)
 {
-	u32 port_ena = 0;
+	spin_lock(&a5psw->reg_lock);
 
-	if (enable)
-		port_ena |= A5PSW_PORT_ENA_TX_RX(port);
+	if (up)
+		a5psw->link_up |= BIT(port);
+	else
+		a5psw->link_up &= ~BIT(port);
+
+	a5psw_port_tx_update(a5psw, port);
 
-	a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, A5PSW_PORT_ENA_TX_RX(port),
-		      port_ena);
+	spin_unlock(&a5psw->reg_lock);
+}
+
+static void a5psw_port_enable_set(struct a5psw *a5psw, int port, bool enable)
+{
+	u32 rx_mask = BIT(port + A5PSW_PORT_ENA_RX_SHIFT);
+
+	a5psw_reg_rmw(a5psw, A5PSW_PORT_ENA, rx_mask, enable ? rx_mask : 0);
+	a5psw_port_tx_enable(a5psw, port, enable);
 }
 
 static int a5psw_lk_execute_ctrl(struct a5psw *a5psw, u32 *ctrl)
@@ -283,6 +312,15 @@ static void a5psw_phylink_mac_link_down(struct phylink_config *config,
 	int port = dp->index;
 	u32 cmd_cfg;
 
+	if (a5psw->of_data->keep_mac_tx_enabled) {
+		if (dsa_port_is_user(dp))
+			a5psw_port_link_set(a5psw, port, false);
+
+		a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
+			      A5PSW_CMD_CFG_RX_ENA, 0);
+		return;
+	}
+
 	cmd_cfg = a5psw_reg_readl(a5psw, A5PSW_CMD_CFG(port));
 	cmd_cfg &= ~(A5PSW_CMD_CFG_RX_ENA | A5PSW_CMD_CFG_TX_ENA);
 	a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port), cmd_cfg);
@@ -312,6 +350,9 @@ static void a5psw_phylink_mac_link_up(struct phylink_config *config,
 		cmd_cfg &= ~A5PSW_CMD_CFG_PAUSE_IGNORE;
 
 	a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(dp->index), cmd_cfg);
+
+	if (a5psw->of_data->keep_mac_tx_enabled && dsa_port_is_user(dp))
+		a5psw_port_link_set(a5psw, dp->index, true);
 }
 
 static int a5psw_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
@@ -993,9 +1034,24 @@ static int a5psw_setup(struct dsa_switch *ds)
 	dsa_switch_for_each_port(dp, ds) {
 		port = dp->index;
 
-		/* Reset the port */
-		a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
-				 A5PSW_CMD_CFG_SW_RESET);
+		/* Gate TX on link state only for user ports */
+		if (!a5psw->of_data->keep_mac_tx_enabled || !dsa_port_is_user(dp))
+			a5psw->link_up |= BIT(port);
+
+		/*
+		 * Writing CMD_CFG = SW_RESET also writes TX_ENA as 0, which
+		 * must never happen on some SoCs. Their switch is reset through
+		 * its reset line in probe, so the statistics are already
+		 * cleared; only disable the MAC receive path and make sure
+		 * TX_ENA is set.
+		 */
+		if (a5psw->of_data->keep_mac_tx_enabled)
+			a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
+				      A5PSW_CMD_CFG_RX_ENA | A5PSW_CMD_CFG_TX_ENA,
+				      A5PSW_CMD_CFG_TX_ENA);
+		else
+			a5psw_reg_writel(a5psw, A5PSW_CMD_CFG(port),
+					 A5PSW_CMD_CFG_SW_RESET);
 
 		/* Enable only CPU port */
 		a5psw_port_enable_set(a5psw, port, dsa_port_is_cpu(dp));
@@ -1293,6 +1349,13 @@ static int a5psw_probe(struct platform_device *pdev)
 		goto free_pcs;
 	}
 
+	/* The bootloader may have used the switch, start from reset state */
+	ret = reset_control_reset(reset);
+	if (ret) {
+		dev_err(dev, "Failed to reset switch: %d\n", ret);
+		goto free_pcs;
+	}
+
 	mdio = of_get_available_child_by_name(dev->of_node, "mdio");
 	if (mdio) {
 		ret = a5psw_probe_mdio(a5psw, mdio);
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index fd523fe7bf47..3ff76c32e5a4 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -240,6 +240,9 @@ union lk_data {
  * @vlan_res_vlanid: VLANID field mask of the VLAN_RES registers
  * @vlan_res_portmask: PORTMASK field mask of the VLAN_RES registers
  * @lk_table_entries: Number of entries in the lookup table (power of 2)
+ * @keep_mac_tx_enabled: The MAC transmit path (CMD_CFG.TX_ENA) must never be
+ *   disabled, so ports are not reset with CMD_CFG.SW_RESET. Port transmission
+ *   is instead gated through PORT_ENA on link down.
  */
 struct a5psw_of_data {
 	unsigned int nports;
@@ -252,6 +255,7 @@ struct a5psw_of_data {
 	u32 vlan_res_vlanid;
 	u32 vlan_res_portmask;
 	unsigned int lk_table_entries;
+	bool keep_mac_tx_enabled;
 };
 
 /**
@@ -268,6 +272,8 @@ struct a5psw_of_data {
  * @stats_lock: lock to access statistics (shared HI counter)
  * @lk_lock: Lock for the lookup table
  * @reg_lock: Lock for register read-modify-write operation
+ * @tx_allowed: Mask of ports with TX allowed by the port and STP state
+ * @link_up: Mask of ports whose link is up, or which are not link gated
  * @bridged_ports: Mask of ports that are bridged and should be flooded
  * @br_dev: Bridge net device
  */
@@ -282,6 +288,8 @@ struct a5psw {
 	struct dsa_switch ds;
 	struct mutex lk_lock;
 	spinlock_t reg_lock;
+	u32 tx_allowed;
+	u32 link_up;
 	u32 bridged_ports;
 	struct net_device *br_dev;
 };
-- 
2.56.1


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

* [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (13 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 14/15] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
@ 2026-12-02  9:33 ` Prabhakar
  2026-12-02  9:38   ` Clement Leger
  2026-12-02  9:40 ` [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs netdev-bot+sinfo
  15 siblings, 1 reply; 21+ messages in thread
From: Prabhakar @ 2026-12-02  9:33 UTC (permalink / raw)
  To: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add OF match data for the Ethernet switch (ETHSW) found on the Renesas
RZ/T2H SoC. The ETHSW is based on the same A5PSW IP as the RZ/N1, but
has a different port configuration and register layout.

Configure the driver for the RZ/T2H variant with:
- 4 ports (3 external and 1 management), with the management port
  at port 3.
- DSA_TAG_PROTO_RZT2H_ETHSW tagging protocol.
- A fixed management port frame length of 0x3fff.
- Pattern matcher register offsets of 0x3f00 and 0x3f40.
- VLAN_RES fields using VLANID[15:4] and PORTMASK[3:0].
- 4096 lookup table entries.
- Keep MAC TX enabled, gating transmission through PORT_ENA.TXENA.

Add the renesas,r9a09g077-ethsw compatible string to the OF match
table. The RZ/N2H SoC uses this compatible as a fallback.

Update the Kconfig prompt and help text to reflect support for the
RZ/T2H and RZ/N2H ETHSW variants.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
  - Squashed patches #21 and #24 to limit the number of patches in the series
  - Updated commit message
v5: https://lore.kernel.org/all/20261120002549.1908299-24-prabhakar.mahadev-lad.rj@bp.renesas.com/
    https://lore.kernel.org/all/20261120002549.1908299-25-prabhakar.mahadev-lad.rj@bp.renesas.com/
    https://lore.kernel.org/all/20261120002549.1908299-22-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v4: https://lore.kernel.org/all/20261104182105.1102555-14-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v3: https://lore.kernel.org/all/20261014131906.990077-13-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - No change
v2: https://lore.kernel.org/all/20261001154326.754314-12-prabhakar.mahadev-lad.rj@bp.renesas.com/
  - Added reviewed-by tag
v1: https://lore.kernel.org/all/20251121113553.2955854-11-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
 drivers/net/dsa/Kconfig      |  9 +++++----
 drivers/net/dsa/rzn1_a5psw.c | 20 ++++++++++++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index d62f0cccf13d..5af8bc1a4dce 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -103,13 +103,14 @@ source "drivers/net/dsa/xrs700x/Kconfig"
 source "drivers/net/dsa/realtek/Kconfig"
 
 config NET_DSA_RZN1_A5PSW
-	tristate "Renesas RZ/N1 A5PSW Ethernet switch support"
-	depends on OF && (ARCH_RZN1 || COMPILE_TEST)
+	tristate "Renesas RZ/N1 A5PSW and RZ/{T2H,N2H} ETHSW Ethernet switch support"
+	depends on OF && (ARCH_RENESAS || COMPILE_TEST)
 	select NET_DSA_TAG_RZN1_A5PSW
 	select PCS_RZN1_MIIC
 	help
-	  This driver supports the A5PSW switch, which is embedded in Renesas
-	  RZ/N1 SoC.
+	  This driver supports the Advanced 5-Port Switch (A5PSW) found on
+	  Renesas RZ/N1 SoCs, and the Ethernet Switch (ETHSW) found on
+	  Renesas RZ/T2H and RZ/N2H SoCs.
 
 config NET_DSA_KS8995
 	tristate "Micrel KS8995 family 5-ports 10/100 Ethernet switches"
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index e4fd4425f52e..3114268e009c 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -272,8 +272,9 @@ static void a5psw_phylink_get_caps(struct dsa_switch *ds, int port,
 	config->mac_capabilities = MAC_1000FD;
 
 	if (dsa_is_cpu_port(ds, port)) {
-		/* GMII is used internally and GMAC2 is connected to the switch
-		 * using 1000Mbps Full-Duplex mode only (cf ethernet manual)
+		/* GMII is used internally and the conduit GMAC (GMAC2 on RZ/N1,
+		 * GMAC0 on RZ/T2H and RZ/N2H) is connected to the switch using
+		 * 1000Mbps Full-Duplex mode only (cf ethernet manual)
 		 */
 		__set_bit(PHY_INTERFACE_MODE_GMII, intf);
 	} else {
@@ -1410,6 +1411,20 @@ static void a5psw_shutdown(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 }
 
+static const struct a5psw_of_data rzt2h_of_data = {
+	.nports = 4,
+	.npcs = 3,
+	.cpu_port = 3,
+	.tag_proto = DSA_TAG_PROTO_RZT2H_ETHSW,
+	.management_port_fixed_frame_len = 0x3fff,
+	.rxmatch_config_base = 0x3f00,
+	.pattern_ctrl_base = 0x3f40,
+	.vlan_res_vlanid = GENMASK(15, 4),
+	.vlan_res_portmask = GENMASK(3, 0),
+	.lk_table_entries = 4096,
+	.keep_mac_tx_enabled = true,
+};
+
 static const struct a5psw_of_data rzn1_of_data = {
 	.nports = 5,
 	.npcs = 4,
@@ -1423,6 +1438,7 @@ static const struct a5psw_of_data rzn1_of_data = {
 };
 
 static const struct of_device_id a5psw_of_mtable[] = {
+	{ .compatible = "renesas,r9a09g077-ethsw", .data = &rzt2h_of_data },
 	{ .compatible = "renesas,rzn1-a5psw", .data = &rzn1_of_data },
 	{ /* sentinel */ }
 };
-- 
2.56.1


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

* Re: [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data
  2026-12-02  9:33 ` [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data Prabhakar
@ 2026-12-02  9:37   ` Clement Leger
  0 siblings, 0 replies; 21+ messages in thread
From: Clement Leger @ 2026-12-02  9:37 UTC (permalink / raw)
  To: Prabhakar, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Willem de Bruijn, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar



On 12/2/26 10:33, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> RZ/T2H and RZ/N2H differ from RZ/N1 in the RX pattern matcher register
> offsets, VLAN_RES field layout and lookup table size. Move these
> properties into per-SoC OF match data and use them when accessing the
> pattern matcher, VLAN entries and lookup table.
> 
> Keep the existing RZ/N1 values in its match data.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v6:
>    - Squashed patches #18, #19 and #20 from v5 to limit the number
>      of patches
>    - Updated the commit message
>    - Dropped reviewed-by tag as patches were squashed and patch #20 wasnt
>      reviewed
> v5: https://lore.kernel.org/all/20261120002549.1908299-16-prabhakar.mahadev-lad.rj@bp.renesas.com/
>      https://lore.kernel.org/all/20261120002549.1908299-20-prabhakar.mahadev-lad.rj@bp.renesas.com/
>      https://lore.kernel.org/all/20261120002549.1908299-21-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - New patch
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 29 ++++++++++++++++++++---------
>   drivers/net/dsa/rzn1_a5psw.h | 18 ++++++++++++------
>   2 files changed, 32 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 05753538c5ed..03d7f928e3e6 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -112,7 +112,9 @@ static void a5psw_port_pattern_set(struct a5psw *a5psw, int port, int pattern,
>   	if (enable)
>   		rx_match |= A5PSW_RXMATCH_CONFIG_PATTERN(pattern);
>   
> -	a5psw_reg_rmw(a5psw, A5PSW_RXMATCH_CONFIG(port),
> +	a5psw_reg_rmw(a5psw,
> +		      A5PSW_RXMATCH_CONFIG(a5psw->of_data->rxmatch_config_base,
> +					   port),
>   		      A5PSW_RXMATCH_CONFIG_PATTERN(pattern), rx_match);
>   }
>   
> @@ -315,18 +317,19 @@ static void a5psw_phylink_mac_link_up(struct phylink_config *config,
>   static int a5psw_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
>   {
>   	struct a5psw *a5psw = ds->priv;
> +	unsigned int entries = a5psw->of_data->lk_table_entries;
>   	unsigned long rate;
>   	u64 max, tmp;
>   	u32 agetime;
>   
>   	rate = clk_get_rate(a5psw->clk);
> -	max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * A5PSW_TABLE_ENTRIES * 1024),
> +	max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * entries * 1024),
>   		       rate) * 1000;
>   	if (msecs > max)
>   		return -EINVAL;
>   
>   	tmp = div_u64(rate, MSEC_PER_SEC);
> -	agetime = div_u64(msecs * tmp, 1024 * A5PSW_TABLE_ENTRIES);
> +	agetime = div_u64(msecs * tmp, 1024 * entries);
>   
>   	a5psw_reg_writel(a5psw, A5PSW_LK_AGETIME, agetime);
>   
> @@ -515,7 +518,7 @@ static int a5psw_lk_execute_lookup(struct a5psw *a5psw, union lk_data *lk_data,
>   	if (ret)
>   		return ret;
>   
> -	*entry = ctrl & A5PSW_LK_ADDR_CTRL_ADDRESS;
> +	*entry = ctrl & (a5psw->of_data->lk_table_entries - 1);
>   
>   	return 0;
>   }
> @@ -636,7 +639,7 @@ static int a5psw_port_fdb_dump(struct dsa_switch *ds, int port,
>   
>   	mutex_lock(&a5psw->lk_lock);
>   
> -	for (i = 0; i < A5PSW_TABLE_ENTRIES; i++) {
> +	for (i = 0; i < a5psw->of_data->lk_table_entries; i++) {
>   		reg = A5PSW_LK_ADDR_CTRL_READ | A5PSW_LK_ADDR_CTRL_WAIT | i;
>   
>   		ret = a5psw_lk_execute_ctrl(a5psw, &reg);
> @@ -689,7 +692,7 @@ static int a5psw_find_vlan_entry(struct a5psw *a5psw, u16 vid)
>   	/* Find vlan for this port */
>   	for (i = 0; i < A5PSW_VLAN_COUNT; i++) {
>   		vlan_res = a5psw_reg_readl(a5psw, A5PSW_VLAN_RES(i));
> -		if (FIELD_GET(A5PSW_VLAN_RES_VLANID, vlan_res) == vid)
> +		if (field_get(a5psw->of_data->vlan_res_vlanid, vlan_res) == vid)
>   			return i;
>   	}
>   
> @@ -704,8 +707,9 @@ static int a5psw_new_vlan_res_entry(struct a5psw *a5psw, u16 newvid)
>   	/* Find a free VLAN entry */
>   	for (i = 0; i < A5PSW_VLAN_COUNT; i++) {
>   		vlan_res = a5psw_reg_readl(a5psw, A5PSW_VLAN_RES(i));
> -		if (!(FIELD_GET(A5PSW_VLAN_RES_PORTMASK, vlan_res))) {
> -			vlan_res = FIELD_PREP(A5PSW_VLAN_RES_VLANID, newvid);
> +		if (!field_get(a5psw->of_data->vlan_res_portmask, vlan_res)) {
> +			vlan_res = field_prep(a5psw->of_data->vlan_res_vlanid,
> +					      newvid);
>   			a5psw_reg_writel(a5psw, A5PSW_VLAN_RES(i), vlan_res);
>   			return i;
>   		}
> @@ -953,7 +957,9 @@ static int a5psw_setup(struct dsa_switch *ds)
>   	a5psw_reg_writel(a5psw, A5PSW_MGMT_CFG, reg);
>   
>   	/* Set pattern 0 to forward all frame to mgmt port */
> -	a5psw_reg_writel(a5psw, A5PSW_PATTERN_CTRL(A5PSW_PATTERN_MGMTFWD),
> +	a5psw_reg_writel(a5psw,
> +			 A5PSW_PATTERN_CTRL(a5psw->of_data->pattern_ctrl_base,
> +					    A5PSW_PATTERN_MGMTFWD),
>   			 A5PSW_PATTERN_CTRL_MGMTFWD);
>   
>   	/* Enable port tagging */
> @@ -1346,6 +1352,11 @@ static const struct a5psw_of_data rzn1_of_data = {
>   	.npcs = 4,
>   	.cpu_port = 4,
>   	.tag_proto = DSA_TAG_PROTO_RZN1_A5PSW,
> +	.rxmatch_config_base = 0x3e80,
> +	.pattern_ctrl_base = 0x3eb0,
> +	.vlan_res_vlanid = GENMASK(16, 5),
> +	.vlan_res_portmask = GENMASK(4, 0),
> +	.lk_table_entries = 8192,
>   };
>   
>   static const struct of_device_id a5psw_of_mtable[] = {
> diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
> index 942931cbc402..fd523fe7bf47 100644
> --- a/drivers/net/dsa/rzn1_a5psw.h
> +++ b/drivers/net/dsa/rzn1_a5psw.h
> @@ -71,13 +71,11 @@
>   #define A5PSW_VLAN_RES_WR_PORTMASK	BIT(30)
>   #define A5PSW_VLAN_RES_WR_TAGMASK	BIT(29)
>   #define A5PSW_VLAN_RES_RD_TAGMASK	BIT(28)
> -#define A5PSW_VLAN_RES_VLANID		GENMASK(16, 5)
> -#define A5PSW_VLAN_RES_PORTMASK		GENMASK(4, 0)
>   
> -#define A5PSW_RXMATCH_CONFIG(port)	(0x3e80 + 4 * (port))
> +#define A5PSW_RXMATCH_CONFIG(base, port)	((base) + 4 * (port))
>   #define A5PSW_RXMATCH_CONFIG_PATTERN(p)	BIT(p)
>   
> -#define A5PSW_PATTERN_CTRL(p)		(0x3eb0 + 4  * (p))
> +#define A5PSW_PATTERN_CTRL(base, p)	((base) + 4 * (p))
>   #define A5PSW_PATTERN_CTRL_MGMTFWD	BIT(1)
>   
>   #define A5PSW_LK_CTRL		0x400
> @@ -95,7 +93,6 @@
>   #define A5PSW_LK_ADDR_CTRL_WAIT		BIT(27)
>   #define A5PSW_LK_ADDR_CTRL_READ		BIT(26)
>   #define A5PSW_LK_ADDR_CTRL_WRITE	BIT(25)
> -#define A5PSW_LK_ADDR_CTRL_ADDRESS	GENMASK(12, 0)
>   
>   #define A5PSW_LK_DATA_LO		0x40C
>   #define A5PSW_LK_DATA_HI		0x410
> @@ -212,7 +209,6 @@
>   
>   #define A5PSW_LK_BUSY_USEC_POLL		10
>   #define A5PSW_CTRL_TIMEOUT		1000
> -#define A5PSW_TABLE_ENTRIES		8192
>   
>   struct fdb_entry {
>   	u8 mac[ETH_ALEN];
> @@ -239,6 +235,11 @@ union lk_data {
>    * @tag_proto: DSA tag protocol used by the switch
>    * @management_port_fixed_frame_len: Fixed frame length for the management
>    *   port to account for the HW issue.
> + * @rxmatch_config_base: Offset of the RXMATCH_CONFIG register of port 0
> + * @pattern_ctrl_base: Offset of the PATTERN_CTRL register of pattern 0
> + * @vlan_res_vlanid: VLANID field mask of the VLAN_RES registers
> + * @vlan_res_portmask: PORTMASK field mask of the VLAN_RES registers
> + * @lk_table_entries: Number of entries in the lookup table (power of 2)
>    */
>   struct a5psw_of_data {
>   	unsigned int nports;
> @@ -246,6 +247,11 @@ struct a5psw_of_data {
>   	unsigned int cpu_port;
>   	enum dsa_tag_protocol tag_proto;
>   	unsigned int management_port_fixed_frame_len;
> +	u16 rxmatch_config_base;
> +	u16 pattern_ctrl_base;
> +	u32 vlan_res_vlanid;
> +	u32 vlan_res_portmask;
> +	unsigned int lk_table_entries;
>   };
>   
>   /**

LGTM,

Reviewed-by: Clément Léger <clement.leger@linux.dev>

Thanks,

Clément

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

* Re: [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
  2026-12-02  9:33 ` [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
@ 2026-12-02  9:38   ` Clement Leger
  0 siblings, 0 replies; 21+ messages in thread
From: Clement Leger @ 2026-12-02  9:38 UTC (permalink / raw)
  To: Prabhakar, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Willem de Bruijn, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar



On 12/2/26 10:33, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Add OF match data for the Ethernet switch (ETHSW) found on the Renesas
> RZ/T2H SoC. The ETHSW is based on the same A5PSW IP as the RZ/N1, but
> has a different port configuration and register layout.
> 
> Configure the driver for the RZ/T2H variant with:
> - 4 ports (3 external and 1 management), with the management port
>    at port 3.
> - DSA_TAG_PROTO_RZT2H_ETHSW tagging protocol.
> - A fixed management port frame length of 0x3fff.
> - Pattern matcher register offsets of 0x3f00 and 0x3f40.
> - VLAN_RES fields using VLANID[15:4] and PORTMASK[3:0].
> - 4096 lookup table entries.
> - Keep MAC TX enabled, gating transmission through PORT_ENA.TXENA.
> 
> Add the renesas,r9a09g077-ethsw compatible string to the OF match
> table. The RZ/N2H SoC uses this compatible as a fallback.
> 
> Update the Kconfig prompt and help text to reflect support for the
> RZ/T2H and RZ/N2H ETHSW variants.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v6:
>    - Squashed patches #21 and #24 to limit the number of patches in the series
>    - Updated commit message
> v5: https://lore.kernel.org/all/20261120002549.1908299-24-prabhakar.mahadev-lad.rj@bp.renesas.com/
>      https://lore.kernel.org/all/20261120002549.1908299-25-prabhakar.mahadev-lad.rj@bp.renesas.com/
>      https://lore.kernel.org/all/20261120002549.1908299-22-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - No change
> v4: https://lore.kernel.org/all/20261104182105.1102555-14-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - No change
> v3: https://lore.kernel.org/all/20261014131906.990077-13-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - No change
> v2: https://lore.kernel.org/all/20261001154326.754314-12-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - Added reviewed-by tag
> v1: https://lore.kernel.org/all/20251121113553.2955854-11-prabhakar.mahadev-lad.rj@bp.renesas.com/
> ---
>   drivers/net/dsa/Kconfig      |  9 +++++----
>   drivers/net/dsa/rzn1_a5psw.c | 20 ++++++++++++++++++--
>   2 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
> index d62f0cccf13d..5af8bc1a4dce 100644
> --- a/drivers/net/dsa/Kconfig
> +++ b/drivers/net/dsa/Kconfig
> @@ -103,13 +103,14 @@ source "drivers/net/dsa/xrs700x/Kconfig"
>   source "drivers/net/dsa/realtek/Kconfig"
>   
>   config NET_DSA_RZN1_A5PSW
> -	tristate "Renesas RZ/N1 A5PSW Ethernet switch support"
> -	depends on OF && (ARCH_RZN1 || COMPILE_TEST)
> +	tristate "Renesas RZ/N1 A5PSW and RZ/{T2H,N2H} ETHSW Ethernet switch support"
> +	depends on OF && (ARCH_RENESAS || COMPILE_TEST)
>   	select NET_DSA_TAG_RZN1_A5PSW
>   	select PCS_RZN1_MIIC
>   	help
> -	  This driver supports the A5PSW switch, which is embedded in Renesas
> -	  RZ/N1 SoC.
> +	  This driver supports the Advanced 5-Port Switch (A5PSW) found on
> +	  Renesas RZ/N1 SoCs, and the Ethernet Switch (ETHSW) found on
> +	  Renesas RZ/T2H and RZ/N2H SoCs.
>   
>   config NET_DSA_KS8995
>   	tristate "Micrel KS8995 family 5-ports 10/100 Ethernet switches"
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index e4fd4425f52e..3114268e009c 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -272,8 +272,9 @@ static void a5psw_phylink_get_caps(struct dsa_switch *ds, int port,
>   	config->mac_capabilities = MAC_1000FD;
>   
>   	if (dsa_is_cpu_port(ds, port)) {
> -		/* GMII is used internally and GMAC2 is connected to the switch
> -		 * using 1000Mbps Full-Duplex mode only (cf ethernet manual)
> +		/* GMII is used internally and the conduit GMAC (GMAC2 on RZ/N1,
> +		 * GMAC0 on RZ/T2H and RZ/N2H) is connected to the switch using
> +		 * 1000Mbps Full-Duplex mode only (cf ethernet manual)
>   		 */
>   		__set_bit(PHY_INTERFACE_MODE_GMII, intf);
>   	} else {
> @@ -1410,6 +1411,20 @@ static void a5psw_shutdown(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, NULL);
>   }
>   
> +static const struct a5psw_of_data rzt2h_of_data = {
> +	.nports = 4,
> +	.npcs = 3,
> +	.cpu_port = 3,
> +	.tag_proto = DSA_TAG_PROTO_RZT2H_ETHSW,
> +	.management_port_fixed_frame_len = 0x3fff,
> +	.rxmatch_config_base = 0x3f00,
> +	.pattern_ctrl_base = 0x3f40,
> +	.vlan_res_vlanid = GENMASK(15, 4),
> +	.vlan_res_portmask = GENMASK(3, 0),
> +	.lk_table_entries = 4096,
> +	.keep_mac_tx_enabled = true,
> +};
> +
>   static const struct a5psw_of_data rzn1_of_data = {
>   	.nports = 5,
>   	.npcs = 4,
> @@ -1423,6 +1438,7 @@ static const struct a5psw_of_data rzn1_of_data = {
>   };
>   
>   static const struct of_device_id a5psw_of_mtable[] = {
> +	{ .compatible = "renesas,r9a09g077-ethsw", .data = &rzt2h_of_data },
>   	{ .compatible = "renesas,rzn1-a5psw", .data = &rzn1_of_data },
>   	{ /* sentinel */ }
>   };

Hi Prabhakar,

Reviewed-by: Clément Léger <clement.leger@linux.dev>

Thanks,

Clément

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

* Re: [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias
  2026-12-02  9:33 ` [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias Prabhakar
@ 2026-12-02  9:39   ` Clement Leger
  0 siblings, 0 replies; 21+ messages in thread
From: Clement Leger @ 2026-12-02  9:39 UTC (permalink / raw)
  To: Prabhakar, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Willem de Bruijn, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar



On 12/2/26 10:33, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The tagger uses DSA_TAG_PROTO_RZN1_A5PSW, but its module alias
> references DSA_TAG_PROTO_A5PSW, which is not the correct protocol
> identifier. Consequently, the generated alias does not match the
> RZ/N1 tag protocol, preventing automatic module loading.
> 
> Use DSA_TAG_PROTO_RZN1_A5PSW when generating the module alias.
> 
> Fixes: a08d6a6dc820 ("net: dsa: add Renesas RZ/N1 switch tag driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> Note, Ive not considered this as a fix to net and instead posting it to
> net-next as this issue has been since day one. Other fixes which have
> been lingering from the first revision were also applied to net-next
> see [0].
> [0] https://lore.kernel.org/all/20261123130852.3420491-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
> 
> v6:
>    - New patch
> ---
>   net/dsa/tag_rzn1_a5psw.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
> index aab0ec143c77..957663c7c101 100644
> --- a/net/dsa/tag_rzn1_a5psw.c
> +++ b/net/dsa/tag_rzn1_a5psw.c
> @@ -114,5 +114,5 @@ static const struct dsa_device_ops a5psw_netdev_ops = {
>   
>   MODULE_DESCRIPTION("DSA tag driver for Renesas RZ/N1 A5PSW switch");
>   MODULE_LICENSE("GPL v2");
> -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW, A5PSW_NAME);
> +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RZN1_A5PSW, A5PSW_NAME);
>   module_dsa_tag_driver(a5psw_netdev_ops);

LGTM,

Reviewed-by: Clément Léger <clement.leger@linux.dev>

Thanks,

Clément


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

* Re: [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
  2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (14 preceding siblings ...)
  2026-12-02  9:33 ` [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
@ 2026-12-02  9:40 ` netdev-bot+sinfo
  15 siblings, 0 replies; 21+ messages in thread
From: netdev-bot+sinfo @ 2026-12-02  9:40 UTC (permalink / raw)
  To: Prabhakar
  Cc: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit,
	Russell King, Willem de Bruijn, Simon Horman, Philipp Zabel,
	Geert Uytterhoeven, Magnus Damm, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

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

* Re: [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
  2026-12-02  9:33 ` [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
@ 2026-12-02  9:42   ` Clement Leger
  0 siblings, 0 replies; 21+ messages in thread
From: Clement Leger @ 2026-12-02  9:42 UTC (permalink / raw)
  To: Prabhakar, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Willem de Bruijn, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: linux-renesas-soc, netdev, devicetree, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar



On 12/2/26 10:33, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The ETHSW IP used in SoCs such as RZ/T2H and RZ/N2H has a hardware issue
> where the internal mgmt_tag_vld signal is asserted as a level instead of
> a single-cycle pulse. This causes the frame length counter on the
> management (CPU) port to over-increment, so valid frames are falsely
> detected as oversized and dropped.
> 
> The recommended workaround is to program the maximum frame length
> register (FRM_LENGTH) of the management port with a fixed, large value.
> 
> Add a management_port_fixed_frame_len member to struct a5psw_of_data to
> hold the SoC-specific value. When it is set, program A5PSW_FRM_LENGTH
> for the CPU port with this value in a5psw_setup(), and skip updating
> FRM_LENGTH for the CPU port in a5psw_port_change_mtu() so that MTU
> changes do not override the workaround.
> 
> No functional change for existing SoCs, which leave the value unset.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v6:
>    - No change
> v5: https://lore.kernel.org/all/20261120002549.1908299-18-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - No change
> v4: https://lore.kernel.org/all/20261104182105.1102555-13-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - No change
> v3: https://lore.kernel.org/all/20261014131906.990077-12-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - Marked of_data as const pointer to avoid build warning
> v2: https://lore.kernel.org/all/20261001154326.754314-11-prabhakar.mahadev-lad.rj@bp.renesas.com/
>    - Added info about the IP issue and the workaround.
>    - Updated commit message
> v1: https://lore.kernel.org/all/20251121113553.2955854-10-prabhakar.mahadev-lad.rj@bp.renesas.com/
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 17 ++++++++++++++++-
>   drivers/net/dsa/rzn1_a5psw.h |  3 +++
>   2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index a768b0545e02..05753538c5ed 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -217,6 +217,10 @@ static int a5psw_port_enable(struct dsa_switch *ds, int port,
>   static int a5psw_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
>   {
>   	struct a5psw *a5psw = ds->priv;
> +	const struct a5psw_of_data *of_data = a5psw->of_data;
> +
> +	if (dsa_is_cpu_port(ds, port) && of_data->management_port_fixed_frame_len)
> +		return 0;
>   
>   	new_mtu += ETH_HLEN + A5PSW_EXTRA_MTU_LEN + ETH_FCS_LEN;
>   	a5psw_reg_writel(a5psw, A5PSW_FRM_LENGTH(port), new_mtu);
> @@ -993,8 +997,19 @@ static int a5psw_setup(struct dsa_switch *ds)
>   		if (dsa_port_is_unused(dp))
>   			continue;
>   
> -		/* Enable egress flooding and learning for CPU port */
>   		if (dsa_port_is_cpu(dp)) {
> +			/*
> +			 * Workaround for ETHSW IP issue, mgmt_tag_vld is asserted as a level
> +			 * instead of a single-cycle pulse, causing the frame length counter
> +			 * to over-increment and trigger false oversize frame drops.
> +			 * The recommended workaround is to set the maximum frame
> +			 * length on the management port.
> +			 */
> +			if (a5psw->of_data->management_port_fixed_frame_len)
> +				a5psw_reg_writel(a5psw, A5PSW_FRM_LENGTH(port),
> +						 a5psw->of_data->management_port_fixed_frame_len);
> +
> +			/* Enable egress flooding and learning for CPU port */
>   			a5psw_flooding_set_resolution(a5psw, port, true);
>   			a5psw_port_learning_set(a5psw, port, true);
>   		}
> diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
> index 58690f5f3887..942931cbc402 100644
> --- a/drivers/net/dsa/rzn1_a5psw.h
> +++ b/drivers/net/dsa/rzn1_a5psw.h
> @@ -237,12 +237,15 @@ union lk_data {
>    * @npcs: Number of PCS connected to the switch
>    * @cpu_port: CPU port number
>    * @tag_proto: DSA tag protocol used by the switch
> + * @management_port_fixed_frame_len: Fixed frame length for the management
> + *   port to account for the HW issue.
>    */
>   struct a5psw_of_data {
>   	unsigned int nports;
>   	unsigned int npcs;
>   	unsigned int cpu_port;
>   	enum dsa_tag_protocol tag_proto;
> +	unsigned int management_port_fixed_frame_len;
>   };
>   
>   /**

LGTM,

Reviewed-by: Clément Léger <clement.leger@linux.dev>

Thanks,

Clément

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

end of thread, other threads:[~2026-12-02  9:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  9:33 [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 01/15] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 02/15] net: dsa: tag_rzn1_a5psw: Fix RZ/N1 tagger module alias Prabhakar
2026-12-02  9:39   ` Clement Leger
2026-12-02  9:33 ` [PATCH net-next v6 03/15] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 04/15] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 05/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 06/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 07/15] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 08/15] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 09/15] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 10/15] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 11/15] net: dsa: rzn1-a5psw: Get switch configuration from OF data Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 12/15] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
2026-12-02  9:42   ` Clement Leger
2026-12-02  9:33 ` [PATCH net-next v6 13/15] net: dsa: rzn1-a5psw: Get register layout from OF data Prabhakar
2026-12-02  9:37   ` Clement Leger
2026-12-02  9:33 ` [PATCH net-next v6 14/15] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
2026-12-02  9:33 ` [PATCH net-next v6 15/15] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-12-02  9:38   ` Clement Leger
2026-12-02  9:40 ` [PATCH net-next v6 00/15] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs netdev-bot+sinfo

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