[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d3486c5575724f4d12bc58c9374fa95cb59ea3e.camel@analog.com>
Date: Tue, 6 Aug 2019 06:53:24 +0000
From: "Ardelean, Alexandru" <alexandru.Ardelean@...log.com>
To: "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "f.fainelli@...il.com" <f.fainelli@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"mark.rutland@....com" <mark.rutland@....com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"andrew@...n.ch" <andrew@...n.ch>
Subject: Re: [PATCH 14/16] net: phy: adin: make sure down-speed auto-neg is
enabled
On Tue, 2019-08-06 at 07:52 +0200, Heiner Kallweit wrote:
> [External]
>
> On 05.08.2019 18:54, Alexandru Ardelean wrote:
> > Down-speed auto-negotiation may not always be enabled, in which case the
> > PHY won't down-shift to 100 or 10 during auto-negotiation.
> >
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> > ---
> > drivers/net/phy/adin.c | 27 +++++++++++++++++++++++++++
> > 1 file changed, 27 insertions(+)
> >
> > diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
> > index 86848444bd98..a1f3456a8504 100644
> > --- a/drivers/net/phy/adin.c
> > +++ b/drivers/net/phy/adin.c
> > @@ -32,6 +32,13 @@
> > #define ADIN1300_NRG_PD_TX_EN BIT(2)
> > #define ADIN1300_NRG_PD_STATUS BIT(1)
> >
> > +#define ADIN1300_PHY_CTRL2 0x0016
> > +#define ADIN1300_DOWNSPEED_AN_100_EN BIT(11)
> > +#define ADIN1300_DOWNSPEED_AN_10_EN BIT(10)
> > +#define ADIN1300_GROUP_MDIO_EN BIT(6)
> > +#define ADIN1300_DOWNSPEEDS_EN \
> > + (ADIN1300_DOWNSPEED_AN_100_EN | ADIN1300_DOWNSPEED_AN_10_EN)
> > +
> > #define ADIN1300_INT_MASK_REG 0x0018
> > #define ADIN1300_INT_MDIO_SYNC_EN BIT(9)
> > #define ADIN1300_INT_ANEG_STAT_CHNG_EN BIT(8)
> > @@ -425,6 +432,22 @@ static int adin_config_mdix(struct phy_device *phydev)
> > return phy_write(phydev, ADIN1300_PHY_CTRL1, reg);
> > }
> >
> > +static int adin_config_downspeeds(struct phy_device *phydev)
> > +{
> > + int reg;
> > +
> > + reg = phy_read(phydev, ADIN1300_PHY_CTRL2);
> > + if (reg < 0)
> > + return reg;
> > +
> > + if ((reg & ADIN1300_DOWNSPEEDS_EN) == ADIN1300_DOWNSPEEDS_EN)
> > + return 0;
> > +
> > + reg |= ADIN1300_DOWNSPEEDS_EN;
> > +
> > + return phy_write(phydev, ADIN1300_PHY_CTRL2, reg);
>
> Using phy_set_bits() would be easier.
ack;
missed this;
thanks
>
> > +}
> > +
> > static int adin_config_aneg(struct phy_device *phydev)
> > {
> > int ret;
> > @@ -433,6 +456,10 @@ static int adin_config_aneg(struct phy_device *phydev)
> > if (ret)
> > return ret;
> >
> > + ret = adin_config_downspeeds(phydev);
> > + if (ret < 0)
> > + return ret;
> > +
> > return genphy_config_aneg(phydev);
> > }
> >
> >
Powered by blists - more mailing lists