net: phy: aquantia: add AQR112 and AQR412 PHY IDs
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 14 Nov 2022 17:07:27 +0000 (19:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Nov 2022 04:34:27 +0000 (20:34 -0800)
These are Gen3 Aquantia N-BASET PHYs which support 5GBASE-T,
2.5GBASE-T, 1000BASE-T and 100BASE-TX (not 10G); also EEE, Sync-E,
PTP, PoE.

The 112 is a single PHY package, the 412 is a quad PHY package.

The system-side SERDES interface of these PHYs selects its protocol
depending on the negotiated media side link speed. That protocol can be
1000BASE-X, 2500BASE-X, 10GBASE-R, SGMII, USXGMII.

The configuration of which SERDES protocol to use for which link speed
is made by firmware; even though it could be overwritten over MDIO by
Linux, we assume that the firmware provisioning is ok for the board on
which the driver probes.

For cases when the system side runs at a fixed rate, we want phylib/phylink
to detect the PAUSE rate matching ability of these PHYs, so we need to
use the Aquantia rather than the generic C45 driver. This needs
aqr107_read_status() -> aqr107_read_rate() to set phydev->rate_matching,
as well as the aqr107_get_rate_matching() method.

I am a bit unsure about the naming convention in the driver. Since
AQR107 is a Gen2 PHY, I assume all functions prefixed with "aqr107_"
rather than "aqr_" mean Gen2+ features. So I've reused this naming
convention.

I've tested PHY "SGMII" statistics as well as the .link_change_notify
method, which prints:

Aquantia AQR412 mdio_mux-0.4:00: Link partner is Aquantia PHY, FW 4.3, fast-retrain downshift advertised, fast reframe advertised

Tested SERDES protocols are usxgmii and 2500base-x (the latter with
PAUSE rate matching). Tested link modes are 100/1000/2500 Base-T
(with Aquantia link partner and with other link partners). No notable
events observed.

The placement of these PHY IDs in the driver is right before AQR113C,
a Gen4 PHY.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/aquantia_main.c

index 47a76df..334a690 100644 (file)
@@ -22,6 +22,8 @@
 #define PHY_ID_AQR107  0x03a1b4e0
 #define PHY_ID_AQCS109 0x03a1b5c2
 #define PHY_ID_AQR405  0x03a1b4b0
+#define PHY_ID_AQR112  0x03a1b662
+#define PHY_ID_AQR412  0x03a1b712
 #define PHY_ID_AQR113C 0x31c31c12
 
 #define MDIO_PHYXS_VEND_IF_STATUS              0xe812
@@ -801,6 +803,42 @@ static struct phy_driver aqr_driver[] = {
        .read_status    = aqr_read_status,
 },
 {
+       PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
+       .name           = "Aquantia AQR112",
+       .probe          = aqr107_probe,
+       .config_aneg    = aqr_config_aneg,
+       .config_intr    = aqr_config_intr,
+       .handle_interrupt = aqr_handle_interrupt,
+       .get_tunable    = aqr107_get_tunable,
+       .set_tunable    = aqr107_set_tunable,
+       .suspend        = aqr107_suspend,
+       .resume         = aqr107_resume,
+       .read_status    = aqr107_read_status,
+       .get_rate_matching = aqr107_get_rate_matching,
+       .get_sset_count = aqr107_get_sset_count,
+       .get_strings    = aqr107_get_strings,
+       .get_stats      = aqr107_get_stats,
+       .link_change_notify = aqr107_link_change_notify,
+},
+{
+       PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
+       .name           = "Aquantia AQR412",
+       .probe          = aqr107_probe,
+       .config_aneg    = aqr_config_aneg,
+       .config_intr    = aqr_config_intr,
+       .handle_interrupt = aqr_handle_interrupt,
+       .get_tunable    = aqr107_get_tunable,
+       .set_tunable    = aqr107_set_tunable,
+       .suspend        = aqr107_suspend,
+       .resume         = aqr107_resume,
+       .read_status    = aqr107_read_status,
+       .get_rate_matching = aqr107_get_rate_matching,
+       .get_sset_count = aqr107_get_sset_count,
+       .get_strings    = aqr107_get_strings,
+       .get_stats      = aqr107_get_stats,
+       .link_change_notify = aqr107_link_change_notify,
+},
+{
        PHY_ID_MATCH_MODEL(PHY_ID_AQR113C),
        .name           = "Aquantia AQR113C",
        .probe          = aqr107_probe,
@@ -831,6 +869,8 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = {
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
        { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) },
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
+       { PHY_ID_MATCH_MODEL(PHY_ID_AQR112) },
+       { PHY_ID_MATCH_MODEL(PHY_ID_AQR412) },
        { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
        { }
 };