Commit 33d21bd1 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net: Add support for Power over Ethernet (PoE)'

Kory Maincent says:

====================
net: Add support for Power over Ethernet (PoE)

This patch series aims at adding support for PoE (Power over Ethernet),
based on the already existing support for PoDL (Power over Data Line)
implementation. In addition, it adds support for two specific PoE
controller, the Microchip PD692x0 and the TI TPS23881.
====================

Link: https://lore.kernel.org/all/20240417-feature_poe-v9-0-242293fd1900@bootlin.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 80d953c8 20e6d190
Loading
Loading
Loading
Loading
+169 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/pse-pd/microchip,pd692x0.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Microchip PD692x0 Power Sourcing Equipment controller

maintainers:
  - Kory Maincent <kory.maincent@bootlin.com>

allOf:
  - $ref: pse-controller.yaml#

properties:
  compatible:
    enum:
      - microchip,pd69200
      - microchip,pd69210
      - microchip,pd69220

  reg:
    maxItems: 1

  managers:
    type: object
    description:
      List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager
      have 4 or 8 physical ports according to the chip version. No need to
      specify the SPI chip select as it is automatically detected by the
      PD692x0 PSE controller. The PSE managers have to be described from
      the lowest chip select to the greatest one, which is the detection
      behavior of the PD692x0 PSE controller. The PD692x0 support up to
      12 PSE managers which can expose up to 96 physical ports. All
      physical ports available on a manager have to be described in the
      incremental order even if they are not used.

    properties:
      "#address-cells":
        const: 1

      "#size-cells":
        const: 0

    required:
      - "#address-cells"
      - "#size-cells"

    patternProperties:
      "^manager@0[0-9a-b]$":
        type: object
        description:
          PD69208T4/PD69204T4/PD69208M PSE manager exposing 4 or 8 physical
          ports.

        properties:
          reg:
            description:
              Incremental index of the PSE manager starting from 0, ranging
              from lowest to highest chip select, up to 11.
            maxItems: 1

          "#address-cells":
            const: 1

          "#size-cells":
            const: 0

        patternProperties:
          '^port@[0-7]$':
            type: object
            required:
              - reg
            additionalProperties: false

        required:
          - reg
          - "#address-cells"
          - "#size-cells"

required:
  - compatible
  - reg
  - pse-pis

unevaluatedProperties: false

examples:
  - |
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      ethernet-pse@3c {
        compatible = "microchip,pd69200";
        reg = <0x3c>;

        managers {
          #address-cells = <1>;
          #size-cells = <0>;

          manager@0 {
            reg = <0>;
            #address-cells = <1>;
            #size-cells = <0>;

            phys0: port@0 {
              reg = <0>;
            };

            phys1: port@1 {
              reg = <1>;
            };

            phys2: port@2 {
              reg = <2>;
            };

            phys3: port@3 {
              reg = <3>;
            };
          };

          manager@1 {
            reg = <1>;
            #address-cells = <1>;
            #size-cells = <0>;

            phys4: port@0 {
              reg = <0>;
            };

            phys5: port@1 {
              reg = <1>;
            };

            phys6: port@2 {
              reg = <2>;
            };

            phys7: port@3 {
              reg = <3>;
            };
          };
        };

        pse-pis {
          #address-cells = <1>;
          #size-cells = <0>;

          pse_pi0: pse-pi@0 {
            reg = <0>;
            #pse-cells = <0>;
            pairset-names = "alternative-a", "alternative-b";
            pairsets = <&phys0>, <&phys1>;
            polarity-supported = "MDI", "S";
            vpwr-supply = <&vpwr1>;
          };
          pse_pi1: pse-pi@1 {
            reg = <1>;
            #pse-cells = <0>;
            pairset-names = "alternative-a";
            pairsets = <&phys2>;
            polarity-supported = "MDI";
            vpwr-supply = <&vpwr2>;
          };
        };
      };
    };
+98 −3
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ description: Binding for the Power Sourcing Equipment (PSE) as defined in the

maintainers:
  - Oleksij Rempel <o.rempel@pengutronix.de>
  - Kory Maincent <kory.maincent@bootlin.com>

properties:
  $nodename:
