[v1,3/5] dt-bindings: net: Add HPE GXP UMAC

Message ID 20230721212044.59666-4-nick.hawkins@hpe.com
State New
Headers
Series ARM: Add GXP UMAC Support |

Commit Message

Hawkins, Nick July 21, 2023, 9:20 p.m. UTC
  From: Nick Hawkins <nick.hawkins@hpe.com>

Provide access to the register regions and interrupt for Universal
MAC(UMAC). The driver under the hpe,gxp-umac binding will provide an
interface for sending and receiving networking data from both of the
UMACs on the system.

Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
---
 .../devicetree/bindings/net/hpe,gxp-umac.yaml | 111 ++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
  

Comments

Andrew Lunn July 21, 2023, 10:01 p.m. UTC | #1
> +examples:
> +  - |
> +    ethernet@4000 {
> +      compatible = "hpe,gxp-umac";
> +      reg = <0x4000 0x80>;
> +      interrupts = <22>;
> +      mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */

Do both ports get the sane MAC address? 

> +      ethernet-ports {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        port@0 {
> +          reg = <0>;
> +          phy-handle = <&eth_phy0>;
> +        };
> +
> +        port@1 {
> +          reg = <1>;
> +          phy-handle = <&eth_phy1>;
> +        };
> +      };
> +
> +      mdio {

This seems to be wrong. You have a standalone MDIO bus driver, not
part of the MAC address space?

	Andrew
  
Rob Herring July 24, 2023, 4:20 p.m. UTC | #2
On Fri, Jul 21, 2023 at 04:20:42PM -0500, nick.hawkins@hpe.com wrote:
> From: Nick Hawkins <nick.hawkins@hpe.com>
> 
> Provide access to the register regions and interrupt for Universal
> MAC(UMAC). The driver under the hpe,gxp-umac binding will provide an
> interface for sending and receiving networking data from both of the
> UMACs on the system.
> 
> Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
> ---
>  .../devicetree/bindings/net/hpe,gxp-umac.yaml | 111 ++++++++++++++++++
>  1 file changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml b/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
> new file mode 100644
> index 000000000000..c3b68c4ba7f2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
> @@ -0,0 +1,111 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/hpe,gxp-umac.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: HPE GXP Unified MAC Controller
> +
> +maintainers:
> +  - Nick Hawkins <nick.hawkins@hpe.com>
> +
> +description: |

Don't need '|' if no formatting to maintain. Here and elsewhere.

> +  HPE GXP 802.3 10/100/1000T Ethernet Unifed MAC controller.
> +  Device node of the controller has following properties.
> +
> +properties:
> +  compatible:
> +    const: hpe,gxp-umac
> +
> +  use-ncsi:
> +    type: boolean
> +    description: |
> +      Indicates if the device should use NCSI (Network Controlled
> +      Sideband Interface).
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  mac-address: true
> +
> +  ethernet-ports:
> +    type: object
> +    additionalProperties: false
> +    description: Ethernet ports to PHY
> +
> +    properties:
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +    patternProperties:
> +      "^port@[0-1]$":
> +        type: object
> +        additionalProperties: false
> +        description: Port to PHY
> +
> +        properties:
> +          reg:
> +            minimum: 0
> +            maximum: 1
> +
> +          phy-handle:
> +            maxItems: 1
> +
> +        required:
> +          - reg
> +          - phy-handle
> +
> +  mdio:
> +    $ref: mdio.yaml#
> +    unevaluatedProperties: false
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - ethernet-ports
> +
> +examples:
> +  - |
> +    ethernet@4000 {
> +      compatible = "hpe,gxp-umac";
> +      reg = <0x4000 0x80>;
> +      interrupts = <22>;
> +      mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
> +      ethernet-ports {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        port@0 {
> +          reg = <0>;
> +          phy-handle = <&eth_phy0>;
> +        };
> +
> +        port@1 {
> +          reg = <1>;
> +          phy-handle = <&eth_phy1>;
> +        };
> +      };
> +
> +      mdio {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        eth_phy0: ethernet-phy@0 {
> +          reg = <0>;
> +        };
> +
> +        eth_phy1: ethernet-phy@1 {
> +          reg = <1>;
> +        };
> +      };
> +    };
> +...
> -- 
> 2.17.1
>
  
Hawkins, Nick July 25, 2023, 1:44 p.m. UTC | #3
Hi Andrew,

Thank you for the feedback.

> > +examples:
> > +  - |
> > +    ethernet@4000 {
> > +      compatible = "hpe,gxp-umac";
> > +      reg = <0x4000 0x80>;
> > +      interrupts = <22>;
> > +      mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */

> Do both ports get the sane MAC address?

No they do not. The first one will get the MAC address, the second
will be an external phy we are managing via the MDIO path.

> > +      ethernet-ports {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        port@0 {
> > +          reg = <0>;
> > +          phy-handle = <&eth_phy0>;
> > +        };
> > +
> > +        port@1 {
> > +          reg = <1>;
> > +          phy-handle = <&eth_phy1>;
> > +        };
> > +      };
> > +
> > +      mdio {

> This seems to be wrong. You have a standalone MDIO bus driver, not
> part of the MAC address space?

I based this from other yaml examples I found. Is there a better way to
represent it?

Here is what I plan on having the dts/dtsi
look like:

mdio0: mdio@4080 {
	compatible = "hpe,gxp-umac-mdio";
	reg = <0x4080 0x10>;
	#address-cells = <1>;
	#size-cells = <0>;
	ext_phy0: ethernt-phy@0 {
		compatible = "marvell,88e1415","ethernet-phy-ieee802.3-c22";
		phy-mode = "sgmii";
		reg = <0>;
	};
};

mdio1: mdio@5080 {
	compatible = "hpe,gxp-umac-mdio";
	reg = <0x5080 0x10>;
	#address-cells = <1>;
	#size-cells = <0>;
	int_phy0: ethernt-phy@0 {
		compatible = "ethernet-phy-ieee802.3-c22";
		phy-mode = "gmii";
                             reg = <0>;
	};

	int_phy1: ethernt-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		phy-mode = "gmii";
		reg = <1>;
	};
};

umac0: ethernet@4000 {
	compatible = "hpe,gxp-umac";
	reg = <0x4000 0x80>;
	interrupts = <10>;
	interrupt-parent = <&vic0>;
	mac-address = [00 00 00 00 00 00];
	ethernet-ports {
		#address-cells = <1>;
		#size-cells = <0>;
		port@0 {
			reg = <0>;
			phy-handle = <&int_phy0>;
		};
		port@1 {
			reg = <1>;
			phy-handle = <&ext_phy0>;
		};
	};
};

Thank you for the help and assistance.

-Nick Hawkins
  
Andrew Lunn July 25, 2023, 5:51 p.m. UTC | #4
On Tue, Jul 25, 2023 at 01:44:30PM +0000, Hawkins, Nick wrote:
> Hi Andrew,
> 
> Thank you for the feedback.
> 
> > > +examples:
> > > +  - |
> > > +    ethernet@4000 {
> > > +      compatible = "hpe,gxp-umac";
> > > +      reg = <0x4000 0x80>;
> > > +      interrupts = <22>;
> > > +      mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
> 
> > Do both ports get the sane MAC address?
> 
> No they do not. The first one will get the MAC address, the second
> will be an external phy we are managing via the MDIO path.

Then please put the mac-address property in the correct place, inside
port@0.

> > > +      ethernet-ports {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        port@0 {
> > > +          reg = <0>;
> > > +          phy-handle = <&eth_phy0>;
> > > +        };

> > > +      mdio {
> 
> > This seems to be wrong. You have a standalone MDIO bus driver, not
> > part of the MAC address space?
> 
> I based this from other yaml examples I found. Is there a better way to
> represent it?

The validator when given examples does not validate phy-handle
actually points to a known node. So you can just leave the mdio bus
out all together.

> mdio0: mdio@4080 {
> 	compatible = "hpe,gxp-umac-mdio";
> 	reg = <0x4080 0x10>;
> 	#address-cells = <1>;
> 	#size-cells = <0>;
> 	ext_phy0: ethernt-phy@0 {
> 		compatible = "marvell,88e1415","ethernet-phy-ieee802.3-c22";

which is wrong. Please read the binding document for PHYs.

      Andrew
  
Hawkins, Nick July 26, 2023, 2:43 p.m. UTC | #5
Note: Resend in correct format.

> > > Do both ports get the sane MAC address?
> > 
> > No they do not. The first one will get the MAC address, the second
> > will be an external phy we are managing via the MDIO path.

> Then please put the mac-address property in the correct place, inside
port@0.

Greetings Andrew,

I was mistaken, the Mac address belongs with UMAC,
not the phys. The reason ports are listed here is
because having two separate phy-handles
in one node is not allowed. The layout of the
hardware inside the GXP is unconventional.

There is a description of the layout in the cover-letter,
I see though I need to add a better description.
The internal-phy is connected to the external
phy via SGMII. To use UMAC0 we need to
configure both the internal, and external phy to enable
networking.

Ideally it would be something like this:

umac0: umac@4000 {
        compatible = "hpe, gxp-umac";
         reg = <0x4000 0x80>;
        interrupts = <10>;
        interrupt-parent = <&vic0>;
        mac-address = [94 18 82 16 04 d8];
        ext-phy-handle = <&ext_phy0>;
        int-phy-handle = <&int_phy0>;
};

Thanks,

-Nick Hawkins
  
Andrew Lunn July 26, 2023, 3:56 p.m. UTC | #6
On Wed, Jul 26, 2023 at 02:35:48PM +0000, Hawkins, Nick wrote:
> > > > Do both ports get the sane MAC address?
> > >
> > > No they do not. The first one will get the MAC address, the second
> > > will be an external phy we are managing via the MDIO path.
> 
> > Then please put the mac-address property in the correct place, inside
> port@0.
> 
> Greetings Andrew,
> 
> I was mistaken, the Mac address belongs with UMAC,
> not the phys. The reason ports are listed here is
> because having two separate phy-handles
> in one node is not allowed. The layout of the
> hardware inside the GXP is unconventional.

It is not that unconventional. See

Documentation/devicetree/bindings/net/marvell-orion-net.txt

This is an Ethernet block, with two MACs inside it. Each MAC gets its
own subblock containing MAC specific properties like the MAC address,
phy-handle, etc.

	    Andrew
  

Patch

diff --git a/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml b/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
new file mode 100644
index 000000000000..c3b68c4ba7f2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/hpe,gxp-umac.yaml
@@ -0,0 +1,111 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/hpe,gxp-umac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HPE GXP Unified MAC Controller
+
+maintainers:
+  - Nick Hawkins <nick.hawkins@hpe.com>
+
+description: |
+  HPE GXP 802.3 10/100/1000T Ethernet Unifed MAC controller.
+  Device node of the controller has following properties.
+
+properties:
+  compatible:
+    const: hpe,gxp-umac
+
+  use-ncsi:
+    type: boolean
+    description: |
+      Indicates if the device should use NCSI (Network Controlled
+      Sideband Interface).
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  mac-address: true
+
+  ethernet-ports:
+    type: object
+    additionalProperties: false
+    description: Ethernet ports to PHY
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^port@[0-1]$":
+        type: object
+        additionalProperties: false
+        description: Port to PHY
+
+        properties:
+          reg:
+            minimum: 0
+            maximum: 1
+
+          phy-handle:
+            maxItems: 1
+
+        required:
+          - reg
+          - phy-handle
+
+  mdio:
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - ethernet-ports
+
+examples:
+  - |
+    ethernet@4000 {
+      compatible = "hpe,gxp-umac";
+      reg = <0x4000 0x80>;
+      interrupts = <22>;
+      mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
+      ethernet-ports {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@0 {
+          reg = <0>;
+          phy-handle = <&eth_phy0>;
+        };
+
+        port@1 {
+          reg = <1>;
+          phy-handle = <&eth_phy1>;
+        };
+      };
+
+      mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        eth_phy0: ethernet-phy@0 {
+          reg = <0>;
+        };
+
+        eth_phy1: ethernet-phy@1 {
+          reg = <1>;
+        };
+      };
+    };
+...