diff mbox series

[v2,1/4] micrel: fix config_aneg for ksz886x

Message ID 20191218200831.13796-2-m.grzeschik@pengutronix.de
State Not Applicable
Delegated to: David Miller
Headers show
Series microchip: add support for ksz88x3 driver family | expand

Commit Message

Michael Grzeschik Dec. 18, 2019, 8:08 p.m. UTC
The third port of the ksz886x is fixed to be connected to the
cpu. This port has no possibility to do auto negotiation.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/net/phy/micrel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Florian Fainelli Dec. 18, 2019, 8:11 p.m. UTC | #1
On 12/18/19 12:08 PM, Michael Grzeschik wrote:
> The third port of the ksz886x is fixed to be connected to the
> cpu. This port has no possibility to do auto negotiation.

Then this may not the PHY driver you would want to use, but rather use a
fixed-link which would use the Generic PHY driver and take care of
setting the appropriate speed/duplex/pause settings the way you defined
them in Device Tree.

> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/net/phy/micrel.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 63dedec0433de..913a8b68da350 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -841,6 +841,16 @@ static int ksz8873mll_config_aneg(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +static int ksz886x_config_aneg(struct phy_device *phydev)
> +{
> +	if (phydev->mdio.addr == 3) {
> +		phydev->autoneg = AUTONEG_DISABLE;
> +		genphy_read_status(phydev);
> +	}
> +
> +	return genphy_config_aneg(phydev);
> +}
> +
>  static int kszphy_get_sset_count(struct phy_device *phydev)
>  {
>  	return ARRAY_SIZE(kszphy_hw_stats);
> @@ -1171,6 +1181,7 @@ static struct phy_driver ksphy_driver[] = {
>  	.name		= "Micrel KSZ886X Switch",
>  	/* PHY_BASIC_FEATURES */
>  	.config_init	= kszphy_config_init,
> +	.config_aneg	= ksz886x_config_aneg,
>  	.suspend	= genphy_suspend,
>  	.resume		= genphy_resume,
>  }, {
>
diff mbox series

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 63dedec0433de..913a8b68da350 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -841,6 +841,16 @@  static int ksz8873mll_config_aneg(struct phy_device *phydev)
 	return 0;
 }
 
+static int ksz886x_config_aneg(struct phy_device *phydev)
+{
+	if (phydev->mdio.addr == 3) {
+		phydev->autoneg = AUTONEG_DISABLE;
+		genphy_read_status(phydev);
+	}
+
+	return genphy_config_aneg(phydev);
+}
+
 static int kszphy_get_sset_count(struct phy_device *phydev)
 {
 	return ARRAY_SIZE(kszphy_hw_stats);
@@ -1171,6 +1181,7 @@  static struct phy_driver ksphy_driver[] = {
 	.name		= "Micrel KSZ886X Switch",
 	/* PHY_BASIC_FEATURES */
 	.config_init	= kszphy_config_init,
+	.config_aneg	= ksz886x_config_aneg,
 	.suspend	= genphy_suspend,
 	.resume		= genphy_resume,
 }, {