@@ -22,11 +23,105 @@ properties:
    description:
      Used to uniquely identify a PSE instance within an IC. Will be
      0 on PSE nodes with only a single output and at least 1 on nodes
      controlling several outputs.
      controlling several outputs which are not described in the pse-pis
      subnode. This property is deprecated, please use pse-pis instead.
    enum: [0, 1]

  pse-pis:
    type: object
    description:
      Overview of the PSE PIs provided by the controller.

    properties:
      "#address-cells":
        const: 1

      "#size-cells":
        const: 0

    required:
      - "#address-cells"
      - "#size-cells"

    patternProperties:
      "^pse-pi@[0-9a-f]+$":
        type: object
        description:
          PSE PI for power delivery via pairsets, compliant with IEEE
          802.3-2022, Section 145.2.4. Each pairset comprises a positive and
          a negative VPSE pair, adhering to the pinout configurations
          detailed in the standard.
          See Documentation/networking/pse-pd/pse-pi.rst for details.

        properties:
          reg:
            description:
              Address describing the PSE PI index.
            maxItems: 1

          "#pse-cells":
            const: 0

          pairset-names:
            $ref: /schemas/types.yaml#/definitions/string-array
            description:
              Names of the pairsets as per IEEE 802.3-2022, Section 145.2.4.
              Each name should correspond to a phandle in the 'pairset'
              property pointing to the power supply for that pairset.
            minItems: 1
            maxItems: 2
            items:
              enum:
                - alternative-a
                - alternative-b

          pairsets:
            $ref: /schemas/types.yaml#/definitions/phandle-array
            description:
              List of phandles, each pointing to the power supply for the
              corresponding pairset named in 'pairset-names'. This property
              aligns with IEEE 802.3-2022, Section 33.2.3 and 145.2.4.
              PSE Pinout Alternatives (as per IEEE 802.3-2022 Table 145\u20133)
              |-----------|---------------|---------------|---------------|---------------|
              | Conductor | Alternative A | Alternative A | Alternative B | Alternative B |
              |           |    (MDI-X)    |     (MDI)     |      (X)      |      (S)      |
              |-----------|---------------|---------------|---------------|---------------|
              | 1         | Negative VPSE | Positive VPSE | -             | -             |
              | 2         | Negative VPSE | Positive VPSE | -             | -             |
              | 3         | Positive VPSE | Negative VPSE | -             | -             |
              | 4         | -             | -             | Negative VPSE | Positive VPSE |
              | 5         | -             | -             | Negative VPSE | Positive VPSE |
              | 6         | Positive VPSE | Negative VPSE | -             | -             |
              | 7         | -             | -             | Positive VPSE | Negative VPSE |
              | 8         | -             | -             | Positive VPSE | Negative VPSE |
            minItems: 1
            maxItems: 2

          polarity-supported:
            $ref: /schemas/types.yaml#/definitions/string-array
            description:
              Polarity configuration supported by the PSE PI pairsets.
            minItems: 1
            maxItems: 4
            items:
              enum:
                - MDI-X
                - MDI
                - X
                - S

          vpwr-supply:
            description: Regulator power supply for the PSE PI.

        required:
          - reg
          - "#pse-cells"

oneOf:
  - required:
      - "#pse-cells"
  - required:
      - pse-pis

additionalProperties: true

+95 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/pse-pd/ti,tps23881.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: TI TPS23881 Power Sourcing Equipment controller

maintainers:
  - Kory Maincent <kory.maincent@bootlin.com>

allOf:
  - $ref: pse-controller.yaml#

properties:
  compatible:
    enum:
      - ti,tps23881

  reg:
    maxItems: 1

  '#pse-cells':
    const: 1

  channels:
    description: each set of 8 ports can be assigned to one physical
      channels or two for PoE4. This parameter describes the configuration
      of the ports conversion matrix that establishes relationship between
      the logical ports and the physical channels.
    type: object

    patternProperties:
      '^channel@[0-7]$':
        type: object
        required:
          - reg

unevaluatedProperties: false

required:
  - compatible
  - reg

examples:
  - |
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      ethernet-pse@20 {
        compatible = "ti,tps23881";
        reg = <0x20>;

        channels {
          #address-cells = <1>;
          #size-cells = <0>;

          phys0: channel@0 {
            reg = <0>;
          };

          phys1: channel@1 {
            reg = <1>;
          };

          phys2: channel@2 {
            reg = <2>;
          };
        };

        pse-pis {
          #address-cells = <1>;
          #size-cells = <0>;

          pse_pi0: pse-pi@0 {
            reg = <0>;
            #pse-cells = <0>;
            pairset-names = "alternative-a", "alternative-b";
            pairsets = <&phys0>, <&phys1>;
            polarity-supported = "MDI", "S";
            vpwr-supply = <&vpwr1>;
          };

          pse_pi1: pse-pi@1 {
            reg = <1>;
            #pse-cells = <0>;
            pairset-names = "alternative-a";
            pairsets = <&phys2>;
            polarity-supported = "MDI";
            vpwr-supply = <&vpwr2>;
          };
        };
      };
    };
