DSA switch connection to CPU

Hello,

My custom board has an NXP LS1012A processor (2 MACs). .
I have the first MAC connected via SGMII to a single Marvell PHY chip.
The second MAC is connected via RGMII to a Broadcom BCM53128 switch chip.

I'm using the DSA version of the b53 driver and SPI. Most things are working fine, but I haven't been able to ping a PC connected to any of the 8 ports on the switch.

The output of "ip link" is shown below. I was expecting eth0 to be the single port Marvell and eth1 to be connected to the 8 LAN ports, but each "lan" port shows "@eth0". Why? Where is that association made? Can it be changed?

I've read other posts that say DSA only works with one (eth0) port. Is my configuration all wrong?

Any help would be greatly appreciated,
Joel

2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:04:9f:06:75:9f brd ff:ff:ff:ff:ff:ff
4: lan1@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: lan2@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
6: lan3@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
7: lan4@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
8: lan5@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
9: lan6@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
10: lan7@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
11: lan8@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

Are you sure that eth0 is Marvell's MAC? Check the kernel log.

I can bring up eth0 and plug a cable into the single port that's attached to the Marvell chip, then I can ping through that port to a PC. So everything seems good there.

I'm trying everything to get eth1 working with the Broadcom switch and all 8 of its ports. But when I did "ip link" I saw that the 8 ports were "@eth0". I don't understand.

Thanks for the reply.

In the device tree, is ethernet property of the DSA CPU port configured?

I have dsa,ethernet = <&pfe_mac1>, which is supposed to be the second of the two MAC ports. The one I'm calling eth1. See below.
That's why I was surprised to see "lan1@eth0" when I did "ip link". Am I missing something else?

Thanks,
Joel

#include "fsl-ls1012a.dtsi"

/ {
	model = "LS1012A RDB Board";
	compatible = "fsl,ls1012a-rdb", "fsl,ls1012a";

	aliases {
//		ethernet0 = &pfe_mac0;
		eth0 = &pfe_mac1;
	};
};

&pcie {
	status = "okay";
};

&duart0 {
	status = "okay";
};

&esdhc0 {
	sd-uhs-sdr104;
	sd-uhs-sdr50;
	sd-uhs-sdr25;
	sd-uhs-sdr12;
	status = "okay";
};

&esdhc1 {
	mmc-hs200-1_8v;
	status = "okay";
};

&i2c0 {
	status = "okay";
};

&sata {
	status = "okay";
};

&pfe {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;

	pfe_mac0: ethernet@0 {
		compatible = "fsl,pfe-gemac-port";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x0>;	/* GEM_ID */
		fsl,pfe-gemac-if-name = "eth0";  
		fsl,mdio-mux-val = <0x0>;
		phy-mode = "sgmii";
		phy-handle = <&sgmii_phy>;
	};

	pfe_mac1: ethernet@1 {
		compatible = "fsl,pfe-gemac-port";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x1>;	/* GEM_ID */
		fsl,pfe-gemac-if-name = "eth1";
		phy-mode = "rgmii-txid";
		fixed-link {
		    speed = <1000>;
         	    full-duplex;
     	 	};
	};
	mdio@0 {
		#address-cells = <1>;
		#size-cells = <0>;

		sgmii_phy: ethernet-phy@1 {   // Marvell PHY at address 1
			reg = <0x1>;         
		};
	};
};

&dspi {
	status = "okay";
	bus-num = <2>;
	pinctrl-names = "default";	

	switch0: ethernet-switch@0 {
		compatible = "brcm,bcm53128";
		reg = <0x0>;  // Chip select 0
		//dsa,member = <0 0>;
		dsa,ethernet = <&pfe_mac1>;
		spi-max-frequency = <20000000>;
		spi-cpol;
		spi-cpha;
		status = "okay";
			
			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				
				port0@0 {
					reg = <0>;
					label = "lan1";
				};
				port1@1 {
					reg = <1>;
					label = "lan2";
				};
				port2@2 {
					reg = <2>;
					label = "lan3";
				};
				port3@3 {
					reg = <3>;
					label = "lan4";
				};
				port4@4 {
					reg = <4>;
					label = "lan5";
				};
				port5@5 {
					reg = <5>;
					label = "lan6";
				};
				port6@6 {
					reg = <6>;
					label = "lan7";
				};
				port7@7 {
					reg = <7>;
					label = "lan8";
				};
				port8@8 {
					reg = <8>;
					label = "cpu";
					ethernet = <&pfe_mac1>;
					fixed-link {
						speed = <1000>;
						duplex-full;
					};
				};
			};
	};
};

Oh no, you don't need dsa,ethernet property at the root node, you probably saw an outdated document.
What you need is ethernet at CPU port node.

I actually have it at both locations now. I assume my "port8" looks correct? I'll remove it from the root.

Thanks for the replies.

@jclasquin may I ask what you set the dts file now? Thanks

I'm using realtek dsa switch to rgmii port

Yep, that's right.

@jclasquin You might also find a good upstream DSA example here:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/boot/dts/armada-381-netgear-gs110emx.dts#n150