Commit 220a29d0 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-phy-add-support-for-new-aeonsemi-phys'

Christian Marangi says:

====================
net: phy: Add support for new Aeonsemi PHYs

Add support for new Aeonsemi 10G C45 PHYs. These PHYs intergate an IPC
to setup some configuration and require special handling to sync with
the parity bit. The parity bit is a way the IPC use to follow correct
order of command sent.

Supported PHYs AS21011JB1, AS21011PB1, AS21010JB1, AS21010PB1,
AS21511JB1, AS21511PB1, AS21510JB1, AS21510PB1, AS21210JB1,
AS21210PB1 that all register with the PHY ID 0x7500 0x7500
before the firmware is loaded.

The big special thing about this PHY is that it does provide
a generic PHY ID in C45 register that change to the correct one
one the firmware is loaded.

In practice:
- MMD 0x7 ID 0x7500 0x9410 -> FW LOAD -> ID 0x7500 0x9422

To handle this, we operate on .match_phy_device where
we check the PHY ID, if the ID match the generic one,
we load the firmware and we return 0 (PHY driver doesn't
match). Then PHY core will try the next PHY driver in the list
and this time the PHY is correctly filled in and we register
for it.

To help in the matching and not modify part of the PHY device
struct, .match_phy_device is extended to provide also the
current phy_driver is trying to match for. This add the
extra benefits that some other PHY can simplify their
.match_phy_device OP.
====================

Link: https://patch.msgid.link/20250517201353.5137-1-ansuelsmth@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents d42d4407 3e2b7229
Loading
Loading
Loading
Loading
+122 −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/aeonsemi,as21xxx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Aeonsemi AS21XXX Ethernet PHY

maintainers:
  - Christian Marangi <ansuelsmth@gmail.com>

description: |
  Aeonsemi AS21xxx Ethernet PHYs requires a firmware to be loaded to actually
  work. The same firmware is compatible with various PHYs of the same family.

  A PHY with not firmware loaded will be exposed on the MDIO bus with ID
  0x7500 0x7500 or 0x7500 0x9410 on C45 registers.

  This can be done and is implemented by OEM in 2 different way:
    - Attached SPI flash directly to the PHY with the firmware. The PHY
      will self load the firmware in the presence of this configuration.
    - Manually provided firmware loaded from a file in the filesystem.

  Each PHY can support up to 5 LEDs.

  AS2xxx PHY Name logic:

  AS21x1xxB1
      ^ ^^
      | |J: Supports SyncE/PTP
      | |P: No SyncE/PTP support
      | 1: Supports 2nd Serdes
      | 2: Not 2nd Serdes support
      0: 10G, 5G, 2.5G
      5: 5G, 2.5G
      2: 2.5G

allOf:
  - $ref: ethernet-phy.yaml#

select:
  properties:
    compatible:
      contains:
        enum:
          - ethernet-phy-id7500.9410
          - ethernet-phy-id7500.9402
          - ethernet-phy-id7500.9412
          - ethernet-phy-id7500.9422
          - ethernet-phy-id7500.9432
          - ethernet-phy-id7500.9442
          - ethernet-phy-id7500.9452
          - ethernet-phy-id7500.9462
          - ethernet-phy-id7500.9472
          - ethernet-phy-id7500.9482
          - ethernet-phy-id7500.9492
  required:
    - compatible

properties:
  reg:
    maxItems: 1

  firmware-name:
    description: specify the name of PHY firmware to load
    maxItems: 1

required:
  - compatible
  - reg

if:
  properties:
    compatible:
      contains:
        const: ethernet-phy-id7500.9410
then:
  required:
    - firmware-name
else:
  properties:
    firmware-name: false

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/leds/common.h>

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

        ethernet-phy@1f {
            compatible = "ethernet-phy-id7500.9410",
                         "ethernet-phy-ieee802.3-c45";

            reg = <31>;
            firmware-name = "as21x1x_fw.bin";

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

                led@0 {
                    reg = <0>;
                    color = <LED_COLOR_ID_GREEN>;
                    function = LED_FUNCTION_LAN;
                    function-enumerator = <0>;
                    default-state = "keep";
                };

                led@1 {
                    reg = <1>;
                    color = <LED_COLOR_ID_GREEN>;
                    function = LED_FUNCTION_LAN;
                    function-enumerator = <1>;
                    default-state = "keep";
                };
            };
        };
    };
+7 −0
Original line number Diff line number Diff line
@@ -646,6 +646,13 @@ F: drivers/iio/accel/adxl380.h
F:	drivers/iio/accel/adxl380_i2c.c
F:	drivers/iio/accel/adxl380_spi.c
AEONSEMI PHY DRIVER
M:	Christian Marangi <ansuelsmth@gmail.com>
L:	netdev@vger.kernel.org
S:	Maintained
F:	Documentation/devicetree/bindings/net/aeonsemi,as21xxx.yaml
F:	drivers/net/phy/as21xxx.c
AF8133J THREE-AXIS MAGNETOMETER DRIVER
M:	Ondřej Jirman <megi@xff.cz>
S:	Maintained
+12 −0
Original line number Diff line number Diff line
@@ -76,6 +76,18 @@ config SFP

comment "MII PHY device drivers"

config AS21XXX_PHY
	tristate "Aeonsemi AS21xxx PHYs"
	help
	  Currently supports the Aeonsemi AS21xxx PHY.

	  These are C45 PHYs 10G that require all a generic firmware.

	  Supported PHYs AS21011JB1, AS21011PB1, AS21010JB1, AS21010PB1,
	  AS21511JB1, AS21511PB1, AS21510JB1, AS21510PB1, AS21210JB1,
	  AS21210PB1 that all register with the PHY ID 0x7500 0x7500
	  before the firmware is loaded.

config AIR_EN8811H_PHY
	tristate "Airoha EN8811H 2.5 Gigabit PHY"
	help
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o
obj-$(CONFIG_AMD_PHY)		+= amd.o
obj-$(CONFIG_AMCC_QT2025_PHY)	+= qt2025.o
obj-$(CONFIG_AQUANTIA_PHY)	+= aquantia/
obj-$(CONFIG_AS21XXX_PHY)	+= as21xxx.o
ifdef CONFIG_AX88796B_RUST_PHY
  obj-$(CONFIG_AX88796B_PHY)	+= ax88796b_rust.o
else
+1087 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading