Commit 0ca6d8b7 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-next-dsa-mt7530-add-support-for-MT7531'



Landen Chao says:

====================
net-next: dsa: mt7530: add support for MT7531

This patch series adds support for MT7531.

MT7531 is the next generation of MT7530 which could be found on Mediatek
router platforms such as MT7622 or MT7629.

It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and
the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface.
Cpu port 5 supports either RGMII or SGMII in different HW SKU, but cannot
be muxed to PHY of port 0/4 like mt7530. Due to support for SGMII
interface, pll, and pad setting are different from MT7530.

MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability
    which is compatible with PHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-band negotiation
    which is compatible with 10B/8B encoding of
    PHY_INTERFACE_MODE_1000BASEX with fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-band negotiation
    which is compatible with 10B/8B encoding of
    PHY_INTERFACE_MODE_2500BASEX with fixed full-duplex and fixed pause.

v4 -> v5
- Add fixed-link node to dsa cpu port in dts file by suggestion of
  Vladimir Oltean.

v3 -> v4
- Adjust the coding style by suggestion of Jakub Kicinski.
  Remove unnecessary jumping label, merge continuous numeric 'switch
  cases' into one line, and keep the variables longest to shortest
  (reverse xmas tree).

v2 -> v3
- Keep the same setup logic of mt7530/mt7621 because these series of
  patches is for adding mt7531 hardware.
- Do not adjust rgmii delay when vendor phy driver presents in order to
  prevent double adjustment by suggestion of Andrew Lunn.
- Remove redundant 'Example 4' from dt-bindings by suggestion of
  Rob Herring.
- Fix typo.

v1 -> v2
- change phylink_validate callback function to support full-duplex
  gigabit only to match hardware capability.
- add description of SGMII interface.
- configure mt7531 cpu port in fastest speed by default.
- parse SGMII control word for in-band negotiation mode.
- configure RGMII delay based on phy.rst.
- Rename the definition in the header file to avoid potential conflicts.
- Add wrapper function for mdio read/write to support both C22 and C45.
- correct fixed-link speed of 2500base-x in dts.
- add MT7531 port mirror setting.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4b468385 79a675e6
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ Required properties:

- compatible: may be compatible = "mediatek,mt7530"
	or compatible = "mediatek,mt7621"
	or compatible = "mediatek,mt7531"
- #address-cells: Must be 1.
- #size-cells: Must be 0.
- mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part
@@ -32,10 +33,14 @@ Required properties for the child nodes within ports container:

- reg: Port address described must be 6 for CPU port and from 0 to 5 for
	user ports.
- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled
	 "cpu".

Port 5 of the switch is muxed between:
- phy-mode: String, the following values are acceptable for port labeled
	"cpu":
	If compatible mediatek,mt7530 or mediatek,mt7621 is set,
	must be either "trgmii" or "rgmii"
	If compatible mediatek,mt7531 is set,
	must be either "sgmii", "1000base-x" or "2500base-x"

Port 5 of mt7530 and mt7621 switch is muxed between:
1. GMAC5: GMAC5 can interface with another external MAC or PHY.
2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC
   of the SOC. Used in many setups where port 0/4 becomes the WAN port.
+50 −0
Original line number Diff line number Diff line
@@ -143,6 +143,56 @@
	mdio: mdio-bus {
		#address-cells = <1>;
		#size-cells = <0>;

		switch@0 {
			compatible = "mediatek,mt7531";
			reg = <0>;
			reset-gpios = <&pio 54 0>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					label = "wan";
				};

				port@1 {
					reg = <1>;
					label = "lan0";
				};

				port@2 {
					reg = <2>;
					label = "lan1";
				};

				port@3 {
					reg = <3>;
					label = "lan2";
				};

				port@4 {
					reg = <4>;
					label = "lan3";
				};

				port@6 {
					reg = <6>;
					label = "cpu";
					ethernet = <&gmac0>;
					phy-mode = "2500base-x";

					fixed-link {
						speed = <2500>;
						full-duplex;
						pause;
					};
				};
			};
		};

	};
};

+57 −6
Original line number Diff line number Diff line
@@ -105,20 +105,71 @@
	pinctrl-0 = <&eth_pins>;
	status = "okay";

	gmac1: mac@1 {
	gmac0: mac@0 {
		compatible = "mediatek,eth-mac";
		reg = <1>;
		phy-handle = <&phy5>;
		reg = <0>;
		phy-mode = "2500base-x";

		fixed-link {
			speed = <2500>;
			full-duplex;
			pause;
		};
	};

	mdio-bus {
		#address-cells = <1>;
		#size-cells = <0>;

		phy5: ethernet-phy@5 {
			reg = <5>;
			phy-mode = "sgmii";
		switch@0 {
			compatible = "mediatek,mt7531";
			reg = <0>;
			reset-gpios = <&pio 54 0>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					label = "lan0";
				};

				port@1 {
					reg = <1>;
					label = "lan1";
				};

				port@2 {
					reg = <2>;
					label = "lan2";
				};

				port@3 {
					reg = <3>;
					label = "lan3";
				};

				port@4 {
					reg = <4>;
					label = "wan";
				};

				port@6 {
					reg = <6>;
					label = "cpu";
					ethernet = <&gmac0>;
					phy-mode = "2500base-x";

					fixed-link {
						speed = <2500>;
						full-duplex;
						pause;
					};
				};
			};
		};

	};
};

+3 −3
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ config NET_DSA_LANTIQ_GSWIP
	  the xrx200 / VR9 SoC.

config NET_DSA_MT7530
	tristate "Mediatek MT7530 Ethernet switch support"
	tristate "MediaTek MT753x and MT7621 Ethernet switch support"
	depends on NET_DSA
	select NET_DSA_TAG_MTK
	help
	  This enables support for the Mediatek MT7530 Ethernet switch
	  chip.
	  This enables support for the MediaTek MT7530, MT7531, and MT7621
	  Ethernet switch chips.

config NET_DSA_MV88E6060
	tristate "Marvell 88E6060 ethernet switch chip support"
+1090 −102

File changed.

Preview size limit exceeded, changes collapsed.

Loading