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