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

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
...@@ -5,6 +5,7 @@ Required properties: ...@@ -5,6 +5,7 @@ Required properties:
- compatible: may be compatible = "mediatek,mt7530" - compatible: may be compatible = "mediatek,mt7530"
or compatible = "mediatek,mt7621" or compatible = "mediatek,mt7621"
or compatible = "mediatek,mt7531"
- #address-cells: Must be 1. - #address-cells: Must be 1.
- #size-cells: Must be 0. - #size-cells: Must be 0.
- mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part - 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: ...@@ -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 - reg: Port address described must be 6 for CPU port and from 0 to 5 for
user ports. user ports.
- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled - phy-mode: String, the following values are acceptable for port labeled
"cpu". "cpu":
If compatible mediatek,mt7530 or mediatek,mt7621 is set,
Port 5 of the switch is muxed between: 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. 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 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. of the SOC. Used in many setups where port 0/4 becomes the WAN port.
......
...@@ -143,6 +143,56 @@ fixed-link { ...@@ -143,6 +143,56 @@ fixed-link {
mdio: mdio-bus { mdio: mdio-bus {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #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;
};
};
};
};
}; };
}; };
......
...@@ -105,20 +105,71 @@ &eth { ...@@ -105,20 +105,71 @@ &eth {
pinctrl-0 = <&eth_pins>; pinctrl-0 = <&eth_pins>;
status = "okay"; status = "okay";
gmac1: mac@1 { gmac0: mac@0 {
compatible = "mediatek,eth-mac"; compatible = "mediatek,eth-mac";
reg = <1>; reg = <0>;
phy-handle = <&phy5>; phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
}; };
mdio-bus { mdio-bus {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
phy5: ethernet-phy@5 { switch@0 {
reg = <5>; compatible = "mediatek,mt7531";
phy-mode = "sgmii"; 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;
};
};
};
};
}; };
}; };
......
...@@ -33,12 +33,12 @@ config NET_DSA_LANTIQ_GSWIP ...@@ -33,12 +33,12 @@ config NET_DSA_LANTIQ_GSWIP
the xrx200 / VR9 SoC. the xrx200 / VR9 SoC.
config NET_DSA_MT7530 config NET_DSA_MT7530
tristate "Mediatek MT7530 Ethernet switch support" tristate "MediaTek MT753x and MT7621 Ethernet switch support"
depends on NET_DSA depends on NET_DSA
select NET_DSA_TAG_MTK select NET_DSA_TAG_MTK
help help
This enables support for the Mediatek MT7530 Ethernet switch This enables support for the MediaTek MT7530, MT7531, and MT7621
chip. Ethernet switch chips.
config NET_DSA_MV88E6060 config NET_DSA_MV88E6060
tristate "Marvell 88E6060 ethernet switch chip support" tristate "Marvell 88E6060 ethernet switch chip support"
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment