Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'aquantia-phy-aqr115c' into main

Bartosz Golaszewski says:

====================
net: phy: aquantia: enable support for aqr115c

This series addesses two issues with the aqr115c PHY on Qualcomm
sa8775p-ride-r3 board and adds support for this PHY to the aquantia driver.

While the manufacturer calls the 2.5G PHY mode OCSGMII, we reuse the existing
2500BASEX mode in the kernel to avoid extending the uAPI.

It took me a while to resend because I noticed an issue with the PHY coming
out of suspend with no possible interfaces listed and tracked it to the
GLOBAL_CFG registers for different modes returning 0. A workaround has been
added to the series. Unfortunately the HPG doesn't mention a proper way of
doing it or even mention any such issue at all.

Changes since v2:
- add a patch that addresses an issue with GLOBAL_CFG registers returning 0
- reuse aqr113c_config_init() for aqr115c
- improve commit messages, give more details on the 2500BASEX mode reuse
Link to v2: https://lore.kernel.org/lkml/Zn4Nq1QvhjAUaogb@makrotopia.org/T/

Changes since v1:
- split out the PHY patches into their own series
- don't introduce new mode (OCSGMII) but use existing 2500BASEX instead
- split the wait-for-FW patch into two: one renaming and exporting the
relevant function and the second using it before checking the FW ID
Link to v1: https://lore.kernel.org/linux-arm-kernel/20240619184550.34524-1-brgl@bgdev.pl/T/
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+42 -4
+2
drivers/net/phy/aquantia/aquantia.h
··· 201 201 int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable); 202 202 int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, 203 203 unsigned long modes); 204 + int aqr_wait_reset_complete(struct phy_device *phydev); 205 + 204 206 #endif /* AQUANTIA_H */
+4
drivers/net/phy/aquantia/aquantia_firmware.c
··· 353 353 { 354 354 int ret; 355 355 356 + ret = aqr_wait_reset_complete(phydev); 357 + if (ret) 358 + return ret; 359 + 356 360 /* Check if the firmware is not already loaded by pooling 357 361 * the current version returned by the PHY. If 0 is returned, 358 362 * no firmware is loaded.
+36 -4
drivers/net/phy/aquantia/aquantia_main.c
··· 29 29 #define PHY_ID_AQR113 0x31c31c40 30 30 #define PHY_ID_AQR113C 0x31c31c12 31 31 #define PHY_ID_AQR114C 0x31c31c22 32 + #define PHY_ID_AQR115C 0x31c31c33 32 33 #define PHY_ID_AQR813 0x31c31cb2 33 34 34 35 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 ··· 442 441 * The chip also provides a "reset completed" bit, but it's cleared after 443 442 * read. Therefore function would time out if called again. 444 443 */ 445 - static int aqr107_wait_reset_complete(struct phy_device *phydev) 444 + int aqr_wait_reset_complete(struct phy_device *phydev) 446 445 { 447 446 int val; 448 447 ··· 495 494 WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, 496 495 "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n"); 497 496 498 - ret = aqr107_wait_reset_complete(phydev); 497 + ret = aqr_wait_reset_complete(phydev); 499 498 if (!ret) 500 499 aqr107_chip_info(phydev); 501 500 ··· 523 522 phydev->interface != PHY_INTERFACE_MODE_2500BASEX) 524 523 return -ENODEV; 525 524 526 - ret = aqr107_wait_reset_complete(phydev); 525 + ret = aqr_wait_reset_complete(phydev); 527 526 if (!ret) 528 527 aqr107_chip_info(phydev); 529 528 ··· 653 652 unsigned long *possible = phydev->possible_interfaces; 654 653 unsigned int serdes_mode, rate_adapt; 655 654 phy_interface_t interface; 656 - int i, val; 655 + int i, val, ret; 656 + 657 + ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, 658 + VEND1_GLOBAL_CFG_10M, val, val != 0, 659 + 1000, 100000, false); 660 + if (ret) 661 + return ret; 657 662 658 663 /* Walk the media-speed configuration registers to determine which 659 664 * host-side serdes modes may be used by the PHY depending on the ··· 1007 1000 .led_polarity_set = aqr_phy_led_polarity_set, 1008 1001 }, 1009 1002 { 1003 + PHY_ID_MATCH_MODEL(PHY_ID_AQR115C), 1004 + .name = "Aquantia AQR115C", 1005 + .probe = aqr107_probe, 1006 + .get_rate_matching = aqr107_get_rate_matching, 1007 + .config_init = aqr113c_config_init, 1008 + .config_aneg = aqr_config_aneg, 1009 + .config_intr = aqr_config_intr, 1010 + .handle_interrupt = aqr_handle_interrupt, 1011 + .read_status = aqr107_read_status, 1012 + .get_tunable = aqr107_get_tunable, 1013 + .set_tunable = aqr107_set_tunable, 1014 + .suspend = aqr107_suspend, 1015 + .resume = aqr107_resume, 1016 + .get_sset_count = aqr107_get_sset_count, 1017 + .get_strings = aqr107_get_strings, 1018 + .get_stats = aqr107_get_stats, 1019 + .link_change_notify = aqr107_link_change_notify, 1020 + .led_brightness_set = aqr_phy_led_brightness_set, 1021 + .led_hw_is_supported = aqr_phy_led_hw_is_supported, 1022 + .led_hw_control_set = aqr_phy_led_hw_control_set, 1023 + .led_hw_control_get = aqr_phy_led_hw_control_get, 1024 + .led_polarity_set = aqr_phy_led_polarity_set, 1025 + }, 1026 + { 1010 1027 PHY_ID_MATCH_MODEL(PHY_ID_AQR813), 1011 1028 .name = "Aquantia AQR813", 1012 1029 .probe = aqr107_probe, ··· 1073 1042 { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, 1074 1043 { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, 1075 1044 { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, 1045 + { PHY_ID_MATCH_MODEL(PHY_ID_AQR115C) }, 1076 1046 { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, 1077 1047 { } 1078 1048 };