Skip to content

Commit c339c1c

Browse files
committed
Merge branch 'dsa-mediatek-MT7530'
Sean Wang says: ==================== net-next: dsa: add Mediatek MT7530 support MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the user ports connecting with the remote devices while the port 5 and 6 are the CPU ports connecting into Mediatek Ethernet GMAC. The patch series integrated Mediatek MT7530 into DSA support which includes the most of the essential callbacks such as tag insertion for port distinguishing, port control, bridge offloading, STP setup and ethtool operations to allow DSA to model each user port into independently standalone netdevice as the other DSA driver had done. Changes since v1: - rebased into 4.11-rc1 - refined binding document including below five items - changed the type of mediatek,mcm into bool - used reset controller binding for MCM reset and removed "mediatek,ethsys" property from binding - reused CPU port's ethernet Phandle instead of creating new one and removed "mediatek,ethernet" property from binding - aligned naming for GPIO reset with dsa/marvell.txt - added phy-mode as required property child nodes within ports container - handled gpio reset with devm_gpiod_* API - refined comment words - removed condition for CDM setting since the setup looks both fine for all cases - allowed of_find_net_device_by_node() working with pointing the device node into real netdev instance - fixed Kbuild warnings Changes since v2: - reuse readx_poll_timeout() to poll - add proper macro instead of hard coding - treat inconsistent cpu port as warning - remove the usage for regmap-debugfs - show error message when invalid id is found - put the logic for the setup of trgmii into adjut_link() - refine and reuse logic between port_[disable,enable], and default port setup - correct typo Changes since v3: - used struct as the parameter for readx_poll_timeout() and kill extra lpriv defined - moved around function to get out of an additional declaration - fixed kbuild errors caused by missing proper include in the latest tree ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents bbadb9a + b8f126a commit c339c1c

File tree

13 files changed

+1768
-0
lines changed

13 files changed

+1768
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Mediatek MT7530 Ethernet switch
2+
================================
3+
4+
Required properties:
5+
6+
- compatible: Must be compatible = "mediatek,mt7530";
7+
- #address-cells: Must be 1.
8+
- #size-cells: Must be 0.
9+
- mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part
10+
on multi-chip module belong to MT7623A has or the remotely standalone
11+
chip as the function MT7623N reference board provided for.
12+
- core-supply: Phandle to the regulator node necessary for the core power.
13+
- io-supply: Phandle to the regulator node necessary for the I/O power.
14+
See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt
15+
for details for the regulator setup on these boards.
16+
17+
If the property mediatek,mcm isn't defined, following property is required
18+
19+
- reset-gpios: Should be a gpio specifier for a reset line.
20+
21+
Else, following properties are required
22+
23+
- resets : Phandle pointing to the system reset controller with
24+
line index for the ethsys.
25+
- reset-names : Should be set to "mcm".
26+
27+
Required properties for the child nodes within ports container:
28+
29+
- reg: Port address described must be 6 for CPU port and from 0 to 5 for
30+
user ports.
31+
- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled
32+
"cpu".
33+
34+
See Documentation/devicetree/bindings/dsa/dsa.txt for a list of additional
35+
required, optional properties and how the integrated switch subnodes must
36+
be specified.
37+
38+
Example:
39+
40+
&mdio0 {
41+
switch@0 {
42+
compatible = "mediatek,mt7530";
43+
#address-cells = <1>;
44+
#size-cells = <0>;
45+
reg = <0>;
46+
47+
core-supply = <&mt6323_vpa_reg>;
48+
io-supply = <&mt6323_vemc3v3_reg>;
49+
reset-gpios = <&pio 33 0>;
50+
51+
ports {
52+
#address-cells = <1>;
53+
#size-cells = <0>;
54+
reg = <0>;
55+
port@0 {
56+
reg = <0>;
57+
label = "lan0";
58+
};
59+
60+
port@1 {
61+
reg = <1>;
62+
label = "lan1";
63+
};
64+
65+
port@2 {
66+
reg = <2>;
67+
label = "lan2";
68+
};
69+
70+
port@3 {
71+
reg = <3>;
72+
label = "lan3";
73+
};
74+
75+
port@4 {
76+
reg = <4>;
77+
label = "wan";
78+
};
79+
80+
port@6 {
81+
reg = <6>;
82+
label = "cpu";
83+
ethernet = <&gmac0>;
84+
phy-mode = "trgmii";
85+
fixed-link {
86+
speed = <1000>;
87+
full-duplex;
88+
};
89+
};
90+
};
91+
};
92+
};

drivers/net/dsa/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,12 @@ config NET_DSA_LOOP
4242
This enables support for a fake mock-up switch chip which
4343
exercises the DSA APIs.
4444

45+
config NET_DSA_MT7530
46+
tristate "Mediatek MT7530 Ethernet switch support"
47+
depends on NET_DSA
48+
select NET_DSA_TAG_MTK
49+
---help---
50+
This enables support for the Mediatek MT7530 Ethernet switch
51+
chip.
52+
4553
endmenu

drivers/net/dsa/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
22
obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm-sf2.o
33
bcm-sf2-objs := bcm_sf2.o bcm_sf2_cfp.o
44
obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
5+
obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
56
obj-y += b53/
67
obj-y += mv88e6xxx/
78
obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o dsa_loop_bdinfo.o

0 commit comments

Comments
 (0)