All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liang Xu <lxu@maxlinear.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"vee.khee.wong@linux.intel.com" <vee.khee.wong@linux.intel.com>
Cc: "linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	Hauke Mehrtens <hmehrtens@maxlinear.com>,
	Thomas Mohren <tmohren@maxlinear.com>
Subject: Re: [PATCH v3] net: phy: add Maxlinear GPY115/21x/24x driver
Date: Fri, 4 Jun 2021 18:24:47 +0000	[thread overview]
Message-ID: <7834258b-5826-1c00-2754-b0b7e76b5910@maxlinear.com> (raw)
In-Reply-To: <f56aa414-3002-ef85-51a9-bb36017270e6@gmail.com>

On 5/6/2021 12:24 am, Florian Fainelli wrote:
>
> > +/* PHY ID */
> > +#define PHY_ID_GPY 0x67C9DC00
> > +#define PHY_ID_MASK GENMASK(31, 4)
>
> Consider initializing your phy_driver with PHY_ID_MATCH_MODEL() which
> would take care of populating the mask accordingly.
>
Thanks, I will update.
> > +
> > +static int gpy_read_abilities(struct phy_device *phydev)
> > +{
> > + int ret;
> > +
> > + ret = genphy_read_abilities(phydev);
> > + if (ret < 0)
> > + return ret;
> > +
> > + /* Detect 2.5G/5G support. */
> > + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_STAT2);
> > + if (ret < 0)
> > + return ret;
> > + if (!(ret & MDIO_PMA_STAT2_EXTABLE))
> > + return 0;
> > +
> > + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_EXTABLE);
> > + if (ret < 0)
> > + return ret;
> > + if (!(ret & MDIO_PMA_EXTABLE_NBT))
> > + return 0;
> > +
> > + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_NG_EXTABLE);
> > + if (ret < 0)
> > + return ret;
> > +
> > + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> > + phydev->supported,
> > + ret & MDIO_PMA_NG_EXTABLE_2_5GBT);
> > +
> > + linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
> > + phydev->supported,
> > + ret & MDIO_PMA_NG_EXTABLE_5GBT);
>
> This does not access vendor specific registers, should not this be part
> of the standard genphy_read_abilities() or moved to a helper?
>
genphy_read_abilities does not cover 2.5G.

genphy_c45_pma_read_abilities checks C45 ids and this check fail if 
is_c45 is not set.

Mix of C22 and C45 is handled here, as our device support C22 with 
extension of C45.

> > +
> > + return 0;
> > +}
> > +
> > +static int gpy_config_init(struct phy_device *phydev)
> > +{
> > + int ret;
> > +
> > + /* Mask all interrupts */
> > + ret = phy_write(phydev, PHY_IMASK, 0);
> > + if (ret)
> > + return ret;
> > +
> > + /* Clear all pending interrupts */
> > + ret = phy_read(phydev, PHY_ISTAT);
> > + return ret < 0 ? ret : 0;
>
> You can certainly simplify this to:
>
> return phy_read(phydev, PHY_ISTAT);
>
I'm thinking to clearly differentiate negative, 0, and positive.

I had experience that a positive value is treated as error sometimes.


> [snip]
>
> > +
> > +MODULE_DESCRIPTION("Maxlinear Ethernet GPY Driver");
> > +MODULE_AUTHOR("Maxlinear Corporation");
>
> The author is not usually a company but an individual working on behalf
> of that company.
> -- 
> Florian

Ok, I will update.


  reply	other threads:[~2021-06-04 18:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 16:12 [PATCH v3] net: phy: add Maxlinear GPY115/21x/24x driver Xu Liang
2021-06-04 16:24 ` Florian Fainelli
2021-06-04 18:24   ` Liang Xu [this message]
2021-06-04 20:10     ` Andrew Lunn
2021-06-05  3:35       ` Liang Xu
2021-06-05 14:51         ` Andrew Lunn
2021-06-07  4:06           ` Liang Xu
2021-06-18  9:17             ` Liang Xu
2021-06-18 14:01               ` Andrew Lunn
2021-06-18 15:36                 ` Liang Xu
2021-06-21  2:30                   ` Andrew Lunn
2021-06-21  5:05                     ` Liang Xu
2021-06-21 12:48                       ` Andrew Lunn
2021-06-21 13:07                         ` Liang Xu
2021-06-04 18:37   ` Liang Xu
2021-06-04 19:44 ` Martin Blumenstingl
2021-06-05  3:32   ` Liang Xu
2021-06-05 17:24     ` Andrew Lunn
2021-06-07  4:37       ` Liang Xu
2021-06-07 20:28         ` Martin Blumenstingl
     [not found]           ` <MWHPR19MB0077D01E4EAFA9FE521D83ECBD0D9@MWHPR19MB0077.namprd19.prod.outlook.com>
     [not found]             ` <766ab274-25ff-c9a2-1ed6-fe2aa44b4660@maxlinear.com>
2021-06-23 21:09               ` Martin Blumenstingl
2021-06-24  1:06                 ` Andrew Lunn
2021-06-22  4:21 Ismail, Mohammad Athari
2021-06-22 13:16 ` 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=7834258b-5826-1c00-2754-b0b7e76b5910@maxlinear.com \
    --to=lxu@maxlinear.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=hmehrtens@maxlinear.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=tmohren@maxlinear.com \
    --cc=vee.khee.wong@linux.intel.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.