All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Divya.Koppera@microchip.com>
To: <michael@walle.cc>
Cc: <UNGLinuxDriver@microchip.com>, <andrew@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>,
	<hkallweit1@gmail.com>, <kuba@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux@armlinux.org.uk>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: RE: [PATCH net-next] net: phy: micrel: Adding SQI support for lan8814 phy
Date: Fri, 26 Aug 2022 09:11:21 +0000	[thread overview]
Message-ID: <CO1PR11MB477162C762EF35B0E115B952E2759@CO1PR11MB4771.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220826084249.1031557-1-michael@walle.cc>

Hi Michael,

> -----Original Message-----
> From: Michael Walle <michael@walle.cc>
> Sent: Friday, August 26, 2022 2:13 PM
> To: Divya Koppera - I30481 <Divya.Koppera@microchip.com>
> Cc: UNGLinuxDriver <UNGLinuxDriver@microchip.com>; andrew@lunn.ch;
> davem@davemloft.net; edumazet@google.com; hkallweit1@gmail.com;
> kuba@kernel.org; linux-kernel@vger.kernel.org; linux@armlinux.org.uk;
> netdev@vger.kernel.org; pabeni@redhat.com; Michael Walle
> <michael@walle.cc>
> Subject: Re: [PATCH net-next] net: phy: micrel: Adding SQI support for
> lan8814 phy
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> Hi,
> 
> > Supports SQI(Signal Quality Index) for lan8814 phy, where it has SQI
> > index of 0-7 values and this indicator can be used for cable integrity
> > diagnostic and investigating other noise sources.
> >
> > Signed-off-by: Divya Koppera <Divya.Koppera@microchip.com>
> > ---
> >  drivers/net/phy/micrel.c | 35 +++++++++++++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> >
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index
> > e78d0bf69bc3..3775da7afc64 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -1975,6 +1975,13 @@ static int ksz886x_cable_test_get_status(struct
> phy_device *phydev,
> >  #define LAN8814_CLOCK_MANAGEMENT                     0xd
> >  #define LAN8814_LINK_QUALITY                         0x8e
> >
> > +#define LAN8814_DCQ_CTRL                             0xe6
> > +#define LAN8814_DCQ_CTRL_READ_CAPTURE_                       BIT(15)
> 
> Why does it end with an underscore?
> 

All LAN8814 Macros that carries bit numbers are ending with _ in this driver. So following same.

> > +#define LAN8814_DCQ_CTRL_CHANNEL_MASK                        GENMASK(1,
> 0)
> > +#define LAN8814_DCQ_SQI                                      0xe4
> > +#define LAN8814_DCQ_SQI_MAX                          7
> > +#define LAN8814_DCQ_SQI_VAL_MASK                     GENMASK(3, 1)
> > +
> >  static int lanphy_read_page_reg(struct phy_device *phydev, int page,
> > u32 addr)  {
> >       int data;
> > @@ -2927,6 +2934,32 @@ static int lan8814_probe(struct phy_device
> *phydev)
> >       return 0;
> >  }
> >
> > +static int lan8814_get_sqi(struct phy_device *phydev) {
> > +     int rc, val;
> > +
> > +     val = lanphy_read_page_reg(phydev, 1, LAN8814_DCQ_CTRL);
> > +     if (val < 0)
> > +             return val;
> > +
> > +     val &= ~LAN8814_DCQ_CTRL_CHANNEL_MASK;
> 
> I do have a datasheet for this PHY, but it doesn't mention 0xe6 on EP1.

This register values are present in GPHY hard macro as below

4.2.225	DCQ Control Register
Index (In Decimal):	EP 1.230	Size:	16 bits

Can you give me the name of the datasheet which you are following, so that I'll check and let you know the reason.

> So I can only guess that this "channel mask" is for the 4 rx/tx pairs on GbE?

Yes channel mask is for wire pair.

> And you only seem to evaluate one of them. Is that the correct thing to do
> here?
> 

I found in below link is that, get_SQI returns sqi value for 100 base-t1 phy's
https://lore.kernel.org/netdev/20200519075200.24631-2-o.rempel@pengutronix.de/T/

In lan8814 phy only channel 0 is used for 100base-tx. So returning SQI value for channel 0.

> -michael
> 
> 
> > +     val |= LAN8814_DCQ_CTRL_READ_CAPTURE_;
> > +     rc = lanphy_write_page_reg(phydev, 1, LAN8814_DCQ_CTRL, val);
> > +     if (rc < 0)
> > +             return rc;
> > +
> > +     rc = lanphy_read_page_reg(phydev, 1, LAN8814_DCQ_SQI);
> > +     if (rc < 0)
> > +             return rc;
> > +
> > +     return FIELD_GET(LAN8814_DCQ_SQI_VAL_MASK, rc); }

  reply	other threads:[~2022-08-26  9:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25  8:05 [PATCH net-next] net: phy: micrel: Adding SQI support for lan8814 phy Divya Koppera
2022-08-25 13:19 ` Andrew Lunn
2022-08-26  3:46   ` Divya.Koppera
2022-08-25 21:53 ` Andrew Lunn
2022-08-26  3:50   ` Divya.Koppera
2022-08-26 19:42     ` Andrew Lunn
2022-08-29  5:23       ` Divya.Koppera
2022-08-26  8:42 ` Michael Walle
2022-08-26  9:11   ` Divya.Koppera [this message]
2022-08-26  9:26     ` Michael Walle
2022-08-26  9:54       ` Oleksij Rempel
2022-08-26 10:43         ` Oleksij Rempel
2022-08-26 19:51         ` Andrew Lunn
2022-08-29  5:50       ` Divya.Koppera
2022-08-29 12:30         ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB477162C762EF35B0E115B952E2759@CO1PR11MB4771.namprd11.prod.outlook.com \
    --to=divya.koppera@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.