* [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs
@ 2026-10-14 13:18 Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
` (12 more replies)
0 siblings, 13 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi All,
This series of patches adds support for the Renesas RZ/T2H and RZ/N2H SoCs
which integrate an Ethernet switch IP variant called ETHSW. The ETHSW is
largely compatible with the A5PSW switch found on RZ/N1 SoCs, but has
several key differences in register layout and hardware configuration. The
series includes updates to the DSA driver, device tree bindings, and
Kconfig to enable support for these SoCs.
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
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 (13):
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
dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond
port@4
dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW
support
net: dsa: rzn1-a5psw: Add support for optional reset control
net: dsa: rzn1-a5psw: Add support for optional timestamp clock
net: dsa: rzn1-a5psw: Make use dev_err_probe()
net: dsa: rzn1-a5psw: Get switch 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: 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 | 166 +++++++++++++++---
drivers/net/dsa/Kconfig | 9 +-
drivers/net/dsa/rzn1_a5psw.c | 79 +++++++--
drivers/net/dsa/rzn1_a5psw.h | 25 ++-
include/net/dsa.h | 2 +
include/uapi/linux/if_ether.h | 2 +-
net/dsa/Kconfig | 9 +-
net/dsa/tag_rzn1_a5psw.c | 22 ++-
8 files changed, 261 insertions(+), 53 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 02/13] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 02/13] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 03/13] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
` (10 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 5d12191b6f6f..57143cf52f89 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -62,6 +62,7 @@ struct tc_action;
#define DSA_TAG_PROTO_KSZ8463_VALUE 34
#define DSA_TAG_PROTO_MT7628_VALUE 35
#define DSA_TAG_PROTO_KS8995_VALUE 36
+#define DSA_TAG_PROTO_RZT2H_ETHSW_VALUE 37
enum dsa_tag_protocol {
DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE,
@@ -101,6 +102,7 @@ enum dsa_tag_protocol {
DSA_TAG_PROTO_KSZ8463 = DSA_TAG_PROTO_KSZ8463_VALUE,
DSA_TAG_PROTO_MT7628 = DSA_TAG_PROTO_MT7628_VALUE,
DSA_TAG_PROTO_KS8995 = DSA_TAG_PROTO_KS8995_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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 03/13] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 02/13] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4 Prabhakar
` (9 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 4f44bf3ede23..88e181ad4cc3 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -188,11 +188,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (2 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 03/13] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 05/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
` (8 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Restrict the A5PSW ethernet-ports node to ports 0 through 4, matching the
hardware configuration of four external ports and one CPU/management port.
Although the schema pattern limits port nodes to port@0 through port@4,
additionalProperties: true allows other port nodes to pass validation.
Set additionalProperties to false and explicitly allow #address-cells
and #size-cells so that ports beyond port@4 are rejected.
Existing in-tree device trees describe only port@0 through port@4 and
are unaffected by this change.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2->v3:
- New patch
---
.../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml | 9 ++++++++-
1 file changed, 8 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..c5e652c057a9 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -61,7 +61,14 @@ properties:
ethernet-ports:
type: object
- additionalProperties: true
+ additionalProperties: false
+
+ properties:
+ '#address-cells':
+ const: 1
+ '#size-cells':
+ const: 0
+
patternProperties:
"^(ethernet-)?port@[0-4]$":
type: object
--
2.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 05/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (3 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4 Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 06/13] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
` (7 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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.
Add a dedicated compatible for RZ/T2H and use it as the fallback
compatible for RZ/N2H, since both SoCs integrate the same ETHSW IP.
Also make interrupts and interrupt-names required for all supported
variants. The existing RZ/N1 SoC DTSI already provides both properties,
so this change does not require updates to existing RZ/N1 device trees.
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>
---
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 | 157 +++++++++++++++---
1 file changed, 133 insertions(+), 24 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index c5e652c057a9..af3b64320fa5 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
@@ -50,14 +115,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
@@ -80,14 +152,51 @@ properties:
phandle pointing to a PCS sub-node compatible with
renesas,rzn1-miic.yaml#
-unevaluatedProperties: false
-
required:
- compatible
- reg
- clocks
- clock-names
- power-domains
+ - 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@4$": false
+ required:
+ - resets
+ else:
+ properties:
+ interrupts:
+ maxItems: 5
+ interrupt-names:
+ maxItems: 5
+ clocks:
+ maxItems: 2
+ clock-names:
+ maxItems: 2
+ resets: false
+
+unevaluatedProperties: false
examples:
- |
--
2.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 06/13] net: dsa: rzn1-a5psw: Add support for optional reset control
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (4 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 05/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 07/13] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
` (6 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 85ff1fd2bbfb..9daa5d8245df 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -13,6 +13,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"
@@ -1207,6 +1208,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;
@@ -1243,6 +1245,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 07/13] net: dsa: rzn1-a5psw: Add support for optional timestamp clock
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (5 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 06/13] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 08/13] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
` (5 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 9daa5d8245df..846216f22bc3 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1212,6 +1212,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(dev, sizeof(*a5psw), GFP_KERNEL);
@@ -1245,6 +1246,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 08/13] net: dsa: rzn1-a5psw: Make use dev_err_probe()
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (6 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 07/13] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
` (4 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 846216f22bc3..bdfa84745eda 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1234,15 +1234,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (7 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 08/13] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
` (3 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 | 27 ++++++++++++++++++---------
drivers/net/dsa/rzn1_a5psw.h | 20 +++++++++++++++++---
2 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index bdfa84745eda..c8197ef62fd2 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -382,13 +382,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;
}
@@ -924,20 +925,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 */
@@ -1149,7 +1151,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]);
}
@@ -1176,7 +1178,7 @@ static int a5psw_pcs_get(struct a5psw *a5psw)
goto free_pcs;
}
- if (reg >= ARRAY_SIZE(a5psw->pcs)) {
+ if (reg >= a5psw->of_data->npcs) {
ret = -ENODEV;
goto free_pcs;
}
@@ -1226,7 +1228,8 @@ static int a5psw_probe(struct platform_device *pdev)
if (IS_ERR(a5psw->base))
return PTR_ERR(a5psw->base);
- a5psw->bridged_ports = BIT(A5PSW_CPU_PORT);
+ a5psw->of_data = of_device_get_match_data(dev);
+ a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
ret = a5psw_pcs_get(a5psw);
if (ret)
@@ -1271,7 +1274,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;
@@ -1313,8 +1316,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 d54acedac194..197ff5916578 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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (8 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
` (2 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 c8197ef62fd2..0b0b4055e615 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -97,7 +97,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,
@@ -1320,6 +1322,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 197ff5916578..e952afd95dca 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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (9 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
@ 2026-10-14 13:18 ` Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-10-14 13:19 ` [PATCH net-next v3 13/13] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
12 siblings, 1 reply; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:18 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 | 18 +++++++++++++++++-
drivers/net/dsa/rzn1_a5psw.h | 3 +++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 0b0b4055e615..30eca64fb218 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -209,8 +209,13 @@ 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);
return 0;
@@ -990,8 +995,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 e952afd95dca..5bec33b23079 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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (10 preceding siblings ...)
2026-10-14 13:18 ` [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
@ 2026-10-14 13:19 ` Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 13/13] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
12 siblings, 1 reply; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:19 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, Prabhakar,
Biju Das, Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Add device tree match data and configuration for the Renesas RZ/T2H
SoC Ethernet switch. The RZ/T2H uses the same A5PSW switch IP as RZ/N1
but with four ports, the DSA tagging protocol `DSA_TAG_PROTO_RZT2H_ETHSW`,
and an additional 8-byte management port frame length adjustment.
This prepares the driver to handle RZ/T2H and compatible RZ/N2H
Ethernet switch instances.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2->v3:
- No change
v1->v2:
- No change
---
drivers/net/dsa/rzn1_a5psw.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 30eca64fb218..933589084eea 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1334,6 +1334,14 @@ 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,
+};
+
static const struct a5psw_of_data rzn1_of_data = {
.nports = 5,
.npcs = 4,
@@ -1342,6 +1350,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v3 13/13] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
` (11 preceding siblings ...)
2026-10-14 13:19 ` [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
@ 2026-10-14 13:19 ` Prabhakar
12 siblings, 0 replies; 19+ messages in thread
From: Prabhakar @ 2026-10-14 13:19 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, Vladimir Oltean, David S. Miller,
Clément Léger, Eric Dumazet, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Simon Horman, Philipp Zabel,
Russell King, Geert Uytterhoeven, Magnus Damm
Cc: linux-renesas-soc, netdev, devicetree, linux-kernel, 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>
---
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 fe8cd5338fda..f6894495b9ed 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -101,13 +101,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.55.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4
2026-10-14 13:18 ` [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4 Prabhakar
@ 2026-10-15 13:19 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-10-15 13:19 UTC (permalink / raw)
To: Prabhakar; +Cc: devicetree, robh, conor+dt, wsa+renesas
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: net: dsa: incomplete schema validation allows bypassing port restrictions via ports node
--
commit b100423001348cf87abe9e11b4f74d424451c2db
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4
Restrict the A5PSW ethernet-ports node to ports 0 through 4, matching the
hardware configuration of four external ports and one CPU/management port.
> diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> index fab6aa6237e93..c5e652c057a94 100644
> --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> @@ -61,7 +61,14 @@ properties:
>
> ethernet-ports:
> type: object
> - additionalProperties: true
> + additionalProperties: false
[Severity: Low]
Does this schema allow bypassing the port restrictions if a device tree uses
a node named ports instead of ethernet-ports?
Because dsa.yaml allows either ports or ethernet-ports, and the schema
doesn't list ethernet-ports in the required properties, a devicetree could
define a ports node with a port outside the 0-4 range (e.g. port@5) and
silently pass validation.
The driver in drivers/net/dsa/rzn1_a5psw.c has a hard dependency on
ethernet-ports:
drivers/net/dsa/rzn1_a5psw.c:a5psw_pcs_get() {
...
ports = of_get_child_by_name(a5psw->dev->of_node, "ethernet-ports");
if (!ports)
return -EINVAL;
...
}
Should ethernet-ports be added to the required properties list to ensure the
validation rules are properly enforced?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data
2026-10-14 13:18 ` [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
@ 2026-10-15 13:19 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-10-15 13:19 UTC (permalink / raw)
To: Prabhakar; +Cc: devicetree, robh, conor+dt, wsa+renesas
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: dsa: rzn1-a5psw: missing NULL check for of_device_get_match_data
--
commit d0e877d4584f59434a728598a2547f8f5e97b982
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Get switch info via OF data
This commit introduces an a5psw_of_data structure to hold per-SoC switch
information, replacing previously embedded constants to support newer hardware
variants with different port counts.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index bdfa84745eda4..c8197ef62fd2d 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
[ ... ]
> @@ -1226,7 +1228,8 @@ static int a5psw_probe(struct platform_device *pdev)
> if (IS_ERR(a5psw->base))
> return PTR_ERR(a5psw->base);
>
> - a5psw->bridged_ports = BIT(A5PSW_CPU_PORT);
> + a5psw->of_data = of_device_get_match_data(dev);
> + a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
[Severity: High]
Does this code dereference a NULL pointer if the driver is bound via sysfs?
If a privileged user manually binds the driver to a platform device via sysfs
(e.g., using /sys/bus/platform/drivers/rzn1_a5psw/bind) that lacks a device
tree node (dev->of_node is NULL), of_device_get_match_data() will return NULL.
Since a5psw->of_data is dereferenced immediately on the next line in
a5psw_probe() without any validation, this could lead to a kernel panic during
probe. Could a check be added here to safely handle a missing OF match?
>
> ret = a5psw_pcs_get(a5psw);
> if (ret)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=9
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
2026-10-14 13:18 ` [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
@ 2026-10-15 13:19 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-10-15 13:19 UTC (permalink / raw)
To: Prabhakar; +Cc: devicetree, robh, conor+dt, wsa+renesas
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net: dsa: rzn1-a5psw: null pointer deref in probe on sysfs bind
- [Medium] net: dsa: tag_rzn1_a5psw: broken module auto-loading due to incorrect macro protocol ID
--
commit fb10d951639e543773ea24357094717bd055958c
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
This commit makes the DSA tag protocol selectable through SoC match data
to prepare the driver for the forthcoming RZ/T2H ETHSW support. It uses
the compatible string to select the appropriate tagging protocol while
preserving the existing RZ/N1 behavior.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 85ff1fd2bbfba..0b0b4055e6155 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -1223,7 +1230,8 @@ static int a5psw_probe(struct platform_device *pdev)
> if (IS_ERR(a5psw->base))
> return PTR_ERR(a5psw->base);
>
> - a5psw->bridged_ports = BIT(A5PSW_CPU_PORT);
> + a5psw->of_data = of_device_get_match_data(dev);
> + a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
[Severity: High]
Does this code cause a NULL pointer dereference?
If the platform device is bound via sysfs, the device is matched by driver
name rather than via device tree. In this case, of_device_get_match_data(dev)
will return NULL in a5psw_probe(), leaving a5psw->of_data as NULL.
When BIT(a5psw->of_data->cpu_port) is evaluated, it will dereference the NULL
pointer, which transforms a previously safe error path into a panic.
[ ... ]
> diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
> index 734910156dc33..3dff661fa58cb 100644
> --- a/net/dsa/tag_rzn1_a5psw.c
> +++ b/net/dsa/tag_rzn1_a5psw.c
> @@ -112,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);
[Severity: Medium]
Is this macro protocol ID correct?
The protocol macro DSA_TAG_PROTO_A5PSW does not exist. The correct macro
is DSA_TAG_PROTO_RZN1_A5PSW.
Because DSA_TAG_PROTO_A5PSW_VALUE is undefined, the C preprocessor stringifies
it literally as "DSA_TAG_PROTO_A5PSW_VALUE" rather than expanding it to "26".
This causes the module alias to be registered as
"dsa_tag:id-DSA_TAG_PROTO_A5PSW_VALUE" instead of "dsa_tag:id-26", which
breaks module auto-loading for the tag driver.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=10
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
2026-10-14 13:18 ` [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
@ 2026-10-15 13:19 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-10-15 13:19 UTC (permalink / raw)
To: Prabhakar; +Cc: devicetree, robh, conor+dt, wsa+renesas
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: dsa: missing NULL check for of_device_get_match_data()
--
commit 8d40702613d22f005a1af76ac95b3654ab3e2d50
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port
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.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 0b0b4055e6155..30eca64fb2183 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -209,8 +209,13 @@ 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;
[Severity: Medium]
Since this code relies on a5psw->of_data, could there be a NULL pointer
dereference if the device is bound manually via sysfs without a matching
device tree node?
Looking at a5psw_probe() where a5psw->of_data is initialized:
a5psw->of_data = of_device_get_match_data(dev);
a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
If a user with root privileges binds the driver via sysfs (using
driver_override and bind) without a matching device tree node,
of_device_get_match_data() returns NULL. Does this cause an immediate
crash when accessing cpu_port during probe?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=11
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
2026-10-14 13:19 ` [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
@ 2026-10-15 13:19 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-10-15 13:19 UTC (permalink / raw)
To: Prabhakar; +Cc: devicetree, robh, conor+dt, wsa+renesas
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: dsa: mismatch between commit message and frame length adjustment
--
commit c8c80059b5db71015db86eaff104015c66bd88b0
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch
This commit adds device tree match data and configuration for the Renesas
RZ/T2H SoC Ethernet switch. It configures the switch for four ports and
specifies the DSA tagging protocol along with management port frame length
settings.
> Add device tree match data and configuration for the Renesas RZ/T2H
> SoC Ethernet switch. The RZ/T2H uses the same A5PSW switch IP as RZ/N1
> but with four ports, the DSA tagging protocol `DSA_TAG_PROTO_RZT2H_ETHSW`,
> and an additional 8-byte management port frame length adjustment.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 30eca64fb2183..933589084eea3 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -1334,6 +1334,14 @@ 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,
[Severity: Medium]
Is the description in the commit message accurate?
The commit message mentions an "additional 8-byte management port frame length
adjustment", but the code here assigns a fixed maximum frame length of 0x3fff
(16383 bytes) to management_port_fixed_frame_len and contains no 8-byte
adjustment logic.
Could the commit message be updated to match the 0x3fff fixed assignment, or
is the 8-byte adjustment logic missing from the implementation?
> +};
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=12
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2026-10-15 13:19 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 02/13] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 03/13] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4 Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 05/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 06/13] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 07/13] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 08/13] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 13/13] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.