The new style DSA DTB is documented here for: https://www.kernel.org/doc/Documentation/devicetree/bindings/net/dsa/dsa.txt
This new format is used by the ESPRESSObin dts: https://github.com/freebsd/freebsd/blob/5a7b66a89ee821edb7c05a71a4ba8d30c083f233/sys/gnu/dts/arm64/marvell/armada-3720-espressobin.dts
Which means there is no longer a top-level "marvell,dsa" OFW node, and instead we need to look up the switch directly, and follow the xref if necessary.
This fixes the mvneta_if code that looks to see if it has a switch attached, currently it only looks for a single switch type, I am not sure if there is a better way, but we likely need to walk the whole ofw tree looking for xrefs to ourselves (assuming there is no function out there to do that work for us?)
Second I've fixed the e6000sw to use the same method for finding its switch node, with the change we also get the ability to just look for a child named "ports" and then iterate over the ports themselves individually. I've updated the code that parses the port information as well to use xref to look up the referenced ethernet port to be able to configure the fixed-link (although someone with more experience with device tree bindings/DSA please chime in if that is incorrect).
Last but not least, I've changed the multi_chip selection scheme to not check if the sw_addr is a multiple of 2. This was causing failures to identify the switch correctly on my ESPRESSObin v7 because it would incorrectly go into single chip addressing mode, which meant it was failing to attach to the device correctly.
This is the kernel configuration used for testing:
# # ESPRESSO -- Generic kernel configuration file for FreeBSD/arm64 for the ESPRESSObin # # $FreeBSD: head/sys/arm64/conf/GENERIC-UP 325096 2017-10-29 08:17:03Z eadler $ include GENERIC ident ESPRESSO device etherswitch device miiproxy device iicbus device mdio device e6000sw
mvneta0: <NETA controller> mem 0x30000-0x33fff irq 14 on simplebus1 mvneta0: version is 10 mvneta0: Could not acquire MAC address. Using randomized one. mvneta0: bpf attached mvneta0: Ethernet address: 74:41:f8:a1:9d:00 mvneta0: This device is attached to a switch mdio0: <MDIO> on mvneta0 e6000sw0: Found switch_node: 0x147c e6000sw0: Found switch_node: 0x147c e6000sw0: <Marvell 88E6341> on mdio0 e6000sw0: multi-chip addressing mode e6000sw0: CPU port at 0 e6000sw0: fixed port at 0 e6000sw0: PHY at port 1 miibus0: <MII bus> on e6000sw0 e1000phy0: <Marvell 88E1000 Gigabit PHY> PHY 17 on miibus0 e1000phy0: OUI 0x000ac2, model 0x0000, rev. 1 e1000phy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto e6000sw0: PHY at port 2 miibus1: <MII bus> on e6000sw0 e1000phy1: <Marvell 88E1000 Gigabit PHY> PHY 18 on miibus1 e1000phy1: OUI 0x000ac2, model 0x0000, rev. 1 e1000phy1: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto e6000sw0: PHY at port 3 miibus2: <MII bus> on e6000sw0 e1000phy2: <Marvell 88E1000 Gigabit PHY> PHY 19 on miibus2 e1000phy2: OUI 0x000ac2, model 0x0000, rev. 1 e1000phy2: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto etherswitch0: <Switch controller> on e6000sw0 mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
etherswitch0: VLAN mode: PORT port0: flags=1<CPUPORT> media: Ethernet 1000baseT <full-duplex> status: active port1: flags=0<> media: Ethernet autoselect (none) status: no carrier port2: flags=0<> media: Ethernet autoselect (none) status: no carrier port3: flags=0<> media: Ethernet autoselect (1000baseT <full-duplex,master>) status: active port4: flags=0<> media: <unknown type> status: no carrier port5: flags=0<> media: <unknown type> status: no carrier vlangroup0: port: 0 members 1,2,3 vlangroup1: port: 1 members 0,2,3 vlangroup2: port: 2 members 0,1,3 vlangroup3: port: 3 members 0,1,2
Do note: I have yet to figure out how to get etherswitch hooked up into the rest of the networking in PORT mode (all I can find is docs for dot1q, which is not yet supported by the e6000sw code, and I don't have access to a data sheet), so at this point while the e6000sw is up and running, I have yet to get it to pass packets (and the mvneta0 interface doesn't seem to either).
Help or pointers would be greatly appreciated, etherswitch is woefully under documented.