Skip to content

Commit 220a29d

Browse files
committed
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: Jakub Kicinski <kuba@kernel.org>
2 parents d42d440 + 3e2b722 commit 220a29d

File tree

16 files changed

+1337
-66
lines changed

16 files changed

+1337
-66
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/aeonsemi,as21xxx.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Aeonsemi AS21XXX Ethernet PHY
8+
9+
maintainers:
10+
- Christian Marangi <ansuelsmth@gmail.com>
11+
12+
description: |
13+
Aeonsemi AS21xxx Ethernet PHYs requires a firmware to be loaded to actually
14+
work. The same firmware is compatible with various PHYs of the same family.
15+
16+
A PHY with not firmware loaded will be exposed on the MDIO bus with ID
17+
0x7500 0x7500 or 0x7500 0x9410 on C45 registers.
18+
19+
This can be done and is implemented by OEM in 2 different way:
20+
- Attached SPI flash directly to the PHY with the firmware. The PHY
21+
will self load the firmware in the presence of this configuration.
22+
- Manually provided firmware loaded from a file in the filesystem.
23+
24+
Each PHY can support up to 5 LEDs.
25+
26+
AS2xxx PHY Name logic:
27+
28+
AS21x1xxB1
29+
^ ^^
30+
| |J: Supports SyncE/PTP
31+
| |P: No SyncE/PTP support
32+
| 1: Supports 2nd Serdes
33+
| 2: Not 2nd Serdes support
34+
0: 10G, 5G, 2.5G
35+
5: 5G, 2.5G
36+
2: 2.5G
37+
38+
allOf:
39+
- $ref: ethernet-phy.yaml#
40+
41+
select:
42+
properties:
43+
compatible:
44+
contains:
45+
enum:
46+
- ethernet-phy-id7500.9410
47+
- ethernet-phy-id7500.9402
48+
- ethernet-phy-id7500.9412
49+
- ethernet-phy-id7500.9422
50+
- ethernet-phy-id7500.9432
51+
- ethernet-phy-id7500.9442
52+
- ethernet-phy-id7500.9452
53+
- ethernet-phy-id7500.9462
54+
- ethernet-phy-id7500.9472
55+
- ethernet-phy-id7500.9482
56+
- ethernet-phy-id7500.9492
57+
required:
58+
- compatible
59+
60+
properties:
61+
reg:
62+
maxItems: 1
63+
64+
firmware-name:
65+
description: specify the name of PHY firmware to load
66+
maxItems: 1
67+
68+
required:
69+
- compatible
70+
- reg
71+
72+
if:
73+
properties:
74+
compatible:
75+
contains:
76+
const: ethernet-phy-id7500.9410
77+
then:
78+
required:
79+
- firmware-name
80+
else:
81+
properties:
82+
firmware-name: false
83+
84+
unevaluatedProperties: false
85+
86+
examples:
87+
- |
88+
#include <dt-bindings/leds/common.h>
89+
90+
mdio {
91+
#address-cells = <1>;
92+
#size-cells = <0>;
93+
94+
ethernet-phy@1f {
95+
compatible = "ethernet-phy-id7500.9410",
96+
"ethernet-phy-ieee802.3-c45";
97+
98+
reg = <31>;
99+
firmware-name = "as21x1x_fw.bin";
100+
101+
leds {
102+
#address-cells = <1>;
103+
#size-cells = <0>;
104+
105+
led@0 {
106+
reg = <0>;
107+
color = <LED_COLOR_ID_GREEN>;
108+
function = LED_FUNCTION_LAN;
109+
function-enumerator = <0>;
110+
default-state = "keep";
111+
};
112+
113+
led@1 {
114+
reg = <1>;
115+
color = <LED_COLOR_ID_GREEN>;
116+
function = LED_FUNCTION_LAN;
117+
function-enumerator = <1>;
118+
default-state = "keep";
119+
};
120+
};
121+
};
122+
};

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,13 @@ F: drivers/iio/accel/adxl380.h
646646
F: drivers/iio/accel/adxl380_i2c.c
647647
F: drivers/iio/accel/adxl380_spi.c
648648

649+
AEONSEMI PHY DRIVER
650+
M: Christian Marangi <ansuelsmth@gmail.com>
651+
L: netdev@vger.kernel.org
652+
S: Maintained
653+
F: Documentation/devicetree/bindings/net/aeonsemi,as21xxx.yaml
654+
F: drivers/net/phy/as21xxx.c
655+
649656
AF8133J THREE-AXIS MAGNETOMETER DRIVER
650657
M: Ondřej Jirman <megi@xff.cz>
651658
S: Maintained

drivers/net/phy/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ config SFP
7676

7777
comment "MII PHY device drivers"
7878

79+
config AS21XXX_PHY
80+
tristate "Aeonsemi AS21xxx PHYs"
81+
help
82+
Currently supports the Aeonsemi AS21xxx PHY.
83+
84+
These are C45 PHYs 10G that require all a generic firmware.
85+
86+
Supported PHYs AS21011JB1, AS21011PB1, AS21010JB1, AS21010PB1,
87+
AS21511JB1, AS21511PB1, AS21510JB1, AS21510PB1, AS21210JB1,
88+
AS21210PB1 that all register with the PHY ID 0x7500 0x7500
89+
before the firmware is loaded.
90+
7991
config AIR_EN8811H_PHY
8092
tristate "Airoha EN8811H 2.5 Gigabit PHY"
8193
help

drivers/net/phy/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o
3232
obj-$(CONFIG_AMD_PHY) += amd.o
3333
obj-$(CONFIG_AMCC_QT2025_PHY) += qt2025.o
3434
obj-$(CONFIG_AQUANTIA_PHY) += aquantia/
35+
obj-$(CONFIG_AS21XXX_PHY) += as21xxx.o
3536
ifdef CONFIG_AX88796B_RUST_PHY
3637
obj-$(CONFIG_AX88796B_PHY) += ax88796b_rust.o
3738
else

0 commit comments

Comments
 (0)