Hi Yiping
Thank you for your hints, which put me in the right direction. I also understand now, that it's important to specify a fixed speed of 1000Mb/s for the MAC. It's because the phy software emulation doesn't understand 2500Mb/s currently. So this is the device tree, which makes the MAC2 over the SerDes lane B between the SoC and the mv88e6341 working.
&fman0 {
ethernet@e2000 {
phy-connection-type = "sgmii-2500";
fixed-link {
speed = <1000>;
full-duplex;
};
};
mdio@fc000 {
switch0: switch0@0 {
compatible = "marvell,mv88e6341";
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
interrupts-extended = <&extirq 11 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port5: port@5 {
reg = <5>;
label = "cpu";
phy-mode = "2500base-x";
ethernet = <&fman0_rx_0x09>;
local-mac-address = [42 00 00 00 00 80];
fixed-link {
speed = <2500>;
full-duplex;
};
};
port@1 {
reg = <1>;
label = "swp0";
phy-handle = <&switch0phy1>;
local-mac-address = [42 00 00 00 00 81];
};
port@2 {
reg = <2>;
label = "swp1";
phy-handle = <&switch0phy2>;
local-mac-address = [42 00 00 00 00 82];
};
port@3 {
reg = <3>;
label = "swp2";
phy-handle = <&switch0phy3>;
local-mac-address = [42 00 00 00 00 83];
};
port@4 {
reg = <4>;
label = "swp3";
phy-handle = <&switch0phy4>;
local-mac-address = [42 00 00 00 00 84];
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
switch0phy1: switch0phy0@11 {
reg = <0x11>;
};
switch0phy2: switch0phy1@12 {
reg = <0x12>;
};
switch0phy3: switch0phy2@13 {
reg = <0x13>;
};
switch0phy4: switch0phy3@14 {
reg = <0x14>;
};
};
};
};
};
As you can see above the Marvell 88e6341's SGMII cpu port is port 5. And for some reasons I still don't fully understand, I had to disable the C_MODE configuration for port 5, which would otherwise run into a timeout.
index 8ef81f2dc..db669b77c 100644
--- a/packages/linux/linux/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/packages/linux/linux/drivers/net/dsa/mv88e6xxx/chip.c
@@ -624,12 +624,14 @@ int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, int link,
}
- if (chip->info->ops->port_set_cmode) {
- err = chip->info->ops->port_set_cmode(chip, port, mode);
- if (err && err != -EOPNOTSUPP)
- goto restore_link;
- }
+ if (port!=5) {
+ if (chip->info->ops->port_set_cmode) {
+ err = chip->info->ops->port_set_cmode(chip, port, mode);
+ if (err && err != -EOPNOTSUPP)
+ goto restore_link;
+ }
+ }
err = 0;
But now the switch is working properly and can be configured from userspace using tools such as ip or bridge. Thanks a lot.