openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Tomer Maimon <tmaimon77@gmail.com>
To: Joel Stanley <joel@jms.id.au>
Cc: Avi Fishman <avifishman70@gmail.com>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	"William A. Kennington III" <wak@google.com>
Subject: Re: [[PATCH linux dev-5.10] net: npcm: Support for fixed PHYs
Date: Wed, 31 Mar 2021 19:06:21 +0300	[thread overview]
Message-ID: <CAP6Zq1jN45ZgbJW9CeuMYTBcOvtHtP+twiazLTgw2LHko8Tn1Q@mail.gmail.com> (raw)
In-Reply-To: <CACPK8XeLbxOX1-FGDqqepY4vuP=QR8tRAVvR0AoX=V-eVWWwiQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4132 bytes --]

Looks fine to me,
Reviewed-by : Tomer Maimon <tmaimon77@gmail.com>

cheers,

Tomer

On Tue, 30 Mar 2021 at 01:37, Joel Stanley <joel@jms.id.au> wrote:

> On Sat, 27 Mar 2021 at 00:49, William A. Kennington III <wak@google.com>
> wrote:
> >
> > Most of our machines don't have PHYs between the NIC and the BMC over
> > their NC-SI port. We don't want to use the kernel NC-SI machinery, but
> > we do want phyless support.
> >
> > Signed-off-by: William A. Kennington III <wak@google.com>
>
> This looks fine to me. Tomer, Avi, can I please get a review from
> someone at Nuvoton?
>
> Reviewed-by: Joel Stanley <joel@jms.id.au>
>
> It would be great to see this driver submitted upstream too!


>
> ---
> >  drivers/net/ethernet/nuvoton/npcm7xx_emc.c | 31 +++++++++++++++++++++-
> >  1 file changed, 30 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
> b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
> > index f07449e2f68d..1dc871a72180 100644
> > --- a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
> > +++ b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
> > @@ -26,6 +26,7 @@
> >  #include <linux/of.h>
> >  #include <linux/of_net.h>
> >  #include <linux/of_device.h>
> > +#include <linux/of_mdio.h>
> >  #include <linux/dma-mapping.h>
> >
> >  #include <linux/regmap.h>
> > @@ -242,6 +243,7 @@ struct  npcm7xx_ether {
> >         struct net_device *ndev;
> >         struct resource *res;
> >         unsigned int msg_enable;
> > +       struct device_node *phy_dn;
> >         struct mii_bus *mii_bus;
> >         struct phy_device *phy_dev;
> >         struct napi_struct napi;
> > @@ -1774,6 +1776,17 @@ static int npcm7xx_mii_setup(struct net_device
> *dev)
> >
> >         pdev = ether->pdev;
> >
> > +       if (ether->phy_dn) {
> > +               ether->phy_dev = of_phy_connect(dev, ether->phy_dn,
> > +                                       &adjust_link, 0, 0);
> > +               if (!ether->phy_dn) {
> > +                       dev_err(&dev->dev, "could not connect to phy
> %pOF\n",
> > +                               ether->phy_dn);
> > +                       return -ENODEV;
> > +               }
> > +               return 0;
> > +       }
> > +
> >         ether->mii_bus = mdiobus_alloc();
> >         if (!ether->mii_bus) {
> >                 err = -ENOMEM;
> > @@ -2011,6 +2024,15 @@ static int npcm7xx_ether_probe(struct
> platform_device *pdev)
> >                 }
> >         } else {
> >                 ether->use_ncsi = false;
> > +
> > +               ether->phy_dn = of_parse_phandle(np, "phy-handle", 0);
> > +               if (!ether->phy_dn && of_phy_is_fixed_link(np)) {
> > +                       error = of_phy_register_fixed_link(np);
> > +                       if (error < 0)
> > +                               goto failed_free_napi;
> > +                       ether->phy_dn = of_node_get(np);
> > +               }
> > +
> >         error = npcm7xx_mii_setup(dev);
> >         if (error < 0) {
> >                 dev_err(&pdev->dev, "npcm7xx_mii_setup err\n");
> > @@ -2032,6 +2054,9 @@ static int npcm7xx_ether_probe(struct
> platform_device *pdev)
> >         return 0;
> >
> >  failed_free_napi:
> > +       of_node_put(ether->phy_dn);
> > +       if (of_phy_is_fixed_link(np))
> > +               of_phy_deregister_fixed_link(np);
> >         netif_napi_del(&ether->napi);
> >         platform_set_drvdata(pdev, NULL);
> >  failed_free_io:
> > @@ -2048,13 +2073,17 @@ static int npcm7xx_ether_remove(struct
> platform_device *pdev)
> >  {
> >         struct net_device *dev = platform_get_drvdata(pdev);
> >         struct npcm7xx_ether *ether = netdev_priv(dev);
> > +       struct device_node *np = pdev->dev.of_node;
> >
> >  #ifdef CONFIG_DEBUG_FS
> >         debugfs_remove_recursive(ether->dbgfs_dir);
> >  #endif
> > -
> >         unregister_netdev(dev);
> >
> > +       of_node_put(ether->phy_dn);
> > +       if (of_phy_is_fixed_link(np))
> > +               of_phy_deregister_fixed_link(np);
> > +
> >         free_irq(ether->txirq, dev);
> >         free_irq(ether->rxirq, dev);
> >
> > --
> > 2.31.0.291.g576ba9dcdaf-goog
> >
>

[-- Attachment #2: Type: text/html, Size: 6119 bytes --]

      reply	other threads:[~2021-03-31 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27  0:49 [[PATCH linux dev-5.10] net: npcm: Support for fixed PHYs William A. Kennington III
2021-03-29 22:36 ` Joel Stanley
2021-03-31 16:06   ` Tomer Maimon [this message]

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=CAP6Zq1jN45ZgbJW9CeuMYTBcOvtHtP+twiazLTgw2LHko8Tn1Q@mail.gmail.com \
    --to=tmaimon77@gmail.com \
    --cc=avifishman70@gmail.com \
    --cc=joel@jms.id.au \
    --cc=openbmc@lists.ozlabs.org \
    --cc=wak@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).