Skip to content

Commit 1ed3be9

Browse files
committed
net: dsa: add tag protocol definition and binding
Added tag protocol definition and binding. Signed-off-by: Yangbo Lu <[email protected]>
1 parent 29174d8 commit 1ed3be9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

dts/bindings/dsa/dsa.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
description: DSA Device
55

66
child-binding:
7-
description: Properties of slave port
7+
description: Properties of port
88

99
include:
1010
- name: pinctrl-device.yaml
@@ -25,3 +25,10 @@ child-binding:
2525
description:
2626
A phandle to a valid Ethernet device node. This host
2727
device is what the switch port is connected to.
28+
tag-protocol:
29+
type: string
30+
description:
31+
Tag protocol the switch using. Or the switch supports no tag way
32+
if it's not specified on CPU port.
33+
enum:
34+
- "netc"

include/zephyr/net/dsa_core.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ extern "C" {
7575
}; \
7676
DT_INST_FOREACH_CHILD_STATUS_OKAY_VARGS(n, fn, n);
7777

78+
#define DSA_TAG_PROTO_NONE 0
79+
#define DSA_TAG_PROTO_NETC 1
80+
81+
#define DSA_TAG_PROTO_BY_DT(node_id) \
82+
(DT_ENUM_HAS_VALUE(node_id, tag_protocol, netc) ? DSA_TAG_PROTO_NETC : DSA_TAG_PROTO_NONE)
83+
7884
/** DSA switch context data */
7985
struct dsa_switch_context {
8086
/** Pointers to all DSA user network interfaces */
@@ -137,6 +143,8 @@ struct dsa_port_config {
137143
const struct device *phy_dev;
138144
/** PHY mode */
139145
const char *phy_mode;
146+
/** Tag protocol */
147+
const int tag_proto;
140148
/** Ethernet device connected to the port */
141149
const struct device *ethernet_connection;
142150
/** Instance specific config */

0 commit comments

Comments
 (0)