Reuse the at803x phy driver get_features excepting
adding 2500M capability.
Signed-off-by: Luo Jie <[email protected]>
---
drivers/net/phy/at803x.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 42d3f8ccca94..0c22ef735230 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -719,6 +719,15 @@ static int at803x_get_features(struct phy_device *phydev)
if (err)
return err;
+ if (phydev->drv->phy_id == QCA8081_PHY_ID) {
+ err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE);
+ if (err < 0)
+ return err;
+
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported,
+ err & MDIO_PMA_NG_EXTABLE_2_5GBT);
+ }
+
if (phydev->drv->phy_id != ATH8031_PHY_ID)
return 0;
@@ -1493,6 +1502,7 @@ static struct phy_driver at803x_driver[] = {
.set_tunable = at803x_set_tunable,
.set_wol = at803x_set_wol,
.get_wol = at803x_get_wol,
+ .get_features = at803x_get_features,
.suspend = genphy_suspend,
.resume = genphy_resume,
.read_status = qca808x_read_status,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
On Mon, Oct 18, 2021 at 11:33:27AM +0800, Luo Jie wrote:
> Reuse the at803x phy driver get_features excepting
> adding 2500M capability.
>
> Signed-off-by: Luo Jie <[email protected]>
> ---
> drivers/net/phy/at803x.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 42d3f8ccca94..0c22ef735230 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -719,6 +719,15 @@ static int at803x_get_features(struct phy_device *phydev)
> if (err)
> return err;
>
> + if (phydev->drv->phy_id == QCA8081_PHY_ID) {
> + err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE);
> + if (err < 0)
> + return err;
> +
> + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported,
> + err & MDIO_PMA_NG_EXTABLE_2_5GBT);
> + }
genphy_c45_pma_read_abilities()?
Andrew
On 10/19/2021 5:44 AM, Andrew Lunn wrote:
> On Mon, Oct 18, 2021 at 11:33:27AM +0800, Luo Jie wrote:
>> Reuse the at803x phy driver get_features excepting
>> adding 2500M capability.
>>
>> Signed-off-by: Luo Jie<[email protected]>
>> ---
>> drivers/net/phy/at803x.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
>> index 42d3f8ccca94..0c22ef735230 100644
>> --- a/drivers/net/phy/at803x.c
>> +++ b/drivers/net/phy/at803x.c
>> @@ -719,6 +719,15 @@ static int at803x_get_features(struct phy_device *phydev)
>> if (err)
>> return err;
>>
>> + if (phydev->drv->phy_id == QCA8081_PHY_ID) {
>> + err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE);
>> + if (err < 0)
>> + return err;
>> +
>> + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported,
>> + err & MDIO_PMA_NG_EXTABLE_2_5GBT);
>> + }
> genphy_c45_pma_read_abilities()?
>
> Andrew
Hi Andrew,
Thanks for this comment, if we use genphy_c45_pma_read_abilities here,
the ETHTOOL_LINK_MODE_Autoneg_BIT
will be lost, since MDIO_MMD_AN.MDIO_STAT1 does not have bit
MDIO_AN_STAT1_ABLE.
On Wed, Oct 20, 2021 at 02:39:57PM +0800, Jie Luo wrote:
>
> On 10/19/2021 5:44 AM, Andrew Lunn wrote:
> > On Mon, Oct 18, 2021 at 11:33:27AM +0800, Luo Jie wrote:
> > > Reuse the at803x phy driver get_features excepting
> > > adding 2500M capability.
> > >
> > > Signed-off-by: Luo Jie<[email protected]>
> > > ---
> > > drivers/net/phy/at803x.c | 10 ++++++++++
> > > 1 file changed, 10 insertions(+)
> > >
> > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> > > index 42d3f8ccca94..0c22ef735230 100644
> > > --- a/drivers/net/phy/at803x.c
> > > +++ b/drivers/net/phy/at803x.c
> > > @@ -719,6 +719,15 @@ static int at803x_get_features(struct phy_device *phydev)
> > > if (err)
> > > return err;
> > > + if (phydev->drv->phy_id == QCA8081_PHY_ID) {
> > > + err = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE);
> > > + if (err < 0)
> > > + return err;
> > > +
> > > + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported,
> > > + err & MDIO_PMA_NG_EXTABLE_2_5GBT);
> > > + }
> > genphy_c45_pma_read_abilities()?
> >
> > Andrew
>
> Hi Andrew,
>
> Thanks for this comment, if we use genphy_c45_pma_read_abilities here, the
> ETHTOOL_LINK_MODE_Autoneg_BIT
>
> will be lost, since MDIO_MMD_AN.MDIO_STAT1 does not have bit
> MDIO_AN_STAT1_ABLE.
Yes, if your PHY breaks the standard, the helpers are not much use,
that assume standard compliment PHYs.
Andrew