[PATCH net-next v2 09/12] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
From: Prabhakar
Date: Thu Oct 01 2026 - 11:53:46 EST
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxx>
---
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