Devicetree
 help / color / mirror / Atom feed
* [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
@ 2026-11-20  0:25 Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
                   ` (25 more replies)
  0 siblings, 26 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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.

v4->v5:
- 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:
- 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:
- 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:
- Added RB tag
- Fixed review comments from Vladimir.
- Added info about the IP issue and the workaround

v4: https://lore.kernel.org/all/20261104182105.1102555-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
v3: https://lore.kernel.org/all/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
v2: https://lore.kernel.org/all/20261001154326.754314-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
v1: https://lore.kernel.org/all/20251121113553.2955854-1-prabhakar.mahadev-lad.rj@bp.renesas.com/

Cheers,
Prabhakar

Lad Prabhakar (24):
  net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition
  net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support
  net: dsa: Kconfig: Expand config description to cover RZ/T2H and
    RZ/N2H ETHSW
  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: Fix LK_LEARNCOUNT write mode encoding
  net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
  net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation
  net: dsa: rzn1-a5psw: Set driver data in probe
  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 info via OF data
  net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible
    string
  net: dsa: rzn1-a5psw: Add fixed frame length workaround for management
    port
  net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF
    data
  net: dsa: rzn1-a5psw: Get VLAN_RES field layout from OF data
  net: dsa: rzn1-a5psw: Get lookup table size from OF data
  net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H
  net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H
  net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
  net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs

 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  | 165 +++++++++++--
 drivers/net/dsa/Kconfig                       |   9 +-
 drivers/net/dsa/rzn1_a5psw.c                  | 221 ++++++++++++++----
 drivers/net/dsa/rzn1_a5psw.h                  |  53 ++++-
 drivers/net/pcs/pcs-rzn1-miic.c               |  39 ++++
 include/net/dsa.h                             |   2 +
 include/uapi/linux/if_ether.h                 |   2 +-
 net/dsa/Kconfig                               |   9 +-
 net/dsa/tag_rzn1_a5psw.c                      |  22 +-
 9 files changed, 436 insertions(+), 86 deletions(-)

-- 
2.56.1


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

* [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 02/24] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Added RB tag
---
 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] 36+ messages in thread

* [PATCH net-next v5 02/24] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 03/24] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- Rebased on next so DSA_TAG_PROTO_RZT2H_ETHSW_VALUE is updated

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Updated commit message
---
 include/net/dsa.h             |  2 ++
 include/uapi/linux/if_ether.h |  2 +-
 net/dsa/tag_rzn1_a5psw.c      | 21 +++++++++++++++++++--
 3 files changed, 22 insertions(+), 3 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/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
index aab0ec143c77..3dff661fa58c 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_A5PSW, A5PSW_NAME);
+DSA_TAG_DRIVER(a5psw_netdev_ops);
+
+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 switch");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW, A5PSW_NAME);
-module_dsa_tag_driver(a5psw_netdev_ops);
-- 
2.56.1


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

* [PATCH net-next v5 03/24] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 02/24] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 04/24] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

Update the Kconfig entry for the RZN1 A5PSW tag driver to reflect that
the same tagging format is also used by the ETHSW blocks found in Renesas
RZ/T2H and RZ/N2H SoCs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Updated description for Kconfig entry to cover RZ/T2H and RZ/N2H ETHSW
---
 net/dsa/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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"
-- 
2.56.1


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

* [PATCH net-next v5 04/24] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (2 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 03/24] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 05/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- New patch
---
 drivers/net/pcs/pcs-rzn1-miic.c | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index 682a73cf5a87..96f4cb533a71 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)
@@ -599,6 +635,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 +912,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] 36+ messages in thread

* [PATCH net-next v5 05/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (3 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 04/24] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 06/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- Added RB tag

v3->v4:
- 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] 36+ messages in thread

* [PATCH net-next v5 06/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (4 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 05/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 07/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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>
---
v4->v5:
- Replaced the patternProperties expression
- Added maximum constraint for reg values
- Updated commit subject and description

v3->v4:
- Added reg items validation for ethernet ports
 
v2->v3:
- 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] 36+ messages in thread

* [PATCH net-next v5 07/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (5 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 06/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- 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

v3->v4:
- Restricted the reg property for ethernet-ports to maximum 3 for RZ/T2H
- Added RB tag from Rob

v2->v3:
- Added a restriction to disallow port@4
- Updated commit message

v1->v2:
- Added full names for SoCs
---
 .../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] 36+ messages in thread

* [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (6 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 07/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  3:27   ` Andrew Lunn
  2026-11-20  6:01   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset Prabhakar
                   ` (17 subsequent siblings)
  25 siblings, 2 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

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

The LK_LEARNCOUNT write mode lives in bits [31:30] of the register, but
the driver writes the raw A5PSW_LK_LEARNCOUNT_MODE_* values (0, 1, 2)
directly. As a result, adding an FDB entry writes "set LEARNCOUNT to 1"
and deleting one writes "set LEARNCOUNT to 2", instead of atomically
incrementing/decrementing the counter.

Use FIELD_PREP() with A5PSW_LK_LEARNCOUNT_MODE so the mode lands in the
correct bit field.

Fixes: 5edf246c6869 ("net: dsa: rzn1-a5psw: add FDB support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 13c46cf2c420..7fd2652813ac 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -5,6 +5,7 @@
  * Clément Léger <clement.leger@bootlin.com>
  */
 
+#include <linux/bitfield.h>
 #include <linux/clk.h>
 #include <linux/etherdevice.h>
 #include <linux/if_bridge.h>
@@ -545,7 +546,8 @@ static int a5psw_port_fdb_add(struct dsa_switch *ds, int port,
 		goto lk_unlock;
 
 	if (inc_learncount) {
-		reg = A5PSW_LK_LEARNCOUNT_MODE_INC;
+		reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
+				 A5PSW_LK_LEARNCOUNT_MODE_INC);
 		a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
 	}
 
@@ -604,7 +606,8 @@ static int a5psw_port_fdb_del(struct dsa_switch *ds, int port,
 
 	/* Decrement LEARNCOUNT */
 	if (clear) {
-		reg = A5PSW_LK_LEARNCOUNT_MODE_DEC;
+		reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
+				 A5PSW_LK_LEARNCOUNT_MODE_DEC);
 		a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
 	}
 
@@ -963,7 +966,8 @@ static int a5psw_setup(struct dsa_switch *ds)
 	}
 
 	/* Reset learn count to 0 */
-	reg = A5PSW_LK_LEARNCOUNT_MODE_SET;
+	reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
+			 A5PSW_LK_LEARNCOUNT_MODE_SET);
 	a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
 
 	/* Clear VLAN resource table */
-- 
2.56.1


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

* [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (7 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  3:29   ` Andrew Lunn
  2026-11-20  0:25 ` [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation Prabhakar
                   ` (16 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

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

The RZ/N1 hardware manual places the VLANTransmittedOK counter at
offset 0x8f4, not 0x8ec. Correct the register offset so the driver
reads the counter from the right location.

Fixes: c7243fd4a62f ("net: dsa: rzn1-a5psw: add statistics support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index d54acedac194..9693f8503b0b 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -185,7 +185,7 @@
 #define A5PSW_etherStatsFragments		0x8E0
 
 #define A5PSW_VLANReceived			0x8E8
-#define A5PSW_VLANTransmitted			0x8EC
+#define A5PSW_VLANTransmitted			0x8F4
 
 #define A5PSW_aDeferred				0x910
 #define A5PSW_aMultipleCollisions		0x914
-- 
2.56.1


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

* [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (8 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  6:51   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe Prabhakar
                   ` (15 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

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

The MDC frequency is hclk / (2 * CLKDIV + 1) on RZ/N1 as well as
RZ/T2H and RZ/N2H. The existing calculation uses the wrong divisor
formula and can set MDC above the requested clock-frequency.

Calculate the smallest CLKDIV that keeps MDC at or below the requested
frequency.

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 7fd2652813ac..df3b3f75b489 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -11,6 +11,7 @@
 #include <linux/if_bridge.h>
 #include <linux/if_ether.h>
 #include <linux/kernel.h>
+#include <linux/math.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_mdio.h>
@@ -1104,7 +1105,7 @@ static int a5psw_mdio_config(struct a5psw *a5psw, u32 mdio_freq)
 	u32 cfgstatus;
 
 	rate = clk_get_rate(a5psw->hclk);
-	div = ((rate / mdio_freq) / 2);
+	div = DIV_ROUND_UP(DIV_ROUND_UP(rate, mdio_freq) - 1, 2);
 	if (div > FIELD_MAX(A5PSW_MDIO_CFG_STATUS_CLKDIV) ||
 	    div < A5PSW_MDIO_CLK_DIV_MIN) {
 		dev_err(a5psw->dev, "MDIO clock div %ld out of range\n", div);
-- 
2.56.1


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

* [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (9 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  6:53   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
                   ` (14 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

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

a5psw_remove() and a5psw_shutdown() retrieve the driver private data
using platform_get_drvdata(), but a5psw_probe() never sets it.
Consequently, both callbacks return early without unregistering or
shutting down the DSA switch.

Set the driver data in probe to ensure the remove and shutdown
callbacks can access the private data and perform the required DSA
cleanup.

Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index df3b3f75b489..0e4bbf34ec27 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1221,6 +1221,7 @@ static int a5psw_probe(struct platform_device *pdev)
 	if (!a5psw)
 		return -ENOMEM;
 
+	platform_set_drvdata(pdev, a5psw);
 	a5psw->dev = dev;
 	mutex_init(&a5psw->lk_lock);
 	spin_lock_init(&a5psw->reg_lock);
-- 
2.56.1


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

* [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (10 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  3:32   ` Andrew Lunn
  2026-11-20  0:25 ` [PATCH net-next v5 13/24] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
                   ` (13 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Added RB tags
---
 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 0e4bbf34ec27..669dc584e6f7 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"
@@ -1212,6 +1213,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;
@@ -1249,6 +1251,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] 36+ messages in thread

* [PATCH net-next v5 13/24] net: dsa: rzn1-a5psw: Add support for optional timestamp clock
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (11 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- No change
---
 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 669dc584e6f7..4b31a1d331e1 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1217,6 +1217,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);
@@ -1251,6 +1252,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] 36+ messages in thread

* [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe()
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (12 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 13/24] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  6:58   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
                   ` (11 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- 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 4b31a1d331e1..bccfadc1d5e6 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1240,15 +1240,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] 36+ messages in thread

* [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (13 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  7:02   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
                   ` (10 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

The driver previously assumed a fixed 5-port layout and derived the CPU
port and number of PCS instances from this. Newer Renesas variants use
different port counts. Although the CPU port remains the last port, the
fixed port/PCS topology hard coded in the driver no longer matches all
hardware.

Introduce an a5psw_of_data struct holding the per SoC switch info, and
use this match data in place of the previously embedded constants. This
makes the port loops, PCS allocation, management-port setup, and other
topology dependent code reflect the switch layout selected by the
compatible string.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- No change

v3->v4:
- Added return value check for of_device_get_match_data

v2->v3:
- Fixed typo in commit message: swicth -> switch

v1->v2:
- Updated commit message
- Renamed A5PSW_MAX_PORTS macro to A5PSW_MAX_NUM_PCS
---
 drivers/net/dsa/rzn1_a5psw.c | 31 ++++++++++++++++++++++---------
 drivers/net/dsa/rzn1_a5psw.h | 20 +++++++++++++++++---
 2 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index bccfadc1d5e6..8d7cad90d613 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -384,13 +384,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 +929,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 */
@@ -1154,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]);
 	}
@@ -1181,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;
 		}
@@ -1228,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)
@@ -1277,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;
@@ -1319,8 +1326,14 @@ 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,
+};
+
 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..26d201931453 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,25 @@ 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
+ */
+struct a5psw_of_data {
+	unsigned int nports;
+	unsigned int npcs;
+	unsigned int cpu_port;
+};
+
 /**
  * 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 +265,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] 36+ messages in thread

* [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (14 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  7:03   ` Clement Leger
  2026-11-20  0:25 ` [PATCH net-next v5 17/24] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
                   ` (9 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

Prepare the A5PSW driver for forthcoming RZ/T2H ETHSW support by making
the DSA tag protocol selectable through SoC match data. The RZ/N1 A5PSW
and RZ/T2H ETHSW share the same tagged frame layout, but interpret the
ControlData field differently, so the tag protocol cannot remain fixed.

The common tagged frame structure 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 ControlData semantics diverge between the two switch families:

  +---------+----------------------------------------------+
  | SoC     | ControlData bits                             |
  +---------+----------------------------------------------+
  | 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 differences affect protocol semantics, select the tag
format through compatible specific data. This allows the driver to
choose the appropriate tagging protocol for each SoC while preserving
the existing RZ/N1 behaviour.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Updated commit message
---
 drivers/net/dsa/rzn1_a5psw.c | 5 ++++-
 drivers/net/dsa/rzn1_a5psw.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 8d7cad90d613..c59d881ce10f 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,
@@ -1330,6 +1332,7 @@ 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[] = {
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index 26d201931453..58690f5f3887 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -236,11 +236,13 @@ union lk_data {
  * @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;
 };
 
 /**
-- 
2.56.1


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

* [PATCH net-next v5 17/24] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (15 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 18/24] net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF data Prabhakar
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- Marked of_data as const pointer to avoid build warning

v1->v2:
- Added info about the IP issue and the workaround.
- Updated commit message
---
 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 c59d881ce10f..9475e53752ce 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -211,6 +211,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);
@@ -995,8 +999,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] 36+ messages in thread

* [PATCH net-next v5 18/24] net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF data
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (16 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 17/24] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 19/24] net: dsa: rzn1-a5psw: Get VLAN_RES field layout " Prabhakar
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

The RX pattern matcher registers are located at different offsets on
RZ/N1 and RZ/T2H/RZ/N2H. While RZ/N1 uses 0x3e80 for RXMATCH_CONFIG
and 0x3eb0 for PATTERN_CTRL, RZ/T2H and RZ/N2H use 0x3f00 and 0x3f40,
respectively.

Move the base offsets of both register arrays into struct a5psw_of_data
and use the correct values for each SoC.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 10 ++++++++--
 drivers/net/dsa/rzn1_a5psw.h |  8 ++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 9475e53752ce..6f3f902f9f4c 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);
 }
 
@@ -953,7 +955,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 */
@@ -1348,6 +1352,8 @@ 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,
 };
 
 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..5c5f5ec25774 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -74,10 +74,10 @@
 #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
@@ -239,6 +239,8 @@ 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
  */
 struct a5psw_of_data {
 	unsigned int nports;
@@ -246,6 +248,8 @@ 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;
 };
 
 /**
-- 
2.56.1


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

* [PATCH net-next v5 19/24] net: dsa: rzn1-a5psw: Get VLAN_RES field layout from OF data
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (17 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 18/24] net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF data Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size " Prabhakar
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

The VLAN_RES field layout differs between RZ/N1 and RZ/T2H/RZ/N2H.
RZ/N1 uses PORTMASK[4:0] and VLANID[16:5], whereas RZ/T2H and
RZ/N2H use PORTMASK[3:0] and VLANID[15:4] to accommodate their
four-port configuration.

Move the VLANID and PORTMASK field masks into struct a5psw_of_data
and use field_get() and field_prep() to access the respective fields.

Populate the OF data with the existing RZ/N1 field layout, allowing
SoC-specific layouts to be provided when adding support for RZ/T2H
and RZ/N2H.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 9 ++++++---
 drivers/net/dsa/rzn1_a5psw.h | 6 ++++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 6f3f902f9f4c..7e9bc252d92a 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -691,7 +691,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;
 	}
 
@@ -706,8 +706,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;
 		}
@@ -1354,6 +1355,8 @@ static const struct a5psw_of_data rzn1_of_data = {
 	.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),
 };
 
 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 5c5f5ec25774..29d205e2331d 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -71,8 +71,6 @@
 #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(base, port)	((base) + 4 * (port))
 #define A5PSW_RXMATCH_CONFIG_PATTERN(p)	BIT(p)
@@ -241,6 +239,8 @@ union lk_data {
  *   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
  */
 struct a5psw_of_data {
 	unsigned int nports;
@@ -250,6 +250,8 @@ struct a5psw_of_data {
 	unsigned int management_port_fixed_frame_len;
 	u16 rxmatch_config_base;
 	u16 pattern_ctrl_base;
+	u32 vlan_res_vlanid;
+	u32 vlan_res_portmask;
 };
 
 /**
-- 
2.56.1


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

* [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size from OF data
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (18 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 19/24] net: dsa: rzn1-a5psw: Get VLAN_RES field layout " Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 21/24] net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H Prabhakar
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

The RZ/N1 A5PSW has 8192 lookup table entries, whereas the RZ/T2H
and RZ/N2H ETHSW have only 4096 entries.

Add the lookup table size to struct a5psw_of_data, derive the address
mask from it and use it in the FDB and ageing code.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 10 ++++++----
 drivers/net/dsa/rzn1_a5psw.h |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 7e9bc252d92a..c0c1f45852da 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -311,18 +311,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);
 
@@ -511,7 +512,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;
 }
@@ -638,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);
@@ -1357,6 +1358,7 @@ static const struct a5psw_of_data rzn1_of_data = {
 	.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 29d205e2331d..fd523fe7bf47 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -93,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
@@ -210,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];
@@ -241,6 +239,7 @@ union lk_data {
  * @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;
@@ -252,6 +251,7 @@ struct a5psw_of_data {
 	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] 36+ messages in thread

* [PATCH net-next v5 21/24] net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (19 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size " Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

The comment in a5psw_phylink_get_caps() states that GMAC2 is connected
to the switch management port. This is only true on RZ/N1. On RZ/T2H
and RZ/N2H, the conduit is GMAC0. Update the comment accordingly.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index c0c1f45852da..751d03b0bde4 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -237,8 +237,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 {
-- 
2.56.1


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

* [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (20 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 21/24] net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 23/24] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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. 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>
---
v4->v5:
- New patch
---
 drivers/net/dsa/rzn1_a5psw.c | 85 +++++++++++++++++++++++++++++++-----
 drivers/net/dsa/rzn1_a5psw.h |  8 ++++
 2 files changed, 81 insertions(+), 12 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 751d03b0bde4..86d5b9d52f8d 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -127,11 +127,20 @@ static void a5psw_port_mgmtfwd_set(struct a5psw *a5psw, int port, bool enable)
 	a5psw_port_pattern_set(a5psw, port, A5PSW_PATTERN_MGMTFWD, enable);
 }
 
-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
@@ -140,18 +149,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)
@@ -278,6 +307,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);
@@ -307,6 +345,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)
@@ -996,9 +1037,22 @@ 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.
+		 */
+		if (a5psw->of_data->keep_mac_tx_enabled)
+			a5psw_reg_rmw(a5psw, A5PSW_CMD_CFG(port),
+				      A5PSW_CMD_CFG_RX_ENA, 0);
+		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));
@@ -1296,6 +1350,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] 36+ messages in thread

* [PATCH net-next v5 23/24] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (21 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:25 ` [PATCH net-next v5 24/24] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, 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.
- The odd MDIO clock divider formula.

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

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
- Updated rzt2h_of_data to match the RZ/T2H hardware configuration

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- No change
---
 drivers/net/dsa/rzn1_a5psw.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 86d5b9d52f8d..2b69e92e1853 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1411,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,
@@ -1424,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] 36+ messages in thread

* [PATCH net-next v5 24/24] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (22 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 23/24] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
@ 2026-11-20  0:25 ` Prabhakar
  2026-11-20  0:28 ` [PATCH net-next v5 00/24] Add ETHSW support for Renesas " netdev-bot+sinfo
  2026-11-20  3:14 ` Jakub Kicinski
  25 siblings, 0 replies; 36+ messages in thread
From: Prabhakar @ 2026-11-20  0:25 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

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

Update the Kconfig entry for the Renesas RZ/N1 A5PSW Ethernet switch
driver to depend on ARCH_RENESAS instead of ARCH_RZN1. This allows
the driver to be built for other Renesas SoCs that integrate a similar
Ethernet switch IP, such as RZ/T2H and RZ/N2H.

Also update the help text and prompt to reflect support for the ETHSW
variant used on these SoCs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
---
v4->v5:
- No change

v3->v4:
- No change

v2->v3:
- No change

v1->v2:
- Added RB tag
---
 drivers/net/dsa/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 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"
-- 
2.56.1


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

* Re: [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (23 preceding siblings ...)
  2026-11-20  0:25 ` [PATCH net-next v5 24/24] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-11-20  0:28 ` netdev-bot+sinfo
  2026-11-20  3:14 ` Jakub Kicinski
  25 siblings, 0 replies; 36+ messages in thread
From: netdev-bot+sinfo @ 2026-11-20  0:28 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, Simon Horman, Philipp Zabel, Geert Uytterhoeven,
	Magnus Damm, Florian Fainelli, Ralph Siemsen, 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] 36+ messages in thread

* Re: [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
  2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (24 preceding siblings ...)
  2026-11-20  0:28 ` [PATCH net-next v5 00/24] Add ETHSW support for Renesas " netdev-bot+sinfo
@ 2026-11-20  3:14 ` Jakub Kicinski
  25 siblings, 0 replies; 36+ messages in thread
From: Jakub Kicinski @ 2026-11-20  3:14 UTC (permalink / raw)
  To: Prabhakar
  Cc: Clément Léger, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
	Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

On Fri, 20 Nov 2026 00:25:10 +0000 Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

The max series size in netdev is 15 patches:

Quoting documentation:

  tl;dr
  -----
  
   - designate your patch to a tree - ``[PATCH net]`` or ``[PATCH net-next]``
   - for fixes the ``Fixes:`` tag is required, regardless of the tree
   - don't post large series (> 15 patches), break them up
   - don't repost your patches within one 24h period
   - reverse xmas tree
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#tl-dr

Looks like CI has already wasted time processing this, so we'll let it
finish, but if you break this rule again you will get banned from the
list for 3 months.

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

* Re: [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding
  2026-11-20  0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
@ 2026-11-20  3:27   ` Andrew Lunn
  2026-11-20  6:01   ` Clement Leger
  1 sibling, 0 replies; 36+ messages in thread
From: Andrew Lunn @ 2026-11-20  3:27 UTC (permalink / raw)
  To: Prabhakar
  Cc: Clément Léger, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
	Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

On Fri, Nov 20, 2026 at 12:25:18AM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The LK_LEARNCOUNT write mode lives in bits [31:30] of the register, but
> the driver writes the raw A5PSW_LK_LEARNCOUNT_MODE_* values (0, 1, 2)
> directly. As a result, adding an FDB entry writes "set LEARNCOUNT to 1"
> and deleting one writes "set LEARNCOUNT to 2", instead of atomically
> incrementing/decrementing the counter.
> 
> Use FIELD_PREP() with A5PSW_LK_LEARNCOUNT_MODE so the mode lands in the
> correct bit field.
> 
> Fixes: 5edf246c6869 ("net: dsa: rzn1-a5psw: add FDB support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

This sounds like a real problem that should be fixed? So please submit
it to net, not net-next.

   Andrew

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

* Re: [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
  2026-11-20  0:25 ` [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset Prabhakar
@ 2026-11-20  3:29   ` Andrew Lunn
  0 siblings, 0 replies; 36+ messages in thread
From: Andrew Lunn @ 2026-11-20  3:29 UTC (permalink / raw)
  To: Prabhakar
  Cc: Clément Léger, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
	Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable

On Fri, Nov 20, 2026 at 12:25:19AM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The RZ/N1 hardware manual places the VLANTransmittedOK counter at
> offset 0x8f4, not 0x8ec. Correct the register offset so the driver
> reads the counter from the right location.
> 
> Fixes: c7243fd4a62f ("net: dsa: rzn1-a5psw: add statistics support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

This again seems like a real fix, so should be for net.

Submitting these to net will also help with your patch count.

	   Andrew

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

* Re: [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control
  2026-11-20  0:25 ` [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
@ 2026-11-20  3:32   ` Andrew Lunn
  0 siblings, 0 replies; 36+ messages in thread
From: Andrew Lunn @ 2026-11-20  3:32 UTC (permalink / raw)
  To: Prabhakar
  Cc: Clément Léger, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, Russell King,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm,
	Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

> 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.

So it is not optional for those? At least the DT binding should mark
it as required for these compatibles.

	Andrew

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

* Re: [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding
  2026-11-20  0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
  2026-11-20  3:27   ` Andrew Lunn
@ 2026-11-20  6:01   ` Clement Leger
  1 sibling, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  6:01 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable



On 11/20/26 01:25, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The LK_LEARNCOUNT write mode lives in bits [31:30] of the register, but
> the driver writes the raw A5PSW_LK_LEARNCOUNT_MODE_* values (0, 1, 2)
> directly. As a result, adding an FDB entry writes "set LEARNCOUNT to 1"
> and deleting one writes "set LEARNCOUNT to 2", instead of atomically
> incrementing/decrementing the counter.
> 
> Use FIELD_PREP() with A5PSW_LK_LEARNCOUNT_MODE so the mode lands in the
> correct bit field.
> 
> Fixes: 5edf246c6869 ("net: dsa: rzn1-a5psw: add FDB support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v4->v5:
> - New patch
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 13c46cf2c420..7fd2652813ac 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -5,6 +5,7 @@
>    * Clément Léger <clement.leger@bootlin.com>
>    */
>   
> +#include <linux/bitfield.h>
>   #include <linux/clk.h>
>   #include <linux/etherdevice.h>
>   #include <linux/if_bridge.h>
> @@ -545,7 +546,8 @@ static int a5psw_port_fdb_add(struct dsa_switch *ds, int port,
>   		goto lk_unlock;
>   
>   	if (inc_learncount) {
> -		reg = A5PSW_LK_LEARNCOUNT_MODE_INC;
> +		reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
> +				 A5PSW_LK_LEARNCOUNT_MODE_INC);
>   		a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
>   	}
>   
> @@ -604,7 +606,8 @@ static int a5psw_port_fdb_del(struct dsa_switch *ds, int port,
>   
>   	/* Decrement LEARNCOUNT */
>   	if (clear) {
> -		reg = A5PSW_LK_LEARNCOUNT_MODE_DEC;
> +		reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
> +				 A5PSW_LK_LEARNCOUNT_MODE_DEC);
>   		a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
>   	}
>   
> @@ -963,7 +966,8 @@ static int a5psw_setup(struct dsa_switch *ds)
>   	}
>   
>   	/* Reset learn count to 0 */
> -	reg = A5PSW_LK_LEARNCOUNT_MODE_SET;
> +	reg = FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE,
> +			 A5PSW_LK_LEARNCOUNT_MODE_SET);
>   	a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
>   
>   	/* Clear VLAN resource table */

Hi Prabhakar,

It could probably be worth it to add a small a5psw_set_learncount() 
helper that contains these the FIELD_PREP + writel.

Otherwise, LGTM:

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

Thanks,

Clément


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

* Re: [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation
  2026-11-20  0:25 ` [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation Prabhakar
@ 2026-11-20  6:51   ` Clement Leger
  0 siblings, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  6:51 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable



On 11/20/26 01:25, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The MDC frequency is hclk / (2 * CLKDIV + 1) on RZ/N1 as well as
> RZ/T2H and RZ/N2H. The existing calculation uses the wrong divisor
> formula and can set MDC above the requested clock-frequency.
> 
> Calculate the smallest CLKDIV that keeps MDC at or below the requested
> frequency.
> 
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v4->v5:
> - New patch
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 7fd2652813ac..df3b3f75b489 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -11,6 +11,7 @@
>   #include <linux/if_bridge.h>
>   #include <linux/if_ether.h>
>   #include <linux/kernel.h>
> +#include <linux/math.h>
>   #include <linux/module.h>
>   #include <linux/of.h>
>   #include <linux/of_mdio.h>
> @@ -1104,7 +1105,7 @@ static int a5psw_mdio_config(struct a5psw *a5psw, u32 mdio_freq)
>   	u32 cfgstatus;
>   
>   	rate = clk_get_rate(a5psw->hclk);
> -	div = ((rate / mdio_freq) / 2);
> +	div = DIV_ROUND_UP(DIV_ROUND_UP(rate, mdio_freq) - 1, 2);
>   	if (div > FIELD_MAX(A5PSW_MDIO_CFG_STATUS_CLKDIV) ||
>   	    div < A5PSW_MDIO_CLK_DIV_MIN) {
>   		dev_err(a5psw->dev, "MDIO clock div %ld out of range\n", div);

LGTM,

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

Thanks,

Clément

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

* Re: [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe
  2026-11-20  0:25 ` [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe Prabhakar
@ 2026-11-20  6:53   ` Clement Leger
  0 siblings, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  6:53 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar,
	stable



On 11/20/26 01:25, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> a5psw_remove() and a5psw_shutdown() retrieve the driver private data
> using platform_get_drvdata(), but a5psw_probe() never sets it.
> Consequently, both callbacks return early without unregistering or
> shutting down the DSA switch.
> 
> Set the driver data in probe to ensure the remove and shutdown
> callbacks can access the private data and perform the required DSA
> cleanup.
> 
> Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v4->v5:
> - New patch
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index df3b3f75b489..0e4bbf34ec27 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -1221,6 +1221,7 @@ static int a5psw_probe(struct platform_device *pdev)
>   	if (!a5psw)
>   		return -ENOMEM;
>   
> +	platform_set_drvdata(pdev, a5psw);
>   	a5psw->dev = dev;
>   	mutex_init(&a5psw->lk_lock);
>   	spin_lock_init(&a5psw->reg_lock);

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

Thanks,

Clément

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

* Re: [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe()
  2026-11-20  0:25 ` [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
@ 2026-11-20  6:58   ` Clement Leger
  0 siblings, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  6:58 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar



On 11/20/26 01:25, Prabhakar wrote:
> 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>
> ---
> v4->v5:
> - No change
> 
> v3->v4:
> - No change
> 
> v2->v3:
> - No change
> 
> v1->v2:
> - 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 4b31a1d331e1..bccfadc1d5e6 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -1240,15 +1240,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;
>   	}
>   

Hi Prabhakar,

LGTM,

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

Thanks,

Clément

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

* Re: [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data
  2026-11-20  0:25 ` [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
@ 2026-11-20  7:02   ` Clement Leger
  0 siblings, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  7:02 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar



On 11/20/26 01:25, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> The driver previously assumed a fixed 5-port layout and derived the CPU
> port and number of PCS instances from this. Newer Renesas variants use
> different port counts. Although the CPU port remains the last port, the
> fixed port/PCS topology hard coded in the driver no longer matches all
> hardware.
> 
> Introduce an a5psw_of_data struct holding the per SoC switch info, and
> use this match data in place of the previously embedded constants. This
> makes the port loops, PCS allocation, management-port setup, and other
> topology dependent code reflect the switch layout selected by the
> compatible string.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v4->v5:
> - No change
> 
> v3->v4:
> - Added return value check for of_device_get_match_data
> 
> v2->v3:
> - Fixed typo in commit message: swicth -> switch
> 
> v1->v2:
> - Updated commit message
> - Renamed A5PSW_MAX_PORTS macro to A5PSW_MAX_NUM_PCS
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 31 ++++++++++++++++++++++---------
>   drivers/net/dsa/rzn1_a5psw.h | 20 +++++++++++++++++---
>   2 files changed, 39 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index bccfadc1d5e6..8d7cad90d613 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -384,13 +384,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 +929,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 */
> @@ -1154,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]);
>   	}
> @@ -1181,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;
>   		}
> @@ -1228,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)
> @@ -1277,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;
> @@ -1319,8 +1326,14 @@ 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,
> +};
> +
>   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..26d201931453 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,25 @@ 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
> + */
> +struct a5psw_of_data {
> +	unsigned int nports;
> +	unsigned int npcs;
> +	unsigned int cpu_port;
> +};
> +
>   /**
>    * 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 +265,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;

Hi Prabhakar,

LGTM,

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

Thanks,

Clément

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

* Re: [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
  2026-11-20  0:25 ` [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
@ 2026-11-20  7:03   ` Clement Leger
  0 siblings, 0 replies; 36+ messages in thread
From: Clement Leger @ 2026-11-20  7:03 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,
	Simon Horman, Philipp Zabel, Geert Uytterhoeven, Magnus Damm
  Cc: Florian Fainelli, Ralph Siemsen, linux-renesas-soc, netdev,
	devicetree, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar



On 11/20/26 01:25, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Prepare the A5PSW driver for forthcoming RZ/T2H ETHSW support by making
> the DSA tag protocol selectable through SoC match data. The RZ/N1 A5PSW
> and RZ/T2H ETHSW share the same tagged frame layout, but interpret the
> ControlData field differently, so the tag protocol cannot remain fixed.
> 
> The common tagged frame structure 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 ControlData semantics diverge between the two switch families:
> 
>    +---------+----------------------------------------------+
>    | SoC     | ControlData bits                             |
>    +---------+----------------------------------------------+
>    | 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 differences affect protocol semantics, select the tag
> format through compatible specific data. This allows the driver to
> choose the appropriate tagging protocol for each SoC while preserving
> the existing RZ/N1 behaviour.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v4->v5:
> - No change
> 
> v3->v4:
> - No change
> 
> v2->v3:
> - No change
> 
> v1->v2:
> - Updated commit message
> ---
>   drivers/net/dsa/rzn1_a5psw.c | 5 ++++-
>   drivers/net/dsa/rzn1_a5psw.h | 2 ++
>   2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 8d7cad90d613..c59d881ce10f 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,
> @@ -1330,6 +1332,7 @@ 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[] = {
> diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
> index 26d201931453..58690f5f3887 100644
> --- a/drivers/net/dsa/rzn1_a5psw.h
> +++ b/drivers/net/dsa/rzn1_a5psw.h
> @@ -236,11 +236,13 @@ union lk_data {
>    * @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;
>   };
>   
>   /**

Hi Prabhakar,

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

Thanks,

Clément

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

end of thread, other threads:[~2026-11-20  7:03 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20  0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 02/24] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 03/24] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 04/24] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 05/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 06/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 07/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
2026-11-20  3:27   ` Andrew Lunn
2026-11-20  6:01   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset Prabhakar
2026-11-20  3:29   ` Andrew Lunn
2026-11-20  0:25 ` [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation Prabhakar
2026-11-20  6:51   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe Prabhakar
2026-11-20  6:53   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
2026-11-20  3:32   ` Andrew Lunn
2026-11-20  0:25 ` [PATCH net-next v5 13/24] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
2026-11-20  6:58   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
2026-11-20  7:02   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
2026-11-20  7:03   ` Clement Leger
2026-11-20  0:25 ` [PATCH net-next v5 17/24] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 18/24] net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF data Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 19/24] net: dsa: rzn1-a5psw: Get VLAN_RES field layout " Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size " Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 21/24] net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 23/24] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-11-20  0:25 ` [PATCH net-next v5 24/24] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
2026-11-20  0:28 ` [PATCH net-next v5 00/24] Add ETHSW support for Renesas " netdev-bot+sinfo
2026-11-20  3:14 ` Jakub Kicinski

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