1*4882a593SmuzhiyunMediatek MT7530 Ethernet switch 2*4882a593Smuzhiyun================================ 3*4882a593Smuzhiyun 4*4882a593SmuzhiyunRequired properties: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun- compatible: may be compatible = "mediatek,mt7530" 7*4882a593Smuzhiyun or compatible = "mediatek,mt7621" 8*4882a593Smuzhiyun or compatible = "mediatek,mt7531" 9*4882a593Smuzhiyun- #address-cells: Must be 1. 10*4882a593Smuzhiyun- #size-cells: Must be 0. 11*4882a593Smuzhiyun- mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part 12*4882a593Smuzhiyun on multi-chip module belong to MT7623A has or the remotely standalone 13*4882a593Smuzhiyun chip as the function MT7623N reference board provided for. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunIf compatible mediatek,mt7530 is set then the following properties are required 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun- core-supply: Phandle to the regulator node necessary for the core power. 18*4882a593Smuzhiyun- io-supply: Phandle to the regulator node necessary for the I/O power. 19*4882a593Smuzhiyun See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt 20*4882a593Smuzhiyun for details for the regulator setup on these boards. 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunIf the property mediatek,mcm isn't defined, following property is required 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun- reset-gpios: Should be a gpio specifier for a reset line. 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunElse, following properties are required 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun- resets : Phandle pointing to the system reset controller with 29*4882a593Smuzhiyun line index for the ethsys. 30*4882a593Smuzhiyun- reset-names : Should be set to "mcm". 31*4882a593Smuzhiyun 32*4882a593SmuzhiyunRequired properties for the child nodes within ports container: 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun- reg: Port address described must be 6 for CPU port and from 0 to 5 for 35*4882a593Smuzhiyun user ports. 36*4882a593Smuzhiyun- phy-mode: String, the following values are acceptable for port labeled 37*4882a593Smuzhiyun "cpu": 38*4882a593Smuzhiyun If compatible mediatek,mt7530 or mediatek,mt7621 is set, 39*4882a593Smuzhiyun must be either "trgmii" or "rgmii" 40*4882a593Smuzhiyun If compatible mediatek,mt7531 is set, 41*4882a593Smuzhiyun must be either "sgmii", "1000base-x" or "2500base-x" 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunPort 5 of mt7530 and mt7621 switch is muxed between: 44*4882a593Smuzhiyun1. GMAC5: GMAC5 can interface with another external MAC or PHY. 45*4882a593Smuzhiyun2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC 46*4882a593Smuzhiyun of the SOC. Used in many setups where port 0/4 becomes the WAN port. 47*4882a593Smuzhiyun Note: On a MT7621 SOC with integrated switch: 2nd GMAC can only connected to 48*4882a593Smuzhiyun GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not 49*4882a593Smuzhiyun connected to external component! 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunPort 5 modes/configurations: 52*4882a593Smuzhiyun1. Port 5 is disabled and isolated: An external phy can interface to the 2nd 53*4882a593Smuzhiyun GMAC of the SOC. 54*4882a593Smuzhiyun In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd 55*4882a593Smuzhiyun GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC! 56*4882a593Smuzhiyun2. Port 5 is muxed to PHY of port 0/4: Port 0/4 interfaces with 2nd GMAC. 57*4882a593Smuzhiyun It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode 58*4882a593Smuzhiyun and RGMII delay. 59*4882a593Smuzhiyun3. Port 5 is muxed to GMAC5 and can interface to an external phy. 60*4882a593Smuzhiyun Port 5 becomes an extra switch port. 61*4882a593Smuzhiyun Only works on platform where external phy TX<->RX lines are swapped. 62*4882a593Smuzhiyun Like in the Ubiquiti ER-X-SFP. 63*4882a593Smuzhiyun4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port. 64*4882a593Smuzhiyun Currently a 2nd CPU port is not supported by DSA code. 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunDepending on how the external PHY is wired: 67*4882a593Smuzhiyun1. normal: The PHY can only connect to 2nd GMAC but not to the switch 68*4882a593Smuzhiyun2. swapped: RGMII TX, RX are swapped; external phy interface with the switch as 69*4882a593Smuzhiyun a ethernet port. But can't interface to the 2nd GMAC. 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunBased on the DT the port 5 mode is configured. 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunDriver tries to lookup the phy-handle of the 2nd GMAC of the master device. 74*4882a593SmuzhiyunWhen phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2. 75*4882a593Smuzhiyunphy-mode must be set, see also example 2 below! 76*4882a593Smuzhiyun * mt7621: phy-mode = "rgmii-txid"; 77*4882a593Smuzhiyun * mt7623: phy-mode = "rgmii"; 78*4882a593Smuzhiyun 79*4882a593SmuzhiyunSee Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional 80*4882a593Smuzhiyunrequired, optional properties and how the integrated switch subnodes must 81*4882a593Smuzhiyunbe specified. 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunExample: 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun &mdio0 { 86*4882a593Smuzhiyun switch@0 { 87*4882a593Smuzhiyun compatible = "mediatek,mt7530"; 88*4882a593Smuzhiyun #address-cells = <1>; 89*4882a593Smuzhiyun #size-cells = <0>; 90*4882a593Smuzhiyun reg = <0>; 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun core-supply = <&mt6323_vpa_reg>; 93*4882a593Smuzhiyun io-supply = <&mt6323_vemc3v3_reg>; 94*4882a593Smuzhiyun reset-gpios = <&pio 33 0>; 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun ports { 97*4882a593Smuzhiyun #address-cells = <1>; 98*4882a593Smuzhiyun #size-cells = <0>; 99*4882a593Smuzhiyun reg = <0>; 100*4882a593Smuzhiyun port@0 { 101*4882a593Smuzhiyun reg = <0>; 102*4882a593Smuzhiyun label = "lan0"; 103*4882a593Smuzhiyun }; 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun port@1 { 106*4882a593Smuzhiyun reg = <1>; 107*4882a593Smuzhiyun label = "lan1"; 108*4882a593Smuzhiyun }; 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun port@2 { 111*4882a593Smuzhiyun reg = <2>; 112*4882a593Smuzhiyun label = "lan2"; 113*4882a593Smuzhiyun }; 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun port@3 { 116*4882a593Smuzhiyun reg = <3>; 117*4882a593Smuzhiyun label = "lan3"; 118*4882a593Smuzhiyun }; 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun port@4 { 121*4882a593Smuzhiyun reg = <4>; 122*4882a593Smuzhiyun label = "wan"; 123*4882a593Smuzhiyun }; 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun port@6 { 126*4882a593Smuzhiyun reg = <6>; 127*4882a593Smuzhiyun label = "cpu"; 128*4882a593Smuzhiyun ethernet = <&gmac0>; 129*4882a593Smuzhiyun phy-mode = "trgmii"; 130*4882a593Smuzhiyun fixed-link { 131*4882a593Smuzhiyun speed = <1000>; 132*4882a593Smuzhiyun full-duplex; 133*4882a593Smuzhiyun }; 134*4882a593Smuzhiyun }; 135*4882a593Smuzhiyun }; 136*4882a593Smuzhiyun }; 137*4882a593Smuzhiyun }; 138*4882a593Smuzhiyun 139*4882a593SmuzhiyunExample 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4. 140*4882a593Smuzhiyun 141*4882a593Smuzhiyunð { 142*4882a593Smuzhiyun gmac0: mac@0 { 143*4882a593Smuzhiyun compatible = "mediatek,eth-mac"; 144*4882a593Smuzhiyun reg = <0>; 145*4882a593Smuzhiyun phy-mode = "rgmii"; 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun fixed-link { 148*4882a593Smuzhiyun speed = <1000>; 149*4882a593Smuzhiyun full-duplex; 150*4882a593Smuzhiyun pause; 151*4882a593Smuzhiyun }; 152*4882a593Smuzhiyun }; 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun gmac1: mac@1 { 155*4882a593Smuzhiyun compatible = "mediatek,eth-mac"; 156*4882a593Smuzhiyun reg = <1>; 157*4882a593Smuzhiyun phy-mode = "rgmii-txid"; 158*4882a593Smuzhiyun phy-handle = <&phy4>; 159*4882a593Smuzhiyun }; 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun mdio: mdio-bus { 162*4882a593Smuzhiyun #address-cells = <1>; 163*4882a593Smuzhiyun #size-cells = <0>; 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun /* Internal phy */ 166*4882a593Smuzhiyun phy4: ethernet-phy@4 { 167*4882a593Smuzhiyun reg = <4>; 168*4882a593Smuzhiyun }; 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun mt7530: switch@1f { 171*4882a593Smuzhiyun compatible = "mediatek,mt7621"; 172*4882a593Smuzhiyun #address-cells = <1>; 173*4882a593Smuzhiyun #size-cells = <0>; 174*4882a593Smuzhiyun reg = <0x1f>; 175*4882a593Smuzhiyun pinctrl-names = "default"; 176*4882a593Smuzhiyun mediatek,mcm; 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun resets = <&rstctrl 2>; 179*4882a593Smuzhiyun reset-names = "mcm"; 180*4882a593Smuzhiyun 181*4882a593Smuzhiyun ports { 182*4882a593Smuzhiyun #address-cells = <1>; 183*4882a593Smuzhiyun #size-cells = <0>; 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun port@0 { 186*4882a593Smuzhiyun reg = <0>; 187*4882a593Smuzhiyun label = "lan0"; 188*4882a593Smuzhiyun }; 189*4882a593Smuzhiyun 190*4882a593Smuzhiyun port@1 { 191*4882a593Smuzhiyun reg = <1>; 192*4882a593Smuzhiyun label = "lan1"; 193*4882a593Smuzhiyun }; 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun port@2 { 196*4882a593Smuzhiyun reg = <2>; 197*4882a593Smuzhiyun label = "lan2"; 198*4882a593Smuzhiyun }; 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun port@3 { 201*4882a593Smuzhiyun reg = <3>; 202*4882a593Smuzhiyun label = "lan3"; 203*4882a593Smuzhiyun }; 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun/* Commented out. Port 4 is handled by 2nd GMAC. 206*4882a593Smuzhiyun port@4 { 207*4882a593Smuzhiyun reg = <4>; 208*4882a593Smuzhiyun label = "lan4"; 209*4882a593Smuzhiyun }; 210*4882a593Smuzhiyun*/ 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun cpu_port0: port@6 { 213*4882a593Smuzhiyun reg = <6>; 214*4882a593Smuzhiyun label = "cpu"; 215*4882a593Smuzhiyun ethernet = <&gmac0>; 216*4882a593Smuzhiyun phy-mode = "rgmii"; 217*4882a593Smuzhiyun 218*4882a593Smuzhiyun fixed-link { 219*4882a593Smuzhiyun speed = <1000>; 220*4882a593Smuzhiyun full-duplex; 221*4882a593Smuzhiyun pause; 222*4882a593Smuzhiyun }; 223*4882a593Smuzhiyun }; 224*4882a593Smuzhiyun }; 225*4882a593Smuzhiyun }; 226*4882a593Smuzhiyun }; 227*4882a593Smuzhiyun}; 228*4882a593Smuzhiyun 229*4882a593SmuzhiyunExample 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY. 230*4882a593Smuzhiyun 231*4882a593Smuzhiyunð { 232*4882a593Smuzhiyun gmac0: mac@0 { 233*4882a593Smuzhiyun compatible = "mediatek,eth-mac"; 234*4882a593Smuzhiyun reg = <0>; 235*4882a593Smuzhiyun phy-mode = "rgmii"; 236*4882a593Smuzhiyun 237*4882a593Smuzhiyun fixed-link { 238*4882a593Smuzhiyun speed = <1000>; 239*4882a593Smuzhiyun full-duplex; 240*4882a593Smuzhiyun pause; 241*4882a593Smuzhiyun }; 242*4882a593Smuzhiyun }; 243*4882a593Smuzhiyun 244*4882a593Smuzhiyun mdio: mdio-bus { 245*4882a593Smuzhiyun #address-cells = <1>; 246*4882a593Smuzhiyun #size-cells = <0>; 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun /* External phy */ 249*4882a593Smuzhiyun ephy5: ethernet-phy@7 { 250*4882a593Smuzhiyun reg = <7>; 251*4882a593Smuzhiyun }; 252*4882a593Smuzhiyun 253*4882a593Smuzhiyun mt7530: switch@1f { 254*4882a593Smuzhiyun compatible = "mediatek,mt7621"; 255*4882a593Smuzhiyun #address-cells = <1>; 256*4882a593Smuzhiyun #size-cells = <0>; 257*4882a593Smuzhiyun reg = <0x1f>; 258*4882a593Smuzhiyun pinctrl-names = "default"; 259*4882a593Smuzhiyun mediatek,mcm; 260*4882a593Smuzhiyun 261*4882a593Smuzhiyun resets = <&rstctrl 2>; 262*4882a593Smuzhiyun reset-names = "mcm"; 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun ports { 265*4882a593Smuzhiyun #address-cells = <1>; 266*4882a593Smuzhiyun #size-cells = <0>; 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun port@0 { 269*4882a593Smuzhiyun reg = <0>; 270*4882a593Smuzhiyun label = "lan0"; 271*4882a593Smuzhiyun }; 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun port@1 { 274*4882a593Smuzhiyun reg = <1>; 275*4882a593Smuzhiyun label = "lan1"; 276*4882a593Smuzhiyun }; 277*4882a593Smuzhiyun 278*4882a593Smuzhiyun port@2 { 279*4882a593Smuzhiyun reg = <2>; 280*4882a593Smuzhiyun label = "lan2"; 281*4882a593Smuzhiyun }; 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun port@3 { 284*4882a593Smuzhiyun reg = <3>; 285*4882a593Smuzhiyun label = "lan3"; 286*4882a593Smuzhiyun }; 287*4882a593Smuzhiyun 288*4882a593Smuzhiyun port@4 { 289*4882a593Smuzhiyun reg = <4>; 290*4882a593Smuzhiyun label = "lan4"; 291*4882a593Smuzhiyun }; 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun port@5 { 294*4882a593Smuzhiyun reg = <5>; 295*4882a593Smuzhiyun label = "lan5"; 296*4882a593Smuzhiyun phy-mode = "rgmii"; 297*4882a593Smuzhiyun phy-handle = <&ephy5>; 298*4882a593Smuzhiyun }; 299*4882a593Smuzhiyun 300*4882a593Smuzhiyun cpu_port0: port@6 { 301*4882a593Smuzhiyun reg = <6>; 302*4882a593Smuzhiyun label = "cpu"; 303*4882a593Smuzhiyun ethernet = <&gmac0>; 304*4882a593Smuzhiyun phy-mode = "rgmii"; 305*4882a593Smuzhiyun 306*4882a593Smuzhiyun fixed-link { 307*4882a593Smuzhiyun speed = <1000>; 308*4882a593Smuzhiyun full-duplex; 309*4882a593Smuzhiyun pause; 310*4882a593Smuzhiyun }; 311*4882a593Smuzhiyun }; 312*4882a593Smuzhiyun }; 313*4882a593Smuzhiyun }; 314*4882a593Smuzhiyun }; 315*4882a593Smuzhiyun}; 316