Does any one can discribe the usage of mvsw61xx in device tree?

this is a part of device tree for ea3500, so two quesions:

-------------------part one-----------------------

+
+	mvsw61xx {
+		compatible = "marvell,88e6171";
+		status = "okay";
+		reg = <0x10>;
+
+		mii-bus = <&mdio>;
+		cpu-port-0 = <5>;
+		cpu-port-1 = <6>;
+		is-indirect;
+	};
+

-----------------------part 2------------------

+	dsa {
+		compatible = "marvell,dsa";
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		dsa,ethernet = <&eth0port>;
+		dsa,mii-bus = <&mdio>;
+
+		switch@16,0 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <16 0>;	/* MDIO address 16, switch 0 in tree */
+
+			port@0 {
+				reg = <0>;
+				label = "ethernet1";
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "ethernet2";
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "ethernet3";
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "ethernet4";
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "internet";
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "cpu";
+			};
+		};
+	};
+};
+

first one question,part 2 binding method is out of date, why still used there?
second one, can any one explain the format of part1? and does part 1 used with dsa binding together or can be used alone? if it can used with new binding?

In kirkwood target there is no DSA driver compiled now. So dsa part of dts is unused.

I can try help You with Your problems. Please paste link of Your changes and I will look why is wrong.

so,3 questions.
1.in mvebu, there is dsa driver in 4.14or 4.19(I see in config-4.14),

CONFIG_NET_DSA=y
CONFIG_NET_DSA_MV88E6XXX=y
CONFIG_NET_DSA_MV88E6XXX_GLOBAL2=y
# CONFIG_NET_DSA_MV88E6XXX_PTP is not set
CONFIG_NET_DSA_TAG_DSA=y
CONFIG_NET_DSA_TAG_EDSA=y
CONFIG_NET_SWITCHDEV=y

does the dsa used tag protocol conflict with 802.1q vlan?

I thought dsa driver use one cpu port to make a tree of switch, to expose each slave phy port, and the 802.1q controls vlans , am swconfig controls vlan table inside the 6171, so don't conflict Am I right?

linksys,caiman|\
linksys,cobra|\
linksys,mamba|\
linksys,rango|\
linksys,shelby|\
linksys,venom)
	ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
	ucidef_add_switch "switch0" \
		"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1"
	;;

take an example as 0:lan:4, what is the second ":" mean, the first 0 is port number.
and what is 5@eth0 port 5?@means connected to cpu?
3.I take a look on source code of mvsw61xx.c

	if (of_property_read_u32(np, "cpu-port-0", &val)) {
		dev_err(&pdev->dev, "CPU port not set\n");
		err = -ENODEV;
		goto out_err;
	}

	state->cpu_port0 = val;

	if (!of_property_read_u32(np, "cpu-port-1", &val))
		state->cpu_port1 = val;
	else
		state->cpu_port1 = -1;

	state->dev.vlans = MV_VLANS;
	state->dev.cpu_port = state->cpu_port0;
	state->dev.ports = MV_PORTS;
	state->dev.name = model_str;
	state->dev.ops = &mvsw61xx_ops;
	state->dev.alias = dev_name(&pdev->dev);

	_mvsw61xx_reset(&state->dev, true);

	err = register_switch(&state->dev, NULL);
	if (err < 0)
		goto out_err;

	state->registered = true;

	return 0;
out_err:
	kfree(state);
	return err;
}

to set cpu port 0 just affect "state->dev.cpu_port = state->cpu_port0;" in mvsw61xx then "if (nla_put_u32(msg, SWITCH_ATTR_CPU_PORT, dev->cpu_port))" in swconfig.c

to set cpu port1 affect

 if (!of_property_read_u32(np, "cpu-port-1", &val))
		state->cpu_port1 = val;

and no following. so what the function it is?

I drive 6171 with kernel dsa without mvsw61xx got lan1 lan2 lan3 lan4 and wan, I tried
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 " "wan"
it works. is lan1 lan2... and wan isolated by the switch internal tag protocol?

thanks!!
btw:
my device seems has problem,


+					port@5 {
+						reg = <5>;
+						label = "cpu";
+						ethernet = <&eth1port>;
+						**phy-mode = "rgmii-id";**
+						fixed-link {
+							speed = <1000>;
+							full-duplex;
+						};
+					};
+					port@6 {
+						reg = <6>;
+						label = "aux";
+						ethernet = <&eth0port>;
+						fixed-link {
+							speed = <1000>;
+							full-duplex;
+						};
+					};
+				};
+

I try dsa driver with switch port 5 and port 6 each time with one port as cpu port . port 5 must to use phy-mode = "rgmii-id"; otherwise no receive package, is it due to hardware design bug? port 6 always ok.

do you know some kernel dsa driver information on dual cpu port? I guess in the future openwrt will take kernel dsa driver as main driver.
what is dual cpu ports' advantage ? I guess should be advance but I don't know exact advantages.

the last question I have known about it is about rgmii clock delay between mac and phy. my cpu is marvell 6281,I don't know how to adjust the 6281's internal delay,only changed 6171 switch side. However I could not know how to deal with it if only use mvsw61xx. I don't know whether this problem exist when using mvsw61xx and how to solve it.

You can use DSA driver with DSA tagging and vlan filtering. Here You can find example:
https://www.kernel.org/doc/html/latest/networking/dsa/configuration.html

DSA driver is complete solution from mainline kernel. But OpenWrt does not support dsa vlan filtering from config.
mvsw61xx is another switch driver architecture. It is used for switch configuring only. But is fully supported in OpenWrt. You can't use both drivers simultaneously.

First is switch port number, second is number from router case.

@ means that this port is connected to cpu interface. After @ You write name of connected interface.

I'm not sure, but is chance, that 88e6171 can have only one CPU port in registers. This function configure second cpu port in driver structures only.

DSA uses dsa tagging for interface separation. Switch add trailer tag for ingress traffic and CPU know from witch port it comes. So You can have fully separated interfaces.

PCB designer didn't align rgmii phase. So You must fix it by delay in driver.

DSA support one cpu port only. If You want use two ports, use mvsw61xx.

I'm afraid, that driver isn't support it now. But it should be easy to add.