net: phy: aquantia: enable support for aqr115c
Subsystems (3)
v3 cover net: phy: aquantia: enable support for aqr115c
From: Bartosz Golaszewski <[email protected]>
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/[email protected]/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/[email protected]/T/
Bartosz Golaszewski (4):
net: phy: aquantia: rename and export aqr107_wait_reset_complete()
net: phy: aquantia: wait for FW reset before checking the vendor ID
net: phy: aquantia: wait for the GLOBAL_CFG to start returning real
values
net: phy: aquantia: add support for aqr115c
drivers/net/phy/aquantia/aquantia.h | 1 + drivers/net/phy/aquantia/aquantia_firmware.c | 4 ++ drivers/net/phy/aquantia/aquantia_main.c | 40 ++++++++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/4 net: phy: aquantia: rename and export aqr107_wait_reset_complete()
From: Bartosz Golaszewski <[email protected]>
This function is quite generic in this driver and not limited to aqr107. We will use it outside its current compilation unit soon so rename it and declare it in the header.
--- drivers/net/phy/aquantia/aquantia.h | 1 + drivers/net/phy/aquantia/aquantia_main.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/phy/aquantia/aquantia.h +1 -0
@@ -201,5 +201,6 @@ int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index,int aqr_phy_led_active_low_set (struct phy_device *phydev,int index,bool enable);int aqr_phy_led_polarity_set (struct phy_device *phydev,int index,unsigned long modes); +int aqr_wait_reset_complete (struct phy_device *phydev);#endif /* AQUANTIA_H */
drivers/net/phy/aquantia/aquantia_main.c +3 -3
@@ -441,7 +441,7 @@ static int aqr107_set_tunable(struct phy_device *phydev,* The chip also provides a "reset completed" bit, but it's cleared after * read. Therefore function would time out if called again. */ -static int aqr107_wait_reset_complete (struct phy_device *phydev) +int aqr_wait_reset_complete (struct phy_device *phydev) {int val;
@@ -494,7 +494,7 @@ static int aqr107_config_init(struct phy_device *phydev)WARN (phydev->interface ==PHY_INTERFACE_MODE_XGMII ,"Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n" ); - ret =aqr107_wait_reset_complete (phydev); + ret =aqr_wait_reset_complete (phydev);if (!ret)aqr107_chip_info (phydev);
@@ -522,7 +522,7 @@ static int aqcs109_config_init(struct phy_device *phydev) phydev->interface != PHY_INTERFACE_MODE_2500BASEX)return -ENODEV ; - ret =aqr107_wait_reset_complete (phydev); + ret =aqr_wait_reset_complete (phydev);if (!ret)aqr107_chip_info (phydev);
Signature · 1 line
2.43.0
PATCH v3 2/4 net: phy: aquantia: wait for FW reset before checking the vendor ID
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Checking the firmware register before it complete the boot process makes no sense, it will report 0 even if FW is available from internal memory. Always wait for FW to boot before continuing or we'll unnecessarily try to load it from nvmem/filesystem and fail.
--- drivers/net/phy/aquantia/aquantia_firmware.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/phy/aquantia/aquantia_firmware.c +4 -0
@@ -353,6 +353,10 @@ int aqr_firmware_load(struct phy_device *phydev) {int ret; + ret =aqr_wait_reset_complete (phydev); +if (ret) +return ret; +/* Check if the firmware is not already loaded by pooling * the current version returned by the PHY. If 0 is returned, * no firmware is loaded.
Signature · 1 line
2.43.0
PATCH v3 3/4 net: phy: aquantia: wait for the GLOBAL_CFG to start returning real values
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
When the PHY is first coming up (or resuming from suspend), it's possible that although the FW status shows as running, we still see zeroes in the GLOBAL_CFG set of registers and cannot determine available modes. Since all models support 10M, add a poll and wait the config to become available.
--- drivers/net/phy/aquantia/aquantia_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/phy/aquantia/aquantia_main.c +7 -1
@@ -652,7 +652,13 @@ static int aqr107_fill_interface_modes(struct phy_device *phydev)unsigned long *possible = phydev->possible_interfaces;unsigned int serdes_mode, rate_adapt;phy_interface_t interface; -int i, val; +int i, val, ret; + + ret =phy_read_mmd_poll_timeout (phydev,MDIO_MMD_VEND1 , +VEND1_GLOBAL_CFG_10M , val, val !=0 , +1000 ,100000 , false); +if (ret) +return ret;/* Walk the media-speed configuration registers to determine which * host-side serdes modes may be used by the PHY depending on the
Signature · 1 line
2.43.0
PATCH v3 4/4 net: phy: aquantia: add support for aqr115c
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add support for a new model to the Aquantia driver. This PHY supports 2.5 gigabit speeds. The PHY mode is referred to by the manufacturer as Overclocked SGMII (OCSGMII) but this actually is just 2500BASEX without in-band signalling so reuse the existing mode to avoid changing the uAPI.
--- drivers/net/phy/aquantia/aquantia_main.c | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/net/phy/aquantia/aquantia_main.c +26 -0
@@ -29,6 +29,7 @@#define PHY_ID_AQR113 0x31c31c40#define PHY_ID_AQR113C 0x31c31c12#define PHY_ID_AQR114C 0x31c31c22 +#define PHY_ID_AQR115C 0x31c31c33#define PHY_ID_AQR813 0x31c31cb2#define MDIO_PHYXS_VEND_IF_STATUS 0xe812
@@ -1005,6 +1006,30 @@ static struct phy_driver aqr_driver[] = { .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR115C), + .name = "Aquantia AQR115C", + .probe = aqr107_probe, + .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr113c_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr107_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, + .resume = aqr107_resume, + .get_sset_count = aqr107_get_sset_count, + .get_strings = aqr107_get_strings, + .get_stats = aqr107_get_stats, + .link_change_notify = aqr107_link_change_notify, + .led_brightness_set = aqr_phy_led_brightness_set, + .led_hw_is_supported = aqr_phy_led_hw_is_supported, + .led_hw_control_set = aqr_phy_led_hw_control_set, + .led_hw_control_get = aqr_phy_led_hw_control_get, + .led_polarity_set = aqr_phy_led_polarity_set, +}, {PHY_ID_MATCH_MODEL (PHY_ID_AQR813 ), .name = "Aquantia AQR813",
@@ -1048,6 +1073,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR115C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { } };
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 1 line · On Wed, 3 Jul 2024 20:11:27 +0200 Bartosz Golaszewski wrote:
[PATCH net-next v3 0/4] net: phy: aquantia: enable support for aqr115c
Doesn't seem to apply:
Applying: net: phy: aquantia: rename and export aqr107_wait_reset_complete()
error: patch failed: drivers/net/phy/aquantia/aquantia.h:201
error: drivers/net/phy/aquantia/aquantia.h: patch does not apply
Patch failed at 0001 net: phy: aquantia: rename and export aqr107_wait_reset_complete()
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Signature · 1 line
pw-bot: cr
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Wed, 3 Jul 2024 20:11:27 +0200 Bartosz Golaszewski wrote:
[PATCH net-next v3 0/4] net: phy: aquantia: enable support for aqr115c
Doesn't seem to apply:
Quoted 11 lines
Applying: net: phy: aquantia: rename and export
aqr107_wait_reset_complete()
error: patch failed:drivers/net/phy/aquantia/aquantia.h:201
error:drivers/net/phy/aquantia/aquantia.h: patch does not apply
Patch failed at 0001 net: phy: aquantia: rename and exportaqr107_wait_reset_complete()
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false" --
pw-bot: cr
It conflicts with the fix I sent separately to add include guards that I had in my branch as well. I'll resend it.
Bart
Quoted 20 lines · Bartosz Golaszewski
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Wed, 3 Jul 2024 20:11:27 +0200 Bartosz Golaszewski wrote:
[PATCH net-next v3 0/4] net: phy: aquantia: enable support for aqr115c
Doesn't seem to apply:
Quoted 11 lines
Applying: net: phy: aquantia: rename and export
aqr107_wait_reset_complete()
error: patch failed:drivers/net/phy/aquantia/aquantia.h:201
error:drivers/net/phy/aquantia/aquantia.h: patch does not apply
Patch failed at 0001 net: phy: aquantia: rename and exportaqr107_wait_reset_complete()
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false" --
pw-bot: cr
Quoted 4 lines
It conflicts with the fix I sent separately to add include guards that I had in my branch as well. I'll resend it.
Bart
Actually this conflicts with commit 61578f679378 ("net: phy: aquantia:
add support for PHY LEDs") that was applied to net-next recently. The resolution is trivial - just leave both sides as they are. Can you resolve it when applying or do you want a new version after all?
Bart
Quoted 25 lines · Bartosz Golaszewski
Quoted 23 lines · Bartosz Golaszewski
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Wed, 3 Jul 2024 20:11:27 +0200 Bartosz Golaszewski wrote:
[PATCH net-next v3 0/4] net: phy: aquantia: enable support for aqr115c
Doesn't seem to apply:
Quoted 11 lines
Applying: net: phy: aquantia: rename and export
aqr107_wait_reset_complete()
error: patch failed:drivers/net/phy/aquantia/aquantia.h:201
error:drivers/net/phy/aquantia/aquantia.h: patch does not apply
Patch failed at 0001 net: phy: aquantia: rename and exportaqr107_wait_reset_complete()
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false" --
pw-bot: crIt conflicts with the fix I sent separately to add include guards that I had in my branch as well. I'll resend it.
Quoted 8 lines
Quoted 1 line
Bart
Actually this conflicts with commit
61578f679378("net: phy: aquantia:
add support for PHY LEDs") that was applied to net-next recently. The resolution is trivial - just leave both sides as they are. Can you resolve it when applying or do you want a new version after all?Bart
Nevermind, I resent this version rebased on top of today's net-next.
Bart