+24 −9
Original line number Diff line number Diff line
@@ -899,17 +899,29 @@ attribute-sets:
        type: nest
        nested-attributes: header
      -
        name: admin-state
        name: podl-pse-admin-state
        type: u32
        name-prefix: ethtool-a-podl-pse-
        name-prefix: ethtool-a-
      -
        name: admin-control
        name: podl-pse-admin-control
        type: u32
        name-prefix: ethtool-a-podl-pse-
        name-prefix: ethtool-a-
      -
        name: pw-d-status
        name: podl-pse-pw-d-status
        type: u32
        name-prefix: ethtool-a-podl-pse-
        name-prefix: ethtool-a-
      -
        name: c33-pse-admin-state
        type: u32
        name-prefix: ethtool-a-
      -
        name: c33-pse-admin-control
        type: u32
        name-prefix: ethtool-a-
      -
        name: c33-pse-pw-d-status
        type: u32
        name-prefix: ethtool-a-
  -
    name: rss
    attributes:
@@ -1593,9 +1605,12 @@ operations:
        reply:
          attributes: &pse
            - header
            - admin-state
            - admin-control
            - pw-d-status
            - podl-pse-admin-state
            - podl-pse-admin-control
            - podl-pse-pw-d-status
            - c33-pse-admin-state
            - c33-pse-admin-control
            - c33-pse-pw-d-status
      dump: *pse-get-op
    -
      name: pse-set
+20 −0
Original line number Diff line number Diff line
@@ -1733,6 +1733,10 @@ Kernel response contents:
                                                  PSE functions
  ``ETHTOOL_A_PODL_PSE_PW_D_STATUS``         u32  power detection status of the
                                                  PoDL PSE.
  ``ETHTOOL_A_C33_PSE_ADMIN_STATE``          u32  Operational state of the PoE
                                                  PSE functions.
  ``ETHTOOL_A_C33_PSE_PW_D_STATUS``          u32  power detection status of the
                                                  PoE PSE.
  ======================================  ======  =============================

When set, the optional ``ETHTOOL_A_PODL_PSE_ADMIN_STATE`` attribute identifies
@@ -1744,6 +1748,12 @@ aPoDLPSEAdminState. Possible values are:
.. kernel-doc:: include/uapi/linux/ethtool.h
    :identifiers: ethtool_podl_pse_admin_state

The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_STATE`` implementing
``IEEE 802.3-2022`` 30.9.1.1.2 aPSEAdminState.

.. kernel-doc:: include/uapi/linux/ethtool.h
    :identifiers: ethtool_c33_pse_admin_state

When set, the optional ``ETHTOOL_A_PODL_PSE_PW_D_STATUS`` attribute identifies
the power detection status of the PoDL PSE.  The status depend on internal PSE
state machine and automatic PD classification support. This option is
@@ -1753,6 +1763,12 @@ Possible values are:
.. kernel-doc:: include/uapi/linux/ethtool.h
    :identifiers: ethtool_podl_pse_pw_d_status

The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_PW_D_STATUS`` implementing
``IEEE 802.3-2022`` 30.9.1.1.5 aPSEPowerDetectionStatus.

.. kernel-doc:: include/uapi/linux/ethtool.h
    :identifiers: ethtool_c33_pse_pw_d_status

PSE_SET
=======

@@ -1763,6 +1779,7 @@ Request contents:
  ======================================  ======  =============================
  ``ETHTOOL_A_PSE_HEADER``                nested  request header
  ``ETHTOOL_A_PODL_PSE_ADMIN_CONTROL``       u32  Control PoDL PSE Admin state
  ``ETHTOOL_A_C33_PSE_ADMIN_CONTROL``        u32  Control PSE Admin state
  ======================================  ======  =============================

When set, the optional ``ETHTOOL_A_PODL_PSE_ADMIN_CONTROL`` attribute is used
@@ -1770,6 +1787,9 @@ to control PoDL PSE Admin functions. This option is implementing
``IEEE 802.3-2018`` 30.15.1.2.1 acPoDLPSEAdminControl. See
``ETHTOOL_A_PODL_PSE_ADMIN_STATE`` for supported values.

The same goes for ``ETHTOOL_A_C33_PSE_ADMIN_CONTROL`` implementing
``IEEE 802.3-2022`` 30.9.1.2.1 acPSEAdminControl.

RSS_GET
=======

Loading