completely rework mediatek,mt7530 binding
Subsystems (5)
v4 cover completely rework mediatek,mt7530 binding
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.
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 reset lines
dt-bindings: net: dsa: mediatek,mt7530: update examples
dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for switch models
dt-bindings: net: dsa: mediatek,mt7530: update binding description
.../bindings/net/dsa/mediatek,mt7530.yaml | 677 +++++++++++++++---- 1 file changed, 542 insertions(+), 135 deletions(-)
PATCH v4 1/6 dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
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 quotes from $ref: "dsa.yaml#".
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +24 -12
@@ -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 Switches maintainers: - - Sean Wang <[email protected]> + - Arınç ÜNAL <[email protected]> - Landen Chao <[email protected]> - DENG Qingfang <[email protected]> + - Sean Wang <[email protected]> description: | Port 5 of mt7530 and mt7621 switch is muxed between:
@@ -61,10 +62,21 @@ description: | properties: compatible: - enum: - - mediatek,mt7530 - - mediatek,mt7531 - - mediatek,mt7621 + oneOf: + - description: + Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC + items: + - const: mediatek,mt7530 + + - description: + Standalone MT7531 + items: + - const: mediatek,mt7531 + + - description: + Multi-chip module MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs + items: + - const: mediatek,mt7621 reg: maxItems: 1
@@ -79,7 +91,7 @@ properties: gpio-controller: type: boolean description: - 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 +104,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 +122,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: 1 patternProperties:
@@ -148,7 +160,7 @@ required: - reg allOf: - - $ref: "dsa.yaml#" + - $ref: dsa.yaml# - if: required: - mediatek,mcm
Signature · 1 line
2.34.1
Re: [PATCH v4 1/6] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
Quoted 37 lines · Arınç ÜNAL
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 quotes from $ref: "dsa.yaml#".Signed-off-by Arınç ÜNAL <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +3
-2@@ -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 Switches maintainers: - - Sean Wang <[email protected]> + - Arınç ÜNAL <[email protected]> - Landen Chao <[email protected]> - DENG Qingfang <[email protected]> + - Sean Wang <[email protected]> description: | Port 5 of mt7530 and mt7621 switch is muxed between:@@ -61,10 +62,21 @@ description: |
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml description: | · line 68
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +4
-4properties: compatible: - enum: - - mediatek,mt7530 - - mediatek,mt7531 - - mediatek,mt7621 + oneOf: + - description: + Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC + items:
You have one item, so don't make it a list. Just const:xxxxx
Same in other places.
Best regards,
Krzysztof
Re: [PATCH v4 1/6] dt-bindings: net: dsa: mediatek,mt7530: make trivial changes
Quoted 51 lines · Krzysztof Kozlowski
Quoted 37 lines · Arınç ÜNAL
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 quotes from $ref: "dsa.yaml#".Signed-off-by Arınç ÜNAL <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +3
-2@@ -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 Switches maintainers: - - Sean Wang <[email protected]> + - Arınç ÜNAL <[email protected]> - Landen Chao <[email protected]> - DENG Qingfang <[email protected]> + - Sean Wang <[email protected]> description: | Port 5 of mt7530 and mt7621 switch is muxed between:@@ -61,10 +62,21 @@ description: |Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml description: | · line 68
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +4
-4properties: compatible: - enum: - - mediatek,mt7530 - - mediatek,mt7531 - - mediatek,mt7621 + oneOf: + - description: + Standalone MT7530 and multi-chip module MT7530 in MT7623AI SoC + items:You have one item, so don't make it a list. Just const:xxxxx
Quoted 1 line
Same in other places.
Will do.
Arınç
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v4 2/6 dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
In reply to Arınç ÜNAL- Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
- 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.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +28 -3
@@ -110,11 +110,15 @@ properties: mediatek,mcm: type: boolean description: - 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: + 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: 1 reset-names:
@@ -165,6 +169,9 @@ allOf: required: - mediatek,mcm then: + properties: + reset-gpios: false + required: - resets - reset-names
@@ -182,6 +189,24 @@ allOf: - core-supply - io-supply + - if: + properties: + compatible: + items: + - const: mediatek,mt7531 + then: + properties: + mediatek,mcm: false + + - if: + properties: + compatible: + items: + - const: mediatek,mt7621 + then: + required: + - mediatek,mcm + unevaluatedProperties: false examples:
Signature · 1 line
2.34.1
Re: [PATCH v4 2/6] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
Quoted 1 line · Arınç ÜNAL
- Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
Separate commit. You are still doing here few things at a time.
Quoted 47 lines
- 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 <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +10
-3@@ -110,11 +110,15 @@ properties: mediatek,mcm: type: boolean description: - 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: + 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: 1 reset-names:@@ -165,6 +169,9 @@ allOf: required: - mediatek,mcm then: + properties: + reset-gpios: false + required: - resets - reset-names
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml allOf: · line 195
Quoted 7 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +4
-0@@ -182,6 +189,24 @@ allOf: - core-supply - io-supply + - if: + properties: + compatible: + items:
Again, not items. This can be just const or enum.
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml allOf: · line 204
Quoted 9 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +9
-0+ - const: mediatek,mt7531 + then: + properties: + mediatek,mcm: false + + - if: + properties: + compatible: + items:
Ditto.
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml allOf: · line 212
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +5
-0+ - const: mediatek,mt7621 + then: + required: + - mediatek,mcm + unevaluatedProperties: false examples:
Best regards,
Krzysztof
Re: [PATCH v4 2/6] dt-bindings: net: dsa: mediatek,mt7530: fix reset lines
Quoted 4 lines · Krzysztof Kozlowski
Quoted 1 line · Arınç ÜNAL
- Fix description of mediatek,mcm. mediatek,mcm is not used on MT7623NI.
Separate commit. You are still doing here few things at a time.
Will split.
Quoted 51 lines
Quoted 51 lines
- 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 <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +10
-3@@ -110,11 +110,15 @@ properties: mediatek,mcm: type: boolean description: - 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: + 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: 1 reset-names:@@ -165,6 +169,9 @@ allOf: required: - mediatek,mcm then: + properties: + reset-gpios: false + required: - resets - reset-names@@ -182,6 +189,24 @@ allOf: - core-supply - io-supply
Quoted 6 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml allOf: · line 195
Quoted 4 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +4
-0+ - if: + properties: + compatible: + items:Again, not items. This can be just const or enum.
Will do.
Quoted 11 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml allOf: · line 204
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +9
-0+ - const: mediatek,mt7531 + then: + properties: + mediatek,mcm: false + + - if: + properties: + compatible: + items:
Quoted 1 line
Ditto.
Arınç
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v4 3/6 dt-bindings: net: dsa: mediatek,mt7530: update examples
In reply to Arınç ÜNALUpdate 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.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 402 +++++++++++++++--- 1 file changed, 347 insertions(+), 55 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +347 -55
@@ -210,42 +210,111 @@ allOf: unevaluatedProperties: false examples: + # Example 1: Standalone MT7530 - | #include <dt-bindings/gpio/gpio.h> + mdio { #address-cells = <1>; #size-cells = <0>; + switch@0 { compatible = "mediatek,mt7530"; reg = <0>; + reset-gpios = <&pio 33 0>; + core-supply = <&mt6323_vpa_reg>; io-supply = <&mt6323_vemc3v3_reg>; - reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>; ethernet-ports { #address-cells = <1>; #size-cells = <0>; + port@0 { reg = <0>; - label = "lan0"; + label = "lan1"; }; port@1 { reg = <1>; - label = "lan1"; + label = "lan2"; }; port@2 { reg = <2>; - label = "lan2"; + label = "lan3"; }; port@3 { reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + }; + }; + }; + + # Example 2: MT7530 in MT7623AI SoC + - | + #include <dt-bindings/reset/mt2701-resets.h> + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7530"; + reg = <0>; + + mediatek,mcm; + resets = <ðsys MT2701_ETHSYS_MCM_RST>; + reset-names = "mcm"; + + core-supply = <&mt6323_vpa_reg>; + io-supply = <&mt6323_vemc3v3_reg>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; label = "lan3"; }; + port@3 { + reg = <3>; + label = "lan4"; + }; + port@4 { reg = <4>; label = "wan";
@@ -256,85 +325,219 @@ examples: label = "cpu"; ethernet = <&gmac0>; phy-mode = "trgmii"; + fixed-link { speed = <1000>; full-duplex; + pause; }; }; }; }; }; + # Example 3: Standalone MT7531 - | - //Example 2: MT7621: Port 4 is WAN port: 2nd GMAC -> Port 5 -> PHY port 4. + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> - ethernet { + mdio { #address-cells = <1>; #size-cells = <0>; - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; + + switch@0 { + compatible = "mediatek,mt7531"; reg = <0>; - phy-mode = "rgmii"; - fixed-link { - speed = <1000>; - full-duplex; - pause; + reset-gpios = <&pio 54 0>; + + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + 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; + }; + }; }; }; + }; + + # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs + - | + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/reset/mt7621-reset.h> - gmac1: mac@1 { + mdio { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7621"; + reg = <0>; + + mediatek,mcm; + resets = <&sysc MT7621_RST_MCM>; + reset-names = "mcm"; + + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + }; + }; + }; + + # Example 5: MT7621: mux MT7530's phy4 to SoC's gmac1 + - | + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/reset/mt7621-reset.h> + + ethernet { + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins>; + + mac@1 { compatible = "mediatek,eth-mac"; reg = <1>; - phy-mode = "rgmii-txid"; - phy-handle = <&phy4>; + + phy-mode = "rgmii"; + phy-handle = <&example5_ethphy4>; }; - mdio: mdio-bus { + mdio { #address-cells = <1>; #size-cells = <0>; - /* Internal phy */ - phy4: ethernet-phy@4 { + /* MT7530's phy4 */ + example5_ethphy4: ethernet-phy@4 { reg = <4>; }; - mt7530: switch@1f { + switch@0 { compatible = "mediatek,mt7621"; - reg = <0x1f>; - mediatek,mcm; + reg = <0>; - resets = <&rstctrl 2>; + mediatek,mcm; + resets = <&sysc MT7621_RST_MCM>; reset-names = "mcm"; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; + ethernet-ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; - label = "lan0"; + label = "lan1"; }; port@1 { reg = <1>; - label = "lan1"; + label = "lan2"; }; port@2 { reg = <2>; - label = "lan2"; + label = "lan3"; }; port@3 { reg = <3>; - label = "lan3"; + label = "lan4"; }; - /* Commented out. Port 4 is handled by 2nd GMAC. + /* Commented out, phy4 is muxed to gmac1. port@4 { reg = <4>; - label = "lan4"; + label = "wan"; }; */
@@ -342,7 +545,7 @@ examples: reg = <6>; label = "cpu"; ethernet = <&gmac0>; - phy-mode = "rgmii"; + phy-mode = "trgmii"; fixed-link { speed = <1000>;
@@ -355,82 +558,171 @@ examples: }; }; + # Example 6: MT7621: mux external phy to SoC's gmac1 - | - //Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY. + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/reset/mt7621-reset.h> ethernet { #address-cells = <1>; #size-cells = <0>; - gmac_0: mac@0 { + + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins>; + + mac@1 { compatible = "mediatek,eth-mac"; - reg = <0>; + reg = <1>; + phy-mode = "rgmii"; + phy-handle = <&example6_ethphy7>; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + /* External PHY */ + example6_ethphy7: ethernet-phy@7 { + reg = <7>; + phy-mode = "rgmii"; + }; + + switch@0 { + compatible = "mediatek,mt7621"; + reg = <0>; + + mediatek,mcm; + resets = <&sysc MT7621_RST_MCM>; + reset-names = "mcm"; + + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; - fixed-link { - speed = <1000>; - full-duplex; - pause; + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + }; }; }; + }; - mdio0: mdio-bus { + # Example 7: MT7621: mux external phy to MT7530's port 5 + - | + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/reset/mt7621-reset.h> + + ethernet { + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins>; + + mdio { #address-cells = <1>; #size-cells = <0>; - /* External phy */ - ephy5: ethernet-phy@7 { + /* External PHY */ + example7_ethphy7: ethernet-phy@7 { reg = <7>; + phy-mode = "rgmii"; }; - switch@1f { + switch@0 { compatible = "mediatek,mt7621"; - reg = <0x1f>; - mediatek,mcm; + reg = <0>; - resets = <&rstctrl 2>; + mediatek,mcm; + resets = <&sysc MT7621_RST_MCM>; reset-names = "mcm"; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; + ethernet-ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; - label = "lan0"; + label = "lan1"; }; port@1 { reg = <1>; - label = "lan1"; + label = "lan2"; }; port@2 { reg = <2>; - label = "lan2"; + label = "lan3"; }; port@3 { reg = <3>; - label = "lan3"; + label = "lan4"; }; port@4 { reg = <4>; - label = "lan4"; + label = "wan"; }; port@5 { reg = <5>; - label = "lan5"; - phy-mode = "rgmii"; - phy-handle = <&ephy5>; + label = "extphy"; + phy-mode = "rgmii-txid"; + phy-handle = <&example7_ethphy7>; }; - cpu_port0: port@6 { + port@6 { reg = <6>; label = "cpu"; - ethernet = <&gmac_0>; - phy-mode = "rgmii"; + ethernet = <&gmac0>; + phy-mode = "trgmii"; fixed-link { speed = <1000>;
Signature · 1 line
2.34.1
Re: [PATCH v4 3/6] dt-bindings: net: dsa: mediatek,mt7530: update examples
Quoted 11 lines · Arınç ÜNAL
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.
Quoted 4 lines
Signed-off-by Arınç ÜNAL <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 402 +++++++++++++++--- 1 file changed, 347 insertions(+), 55 deletions(-)
Best regards,
Krzysztof
PATCH v4 4/6 dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
In reply to Arınç ÜNALDefine DSA port binding per switch model as each switch model requires different values for certain properties.
Define reg property on $defs as it's the same for all switch models.
Remove unnecessary lines as they are already included from the referred dsa.yaml.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +34 -22
@@ -130,38 +130,47 @@ properties: ethsys. maxItems: 1 -patternProperties: - "^(ethernet-)?ports$": - type: object - - patternProperties: - "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch ports - - unevaluatedProperties: false +required: + - compatible + - reg - properties: - reg: - description: - Port address described must be 5 or 6 for CPU port and from 0 - to 5 for user ports. +$defs: + dsa-port-reg: + properties: + reg: + description: + 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: + mt7530-dsa-port: + patternProperties: + "^(ethernet-)?ports$": + patternProperties: + "^(ethernet-)?port@[0-9]+$": + $ref: "#/$defs/dsa-port-reg" + if: properties: label: items: - const: cpu then: required: - - reg - phy-mode -required: - - compatible - - reg + mt7531-dsa-port: + patternProperties: + "^(ethernet-)?ports$": + patternProperties: + "^(ethernet-)?port@[0-9]+$": + $ref: "#/$defs/dsa-port-reg" + if: + properties: + label: + items: + - const: cpu + then: + required: + - phy-mode allOf: - $ref: dsa.yaml#
@@ -185,6 +194,7 @@ allOf: items: - const: mediatek,mt7530 then: + $ref: "#/$defs/mt7530-dsa-port" required: - core-supply - io-supply
@@ -195,6 +205,7 @@ allOf: items: - const: mediatek,mt7531 then: + $ref: "#/$defs/mt7531-dsa-port" properties: mediatek,mcm: false
@@ -204,6 +215,7 @@ allOf: items: - const: mediatek,mt7621 then: + $ref: "#/$defs/mt7530-dsa-port" required: - mediatek,mcm
Signature · 1 line
2.34.1
Re: [PATCH v4 4/6] dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
Quoted 19 lines · Arınç ÜNAL
Define DSA port binding per switch model as each switch model requires different values for certain properties.
Define reg property on $defs as it's the same for all switch models.
Remove unnecessary lines as they are already included from the referred
dsa.yaml.Signed-off-by Arınç ÜNAL <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-0@@ -130,38 +130,47 @@ properties: ethsys.
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml properties: · line 140
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-8maxItems: 1 -patternProperties: - "^(ethernet-)?ports$": - type: object - - patternProperties: - "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch ports
Again, I don't understand why do you remove definitions of these nodes from top-level properties. I explained what I expect in previous discussion and I am confused to hear "this cannot be done".
Best regards,
Krzysztof
Re: [PATCH v4 4/6] dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Arınç ÜNAL
Define DSA port binding per switch model as each switch model requires different values for certain properties.
Define reg property on $defs as it's the same for all switch models.
Remove unnecessary lines as they are already included from the referred
dsa.yaml.Signed-off-by Arınç ÜNAL <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-0@@ -130,38 +130,47 @@ properties: ethsys. maxItems: 1
Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml properties: · line 140
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-8-patternProperties: - "^(ethernet-)?ports$": - type: object - - patternProperties: - "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch portsAgain, I don't understand why do you remove definitions of these nodes from top-level properties. I explained what I expect in previous discussion and I am confused to hear "this cannot be done".
I agree it can be done, but the binding is done with less lines the current way.
I would need to add more lines than just for creating the node structure since dsa.yaml is not referred.
Then, I would have to create the node structure again for the dsa-port checks.
Arınç
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v4 4/6] dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
Quoted 38 lines · Arınç ÜNAL
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Arınç ÜNAL
Define DSA port binding per switch model as each switch model requires different values for certain properties.
Define reg property on $defs as it's the same for all switch models.
Remove unnecessary lines as they are already included from the referred
dsa.yaml.Signed-off-by Arınç ÜNAL <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-0@@ -130,38 +130,47 @@ properties: ethsys. maxItems: 1Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml properties: · line 140
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-8-patternProperties: - "^(ethernet-)?ports$": - type: object - - patternProperties: - "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch portsAgain, I don't understand why do you remove definitions of these nodes from top-level properties. I explained what I expect in previous discussion and I am confused to hear "this cannot be done".
Quoted 8 lines
I agree it can be done, but the binding is done with less lines the current way.
I would need to add more lines than just for creating the node structure since
dsa.yamlis not referred.Then, I would have to create the node structure again for the dsa-port checks.
I understand you can create binding more concise, but not necessarily more readable. The easiest to grasp is to define all the nodes in top-level and customize them in allOf:if:then. This was actually also needed for earlier dtschema with additionalProperties:false. You keep defining properties in allOf:if:then, even though they are all applicable to all variants. That's unusual and even if it reduces the lines does not make it easier to grasp.
Best regards,
Krzysztof
Re: [PATCH v4 4/6] dt-bindings: net: dsa: mediatek,mt7530: define port binding per switch
Quoted 48 lines · Krzysztof Kozlowski
Quoted 38 lines · Arınç ÜNAL
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Arınç ÜNAL
Define DSA port binding per switch model as each switch model requires different values for certain properties.
Define reg property on $defs as it's the same for all switch models.
Remove unnecessary lines as they are already included from the referred
dsa.yaml.Signed-off-by Arınç ÜNAL <[email protected]>--- .../bindings/net/dsa/mediatek,mt7530.yaml | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-0@@ -130,38 +130,47 @@ properties: ethsys. maxItems: 1Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml properties: · line 140
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +0
-8-patternProperties: - "^(ethernet-)?ports$": - type: object - - patternProperties: - "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch portsAgain, I don't understand why do you remove definitions of these nodes from top-level properties. I explained what I expect in previous discussion and I am confused to hear "this cannot be done".
Quoted 8 lines
I agree it can be done, but the binding is done with less lines the current way.
I would need to add more lines than just for creating the node structure since
dsa.yamlis not referred.Then, I would have to create the node structure again for the dsa-port checks.
Quoted 7 lines
I understand you can create binding more concise, but not necessarily more readable. The easiest to grasp is to define all the nodes in top-level and customize them in allOf:if:then. This was actually also needed for earlier dtschema with additionalProperties:false. You keep defining properties in allOf:if:then, even though they are all applicable to all variants. That's unusual and even if it reduces the lines does not make it easier to grasp.
Understood. Will send v6 with respect to this.
Arınç
PATCH v4 5/6 dt-bindings: net: dsa: mediatek,mt7530: define phy-mode for switch models
In reply to Arınç ÜNALDefine acceptable phy-mode values for the CPU port of mt7530 and mt7531 switches. Remove relevant information from the description of the binding.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 61 +++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +50 -11
@@ -49,17 +49,6 @@ description: | * mt7621: phy-mode = "rgmii-txid"; * mt7623: phy-mode = "rgmii"; - CPU-Ports need a phy-mode property: - Allowed values on mt7530 and mt7621: - - "rgmii" - - "trgmii" - On mt7531: - - "1000base-x" - - "2500base-x" - - "rgmii" - - "sgmii" - - properties: compatible: oneOf:
@@ -154,6 +143,30 @@ $defs: items: - const: cpu then: + if: + properties: + reg: + const: 5 + then: + properties: + phy-mode: + enum: + - gmii + - mii + - rgmii + else: + properties: + phy-mode: + enum: + - rgmii + - trgmii + + properties: + reg: + enum: + - 5 + - 6 + required: - phy-mode
@@ -169,6 +182,32 @@ $defs: items: - const: cpu then: + if: + properties: + reg: + const: 5 + then: + properties: + phy-mode: + enum: + - 1000base-x + - 2500base-x + - rgmii + - sgmii + else: + properties: + phy-mode: + enum: + - 1000base-x + - 2500base-x + - sgmii + + properties: + reg: + enum: + - 5 + - 6 + required: - phy-mode
Signature · 1 line
2.34.1
PATCH v4 6/6 dt-bindings: net: dsa: mediatek,mt7530: update binding description
In reply to Arınç ÜNALUpdate 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.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 97 ++++++++++++------- 1 file changed, 62 insertions(+), 35 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +62 -35
@@ -13,41 +13,68 @@ maintainers: - Sean Wang <[email protected]> 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:
Signature · 1 line
2.34.1
Re: [PATCH v4 6/6] dt-bindings: net: dsa: mediatek,mt7530: update binding description
Quoted 8 lines · Arınç ÜNAL
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 onmtk_eth_soc.c.Signed-off-by Arınç ÜNAL <[email protected]>
Best regards,
Krzysztof