Commit ce2f84eb authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 40ab9e0d 0ebc581f
...@@ -201,4 +201,6 @@ int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index, ...@@ -201,4 +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_active_low_set(struct phy_device *phydev, int index, bool enable);
int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, int aqr_phy_led_polarity_set(struct phy_device *phydev, int index,
unsigned long modes); unsigned long modes);
int aqr_wait_reset_complete(struct phy_device *phydev);
#endif /* AQUANTIA_H */ #endif /* AQUANTIA_H */
...@@ -353,6 +353,10 @@ int aqr_firmware_load(struct phy_device *phydev) ...@@ -353,6 +353,10 @@ int aqr_firmware_load(struct phy_device *phydev)
{ {
int ret; int ret;
ret = aqr_wait_reset_complete(phydev);
if (ret)
return ret;
/* Check if the firmware is not already loaded by pooling /* Check if the firmware is not already loaded by pooling
* the current version returned by the PHY. If 0 is returned, * the current version returned by the PHY. If 0 is returned,
* no firmware is loaded. * no firmware is loaded.
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define PHY_ID_AQR113 0x31c31c40 #define PHY_ID_AQR113 0x31c31c40
#define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR113C 0x31c31c12
#define PHY_ID_AQR114C 0x31c31c22 #define PHY_ID_AQR114C 0x31c31c22
#define PHY_ID_AQR115C 0x31c31c33
#define PHY_ID_AQR813 0x31c31cb2 #define PHY_ID_AQR813 0x31c31cb2
#define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812
...@@ -441,7 +442,7 @@ static int aqr107_set_tunable(struct phy_device *phydev, ...@@ -441,7 +442,7 @@ static int aqr107_set_tunable(struct phy_device *phydev,
* The chip also provides a "reset completed" bit, but it's cleared after * The chip also provides a "reset completed" bit, but it's cleared after
* read. Therefore function would time out if called again. * 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; int val;
...@@ -494,7 +495,7 @@ static int aqr107_config_init(struct phy_device *phydev) ...@@ -494,7 +495,7 @@ static int aqr107_config_init(struct phy_device *phydev)
WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, 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"); "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) if (!ret)
aqr107_chip_info(phydev); aqr107_chip_info(phydev);
...@@ -522,7 +523,7 @@ static int aqcs109_config_init(struct phy_device *phydev) ...@@ -522,7 +523,7 @@ static int aqcs109_config_init(struct phy_device *phydev)
phydev->interface != PHY_INTERFACE_MODE_2500BASEX) phydev->interface != PHY_INTERFACE_MODE_2500BASEX)
return -ENODEV; return -ENODEV;
ret = aqr107_wait_reset_complete(phydev); ret = aqr_wait_reset_complete(phydev);
if (!ret) if (!ret)
aqr107_chip_info(phydev); aqr107_chip_info(phydev);
...@@ -652,7 +653,13 @@ static int aqr107_fill_interface_modes(struct phy_device *phydev) ...@@ -652,7 +653,13 @@ static int aqr107_fill_interface_modes(struct phy_device *phydev)
unsigned long *possible = phydev->possible_interfaces; unsigned long *possible = phydev->possible_interfaces;
unsigned int serdes_mode, rate_adapt; unsigned int serdes_mode, rate_adapt;
phy_interface_t interface; 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 /* Walk the media-speed configuration registers to determine which
* host-side serdes modes may be used by the PHY depending on the * host-side serdes modes may be used by the PHY depending on the
...@@ -999,6 +1006,30 @@ static struct phy_driver aqr_driver[] = { ...@@ -999,6 +1006,30 @@ static struct phy_driver aqr_driver[] = {
.led_hw_control_get = aqr_phy_led_hw_control_get, .led_hw_control_get = aqr_phy_led_hw_control_get,
.led_polarity_set = aqr_phy_led_polarity_set, .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), PHY_ID_MATCH_MODEL(PHY_ID_AQR813),
.name = "Aquantia AQR813", .name = "Aquantia AQR813",
...@@ -1042,6 +1073,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = { ...@@ -1042,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_AQR113) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR115C) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
{ } { }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment