1*c66ec88fSEmmanuel VadotNXP SJA1105 switch driver 2*c66ec88fSEmmanuel Vadot========================= 3*c66ec88fSEmmanuel Vadot 4*c66ec88fSEmmanuel VadotRequired properties: 5*c66ec88fSEmmanuel Vadot 6*c66ec88fSEmmanuel Vadot- compatible: 7*c66ec88fSEmmanuel Vadot Must be one of: 8*c66ec88fSEmmanuel Vadot - "nxp,sja1105e" 9*c66ec88fSEmmanuel Vadot - "nxp,sja1105t" 10*c66ec88fSEmmanuel Vadot - "nxp,sja1105p" 11*c66ec88fSEmmanuel Vadot - "nxp,sja1105q" 12*c66ec88fSEmmanuel Vadot - "nxp,sja1105r" 13*c66ec88fSEmmanuel Vadot - "nxp,sja1105s" 14*c66ec88fSEmmanuel Vadot 15*c66ec88fSEmmanuel Vadot Although the device ID could be detected at runtime, explicit bindings 16*c66ec88fSEmmanuel Vadot are required in order to be able to statically check their validity. 17*c66ec88fSEmmanuel Vadot For example, SGMII can only be specified on port 4 of R and S devices, 18*c66ec88fSEmmanuel Vadot and the non-SGMII devices, while pin-compatible, are not equal in terms 19*c66ec88fSEmmanuel Vadot of support for RGMII internal delays (supported on P/Q/R/S, but not on 20*c66ec88fSEmmanuel Vadot E/T). 21*c66ec88fSEmmanuel Vadot 22*c66ec88fSEmmanuel VadotOptional properties: 23*c66ec88fSEmmanuel Vadot 24*c66ec88fSEmmanuel Vadot- sja1105,role-mac: 25*c66ec88fSEmmanuel Vadot- sja1105,role-phy: 26*c66ec88fSEmmanuel Vadot Boolean properties that can be assigned under each port node. By 27*c66ec88fSEmmanuel Vadot default (unless otherwise specified) a port is configured as MAC if it 28*c66ec88fSEmmanuel Vadot is driving a PHY (phy-handle is present) or as PHY if it is PHY-less 29*c66ec88fSEmmanuel Vadot (fixed-link specified, presumably because it is connected to a MAC). 30*c66ec88fSEmmanuel Vadot The effect of this property (in either its implicit or explicit form) 31*c66ec88fSEmmanuel Vadot is: 32*c66ec88fSEmmanuel Vadot - In the case of MII or RMII it specifies whether the SJA1105 port is a 33*c66ec88fSEmmanuel Vadot clock source or sink for this interface (not applicable for RGMII 34*c66ec88fSEmmanuel Vadot where there is a Tx and an Rx clock). 35*c66ec88fSEmmanuel Vadot - In the case of RGMII it affects the behavior regarding internal 36*c66ec88fSEmmanuel Vadot delays: 37*c66ec88fSEmmanuel Vadot 1. If sja1105,role-mac is specified, and the phy-mode property is one 38*c66ec88fSEmmanuel Vadot of "rgmii-id", "rgmii-txid" or "rgmii-rxid", then the entity 39*c66ec88fSEmmanuel Vadot designated to apply the delay/clock skew necessary for RGMII 40*c66ec88fSEmmanuel Vadot is the PHY. The SJA1105 MAC does not apply any internal delays. 41*c66ec88fSEmmanuel Vadot 2. If sja1105,role-phy is specified, and the phy-mode property is one 42*c66ec88fSEmmanuel Vadot of the above, the designated entity to apply the internal delays 43*c66ec88fSEmmanuel Vadot is the SJA1105 MAC (if hardware-supported). This is only supported 44*c66ec88fSEmmanuel Vadot by the second-generation (P/Q/R/S) hardware. On a first-generation 45*c66ec88fSEmmanuel Vadot E or T device, it is an error to specify an RGMII phy-mode other 46*c66ec88fSEmmanuel Vadot than "rgmii" for a port that is in fixed-link mode. In that case, 47*c66ec88fSEmmanuel Vadot the clock skew must either be added by the MAC at the other end of 48*c66ec88fSEmmanuel Vadot the fixed-link, or by PCB serpentine traces on the board. 49*c66ec88fSEmmanuel Vadot These properties are required, for example, in the case where SJA1105 50*c66ec88fSEmmanuel Vadot ports are at both ends of a MII/RMII PHY-less setup. One end would need 51*c66ec88fSEmmanuel Vadot to have sja1105,role-mac, while the other sja1105,role-phy. 52*c66ec88fSEmmanuel Vadot 53*c66ec88fSEmmanuel VadotSee Documentation/devicetree/bindings/net/dsa/dsa.txt for the list of standard 54*c66ec88fSEmmanuel VadotDSA required and optional properties. 55*c66ec88fSEmmanuel Vadot 56*c66ec88fSEmmanuel VadotOther observations 57*c66ec88fSEmmanuel Vadot------------------ 58*c66ec88fSEmmanuel Vadot 59*c66ec88fSEmmanuel VadotThe SJA1105 SPI interface requires a CS-to-CLK time (t2 in UM10944) of at least 60*c66ec88fSEmmanuel Vadotone half of t_CLK. At an SPI frequency of 1MHz, this means a minimum 61*c66ec88fSEmmanuel Vadotcs_sck_delay of 500ns. Ensuring that this SPI timing requirement is observed 62*c66ec88fSEmmanuel Vadotdepends on the SPI bus master driver. 63*c66ec88fSEmmanuel Vadot 64*c66ec88fSEmmanuel VadotExample 65*c66ec88fSEmmanuel Vadot------- 66*c66ec88fSEmmanuel Vadot 67*c66ec88fSEmmanuel VadotEthernet switch connected via SPI to the host, CPU port wired to enet2: 68*c66ec88fSEmmanuel Vadot 69*c66ec88fSEmmanuel Vadotarch/arm/boot/dts/ls1021a-tsn.dts: 70*c66ec88fSEmmanuel Vadot 71*c66ec88fSEmmanuel Vadot/* SPI controller of the LS1021 */ 72*c66ec88fSEmmanuel Vadot&dspi0 { 73*c66ec88fSEmmanuel Vadot sja1105@1 { 74*c66ec88fSEmmanuel Vadot reg = <0x1>; 75*c66ec88fSEmmanuel Vadot #address-cells = <1>; 76*c66ec88fSEmmanuel Vadot #size-cells = <0>; 77*c66ec88fSEmmanuel Vadot compatible = "nxp,sja1105t"; 78*c66ec88fSEmmanuel Vadot spi-max-frequency = <4000000>; 79*c66ec88fSEmmanuel Vadot fsl,spi-cs-sck-delay = <1000>; 80*c66ec88fSEmmanuel Vadot fsl,spi-sck-cs-delay = <1000>; 81*c66ec88fSEmmanuel Vadot ports { 82*c66ec88fSEmmanuel Vadot #address-cells = <1>; 83*c66ec88fSEmmanuel Vadot #size-cells = <0>; 84*c66ec88fSEmmanuel Vadot port@0 { 85*c66ec88fSEmmanuel Vadot /* ETH5 written on chassis */ 86*c66ec88fSEmmanuel Vadot label = "swp5"; 87*c66ec88fSEmmanuel Vadot phy-handle = <&rgmii_phy6>; 88*c66ec88fSEmmanuel Vadot phy-mode = "rgmii-id"; 89*c66ec88fSEmmanuel Vadot reg = <0>; 90*c66ec88fSEmmanuel Vadot /* Implicit "sja1105,role-mac;" */ 91*c66ec88fSEmmanuel Vadot }; 92*c66ec88fSEmmanuel Vadot port@1 { 93*c66ec88fSEmmanuel Vadot /* ETH2 written on chassis */ 94*c66ec88fSEmmanuel Vadot label = "swp2"; 95*c66ec88fSEmmanuel Vadot phy-handle = <&rgmii_phy3>; 96*c66ec88fSEmmanuel Vadot phy-mode = "rgmii-id"; 97*c66ec88fSEmmanuel Vadot reg = <1>; 98*c66ec88fSEmmanuel Vadot /* Implicit "sja1105,role-mac;" */ 99*c66ec88fSEmmanuel Vadot }; 100*c66ec88fSEmmanuel Vadot port@2 { 101*c66ec88fSEmmanuel Vadot /* ETH3 written on chassis */ 102*c66ec88fSEmmanuel Vadot label = "swp3"; 103*c66ec88fSEmmanuel Vadot phy-handle = <&rgmii_phy4>; 104*c66ec88fSEmmanuel Vadot phy-mode = "rgmii-id"; 105*c66ec88fSEmmanuel Vadot reg = <2>; 106*c66ec88fSEmmanuel Vadot /* Implicit "sja1105,role-mac;" */ 107*c66ec88fSEmmanuel Vadot }; 108*c66ec88fSEmmanuel Vadot port@3 { 109*c66ec88fSEmmanuel Vadot /* ETH4 written on chassis */ 110*c66ec88fSEmmanuel Vadot phy-handle = <&rgmii_phy5>; 111*c66ec88fSEmmanuel Vadot label = "swp4"; 112*c66ec88fSEmmanuel Vadot phy-mode = "rgmii-id"; 113*c66ec88fSEmmanuel Vadot reg = <3>; 114*c66ec88fSEmmanuel Vadot /* Implicit "sja1105,role-mac;" */ 115*c66ec88fSEmmanuel Vadot }; 116*c66ec88fSEmmanuel Vadot port@4 { 117*c66ec88fSEmmanuel Vadot /* Internal port connected to eth2 */ 118*c66ec88fSEmmanuel Vadot ethernet = <&enet2>; 119*c66ec88fSEmmanuel Vadot phy-mode = "rgmii"; 120*c66ec88fSEmmanuel Vadot reg = <4>; 121*c66ec88fSEmmanuel Vadot /* Implicit "sja1105,role-phy;" */ 122*c66ec88fSEmmanuel Vadot fixed-link { 123*c66ec88fSEmmanuel Vadot speed = <1000>; 124*c66ec88fSEmmanuel Vadot full-duplex; 125*c66ec88fSEmmanuel Vadot }; 126*c66ec88fSEmmanuel Vadot }; 127*c66ec88fSEmmanuel Vadot }; 128*c66ec88fSEmmanuel Vadot }; 129*c66ec88fSEmmanuel Vadot}; 130*c66ec88fSEmmanuel Vadot 131*c66ec88fSEmmanuel Vadot/* MDIO controller of the LS1021 */ 132*c66ec88fSEmmanuel Vadot&mdio0 { 133*c66ec88fSEmmanuel Vadot /* BCM5464 */ 134*c66ec88fSEmmanuel Vadot rgmii_phy3: ethernet-phy@3 { 135*c66ec88fSEmmanuel Vadot reg = <0x3>; 136*c66ec88fSEmmanuel Vadot }; 137*c66ec88fSEmmanuel Vadot rgmii_phy4: ethernet-phy@4 { 138*c66ec88fSEmmanuel Vadot reg = <0x4>; 139*c66ec88fSEmmanuel Vadot }; 140*c66ec88fSEmmanuel Vadot rgmii_phy5: ethernet-phy@5 { 141*c66ec88fSEmmanuel Vadot reg = <0x5>; 142*c66ec88fSEmmanuel Vadot }; 143*c66ec88fSEmmanuel Vadot rgmii_phy6: ethernet-phy@6 { 144*c66ec88fSEmmanuel Vadot reg = <0x6>; 145*c66ec88fSEmmanuel Vadot }; 146*c66ec88fSEmmanuel Vadot}; 147*c66ec88fSEmmanuel Vadot 148*c66ec88fSEmmanuel Vadot/* Ethernet master port of the LS1021 */ 149*c66ec88fSEmmanuel Vadot&enet2 { 150*c66ec88fSEmmanuel Vadot phy-connection-type = "rgmii"; 151*c66ec88fSEmmanuel Vadot status = "ok"; 152*c66ec88fSEmmanuel Vadot fixed-link { 153*c66ec88fSEmmanuel Vadot speed = <1000>; 154*c66ec88fSEmmanuel Vadot full-duplex; 155*c66ec88fSEmmanuel Vadot }; 156*c66ec88fSEmmanuel Vadot}; 157