Hello.
This patch series brings complete rework of the mediatek,mt7530 binding.
The binding is checked with "make dt_binding_check
DT_SCHEMA_FILES=mediatek,mt7530.yaml".
If anyone knows the GIC bit for interrupt for multi-chip module MT7530 in
MT7623AI SoC, let me know. I'll add it to the examples.
If anyone got a Unielec U7623 or another MT7623AI board, please reach out.
v6:
- Do not remove binding for DSA ports from top level.
- On the first patch, remove requiring reg as it's already required by
dsa-port.yaml and define acceptable reg values for the CPU ports.
- Add Krzysztof's Reviewed-by: and Acked-by: to where they're given except
the first patch because of the changes above.
v5:
- Remove lists for single items.
- Split fix reset lines patch, add new patch to fix mediatek,mcm property.
- Remove Rob's Reviewed-by: from first patch because of new changes.
- Add Krzysztof's Reviewed-by: and Acked-by: to where they're given.
v4:
- Define reg property on $defs as it's the same for all switch models.
v3:
- Add Rob's Reviewed-by: to first patch.
- Explain why to invalidating reset-gpios and mediatek,mcm.
- Do not change ethernet-ports to ports on examples.
- Remove platform and, when possible, ethernet nodes from examples.
- Remove pinctrl binding from examples.
- Combine removing unnecesary lines patch with relocating port binding.
- Define $defs of mt7530 and mt7531 port binding and refer to them in each
compatible device.
- Remove allOf: for cases where there's only a single if:.
- Use else: for cpu port 6 which simplifies the binding.
- State clearly that the DSA driver does not support the MT7530 switch in
MT7620 SoCs.
v2:
- Change the way of adding descriptions for each compatible string.
- Split the patch for updating the json-schema.
- Make slight changes on the patch for the binding description.
Arınç ÜNAL (6):
dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
dt-bindings: net: dsa: mediatek,mt7530: fix description of mediatek,mcm
dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
dt-bindings: net: dsa: mediatek,mt7530: update examples
dt-bindings: net: dsa: mediatek,mt7530: define phy-mode per switch
dt-bindings: net: dsa: mediatek,mt7530: update binding description
.../bindings/net/dsa/mediatek,mt7530.yaml | 649 +++++++++++++++----
1 file changed, 527 insertions(+), 122 deletions(-)
Make trivial changes on the binding.
- Update title to include MT7531 switch.
- Add me as a maintainer. List maintainers in alphabetical order by first
name.
- Add description to compatible strings.
- Stretch descriptions up to the 80 character limit.
- Remove lists for single items.
- Remove requiring reg as it's already required by dsa-port.yaml.
- Define acceptable reg values for the CPU ports.
- Remove quotes from $ref: "dsa.yaml#".
Signed-off-by: Arınç ÜNAL <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 50 ++++++++++++-------
1 file changed, 31 insertions(+), 19 deletions(-)
@@ -4,12 +4,13 @@$id:http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml#$schema:http://devicetree.org/meta-schemas/core.yaml#-title:Mediatek MT7530 Ethernet switch+title:Mediatek MT7530 and MT7531 Ethernet Switchesmaintainers:--Sean Wang <sean.wang@mediatek.com>+-Arınç ÜNAL <arinc.unal@arinc9.com>-Landen Chao <Landen.Chao@mediatek.com>-DENG Qingfang <dqfext@gmail.com>+-Sean Wang <sean.wang@mediatek.com>description:|Port 5 of mt7530 and mt7621 switch is muxed between:
@@ -61,10 +62,18 @@ description: |properties:compatible:-enum:--mediatek,mt7530--mediatek,mt7531--mediatek,mt7621+oneOf:+-description:+Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC+const:mediatek,mt7530++-description:+Standalone MT7531+const:mediatek,mt7531++-description:+Multi-chip module MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs+const:mediatek,mt7621reg:maxItems:1
@@ -79,7 +88,7 @@ properties:gpio-controller:type:booleandescription:-if defined, MT7530's LED controller will run on GPIO mode.+If defined, MT7530's LED controller will run on GPIO mode."#interrupt-cells":const:1
@@ -92,8 +101,8 @@ properties:io-supply:description:Phandle to the regulator node necessary for the I/O power.-See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt-for details for the regulator setup on these boards.+See Documentation/devicetree/bindings/regulator/mt6323-regulator.txt for+details for the regulator setup on these boards.mediatek,mcm:type:boolean
@@ -110,8 +119,8 @@ properties:resets:description:-Phandle pointing to the system reset controller with line index for-the ethsys.+Phandle pointing to the system reset controller with line index for the+ethsys.maxItems:1patternProperties:
@@ -128,27 +137,31 @@ patternProperties:properties:reg:description:-Port address described must be 5 or 6 for CPU port and from 0-to 5 for user ports.+Port address described must be 5 or 6 for CPU port and from 0 to 5+for user ports.allOf:-$ref:dsa-port.yaml#-if:properties:label:-items:--const:cpu+const:cputhen:required:--reg-phy-mode+properties:+reg:+enum:+-5+-6+required:-compatible-regallOf:--$ref:"dsa.yaml#"+-$ref:dsa.yaml#-if:required:-mediatek,mcm
Fix the description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
Signed-off-by: Arınç ÜNAL <redacted>
Acked-by: Krzysztof Kozlowski <redacted>
---
.../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
@@ -107,9 +107,8 @@ properties:mediatek,mcm:type:booleandescription:-if defined, indicates that either MT7530 is the part on multi-chip-module belong to MT7623A has or the remotely standalone chip as the-function MT7623N reference board provided for.+Used for MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs which the MT7530+switch is a part of the multi-chip module.reset-gpios:maxItems:1
- Add description for reset-gpios.
- Invalidate reset-gpios if mediatek,mcm is used. We cannot use multiple
reset lines at the same time.
- Invalidate mediatek,mcm if the compatible device is mediatek,mt7531.
There is no multi-chip module version of mediatek,mt7531.
- Require mediatek,mcm for mediatek,mt7621 as the compatible string is only
used for the multi-chip module version of MT7530.
Signed-off-by: Arınç ÜNAL <redacted>
Reviewed-by: Krzysztof Kozlowski <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
@@ -111,6 +111,11 @@ properties:switch is a part of the multi-chip module.reset-gpios:+description:+GPIO to reset the switch. Use this if mediatek,mcm is not used.+This property is optional because some boards share the reset line with+other components which makes it impossible to probe the switch if the+reset line is used.maxItems:1reset-names:
Update the examples on the binding.
- Add examples which include a wide variation of configurations.
- Make example comments YAML comment instead of DT binding comment.
- Add interrupt controller to the examples. Include header file for
interrupt.
- Change reset line for MT7621 examples.
- Pretty formatting for the examples.
- Change switch reg to 0.
- Change port labels to fit the example, change port 4 label to wan.
Signed-off-by: Arınç ÜNAL <redacted>
Reviewed-by: Krzysztof Kozlowski <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 402 +++++++++++++++---
1 file changed, 347 insertions(+), 55 deletions(-)
Define acceptable phy-mode values for the CPU ports of mt7530 and mt7531
switches. Remove relevant information from the description of the binding.
Signed-off-by: Arınç ÜNAL <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 73 ++++++++++++++++---
1 file changed, 62 insertions(+), 11 deletions(-)
Update the description of the binding.
- Describe the switches, which SoCs they are in, or if they are standalone.
- Explain the various ways of configuring MT7530's port 5.
- Remove phy-mode = "rgmii-txid" from description. Same code path is
followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.
Signed-off-by: Arınç ÜNAL <redacted>
Acked-by: Krzysztof Kozlowski <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 97 ++++++++++++-------
1 file changed, 62 insertions(+), 35 deletions(-)
@@ -13,41 +13,68 @@ maintainers:-Sean Wang <sean.wang@mediatek.com>description:|-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.-Note: On a MT7621 SOC with integrated switch:2nd GMAC can only connected to-GMAC5 when the gpios for RGMII2 (GPIO 22-33) are not used and not-connected to external component!--Port 5 modes/configurations:-1. Port 5 is disabled and isolated:An external phy can interface to the 2nd-GMAC of the SOC.-In the case of a build-in MT7530 switch, port 5 shares the RGMII bus with 2nd-GMAC and an optional external phy. Mind the GPIO/pinctl settings of the SOC!-2. Port 5 is muxed to PHY of port 0/4:Port 0/4 interfaces with 2nd GMAC.-It is a simple MAC to PHY interface, port 5 needs to be setup for xMII mode-and RGMII delay.-3. Port 5 is muxed to GMAC5 and can interface to an external phy.-Port 5 becomes an extra switch port.-Only works on platform where external phy TX<->RX lines are swapped.-Like in the Ubiquiti ER-X-SFP.-4. Port 5 is muxed to GMAC5 and interfaces with the 2nd GAMC as 2nd CPU port.-Currently a 2nd CPU port is not supported by DSA code.--Depending on how the external PHY is wired:-1. normal:The PHY can only connect to 2nd GMAC but not to the switch-2. swapped:RGMII TX, RX are swapped; external phy interface with the switch as-a ethernet port. But can't interface to the 2nd GMAC.--Based on the DT the port 5 mode is configured.--Driver tries to lookup the phy-handle of the 2nd GMAC of the master device.-When phy-handle matches PHY of port 0 or 4 then port 5 set-up as mode 2.-phy-mode must be set, see also example 2 below!-* mt7621:phy-mode = "rgmii-txid";-* mt7623:phy-mode = "rgmii";+There are two versions of MT7530, standalone and in a multi-chip module.++MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN,+MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs.++MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs+and the switch registers are directly mapped into SoC's memory map rather than+using MDIO. The DSA driver currently doesn't support this.++There is only the standalone version of MT7531.++Port 5 on MT7530 has got various ways of configuration.++For standalone MT7530:++-Port 5 can be used as a CPU port.++-PHY 0 or 4 of the switch can be muxed to connect to the gmac of the SoC+which port 5 is wired to. Usually used for connecting the wan port+directly to the CPU to achieve 2 Gbps routing in total.++The driver looks up the reg on the ethernet-phy node which the phy-handle+property refers to on the gmac node to mux the specified phy.++The driver requires the gmac of the SoC to have "mediatek,eth-mac" as the+compatible string and the reg must be 1. So, for now, only gmac1 of an+MediaTek SoC can benefit this. Banana Pi BPI-R2 suits this.+Check out example 5 for a similar configuration.++-Port 5 can be wired to an external phy. Port 5 becomes a DSA slave.+Check out example 7 for a similar configuration.++For multi-chip module MT7530:++-Port 5 can be used as a CPU port.++-PHY 0 or 4 of the switch can be muxed to connect to gmac1 of the SoC.+Usually used for connecting the wan port directly to the CPU to achieve 2+Gbps routing in total.++The driver looks up the reg on the ethernet-phy node which the phy-handle+property refers to on the gmac node to mux the specified phy.++For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.+Check out example 5.++-In case of an external phy wired to gmac1 of the SoC, port 5 must not be+enabled.++In case of muxing PHY 0 or 4, the external phy must not be enabled.++For the MT7621 SoCs, rgmii2 group must be claimed with rgmii2 function.+Check out example 6.++-Port 5 can be muxed to an external phy. Port 5 becomes a DSA slave.+The external phy must be wired TX to TX to gmac1 of the SoC for this to+work. Ubiquiti EdgeRouter X SFP is wired this way.++Muxing PHY 0 or 4 won't work when the external phy is connected TX to TX.++For the MT7621 SoCs, rgmii2 group must be claimed with gpio function.+Check out example 7.properties:compatible:
From: Rob Herring <robh@kernel.org> Date: 2022-08-25 20:08:03
On Thu, 25 Aug 2022 11:22:56 +0300, Arınç ÜNAL wrote:
Make trivial changes on the binding.
- Update title to include MT7531 switch.
- Add me as a maintainer. List maintainers in alphabetical order by first
name.
- Add description to compatible strings.
- Stretch descriptions up to the 80 character limit.
- Remove lists for single items.
- Remove requiring reg as it's already required by dsa-port.yaml.
- Define acceptable reg values for the CPU ports.
- Remove quotes from $ref: "dsa.yaml#".
Signed-off-by: Arınç ÜNAL <redacted>
---
.../bindings/net/dsa/mediatek,mt7530.yaml | 50 ++++++++++++-------
1 file changed, 31 insertions(+), 19 deletions(-)
From: Krzysztof Kozlowski <hidden> Date: 2022-08-26 06:45:35
On 25/08/2022 11:22, Arınç ÜNAL wrote:
Make trivial changes on the binding.
- Update title to include MT7531 switch.
- Add me as a maintainer. List maintainers in alphabetical order by first
name.
- Add description to compatible strings.
- Stretch descriptions up to the 80 character limit.
- Remove lists for single items.
- Remove requiring reg as it's already required by dsa-port.yaml.
- Define acceptable reg values for the CPU ports.
- Remove quotes from $ref: "dsa.yaml#".
Signed-off-by: Arınç ÜNAL <redacted>
Reviewed-by: Krzysztof Kozlowski <redacted>
Best regards,
Krzysztof
From: Krzysztof Kozlowski <hidden> Date: 2022-08-26 06:46:21
On 25/08/2022 11:22, Arınç ÜNAL wrote:
Hello.
This patch series brings complete rework of the mediatek,mt7530 binding.
The binding is checked with "make dt_binding_check
DT_SCHEMA_FILES=mediatek,mt7530.yaml".
If anyone knows the GIC bit for interrupt for multi-chip module MT7530 in
MT7623AI SoC, let me know. I'll add it to the examples.
If anyone got a Unielec U7623 or another MT7623AI board, please reach out.
v6:
- Do not remove binding for DSA ports from top level.
- On the first patch, remove requiring reg as it's already required by
dsa-port.yaml and define acceptable reg values for the CPU ports.
- Add Krzysztof's Reviewed-by: and Acked-by: to where they're given except
the first patch because of the changes above.
From: Krzysztof Kozlowski <hidden> Date: 2022-08-26 06:49:13
On 25/08/2022 11:23, Arınç ÜNAL wrote:
Define acceptable phy-mode values for the CPU ports of mt7530 and mt7531
switches. Remove relevant information from the description of the binding.
Signed-off-by: Arınç ÜNAL <redacted>
Reviewed-by: Krzysztof Kozlowski <redacted>
Best regards,
Krzysztof
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski [off-list ref]:
On Thu, 25 Aug 2022 11:22:55 +0300 you wrote:
Hello.
This patch series brings complete rework of the mediatek,mt7530 binding.
The binding is checked with "make dt_binding_check
DT_SCHEMA_FILES=mediatek,mt7530.yaml".
[...]