LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Joel Stanley <joel@jms.id.au>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Stafford Horne <shorne@gmail.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Anton Blanchard <anton@ozlabs.org>,
	Gabriel Somlo <gsomlo@gmail.com>, David Shah <dave@ds0.me>,
	Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	devicetree <devicetree@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] net: Add driver for LiteX's LiteETH network interface
Date: Mon, 9 Aug 2021 15:09:19 +0200	[thread overview]
Message-ID: <YREo/wS8iagiuYBA@lunn.ch> (raw)
In-Reply-To: <CACPK8XdOUhz8U0NqOcLRPC3=rjfVB1FFhwyJzMy2AE+7Omm_2g@mail.gmail.com>

On Mon, Aug 09, 2021 at 03:20:57AM +0000, Joel Stanley wrote:
> On Sat, 7 Aug 2021 at 19:19, Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > > +static void liteeth_reset_hw(struct liteeth *priv)
> > > +{
> > > +     /* Reset, twice */
> > > +     writeb(0, priv->base + LITEETH_PHY_CRG_RESET);
> > > +     udelay(10);
> > > +     writeb(1, priv->base + LITEETH_PHY_CRG_RESET);
> > > +     udelay(10);
> > > +     writeb(0, priv->base + LITEETH_PHY_CRG_RESET);
> > > +     udelay(10);
> >
> > What is this actually resetting?
> 
> This comes from the reference firmware that many (but not all) litex
> systems run before loading their operating system.
> 
> I'm not completely sure how necessary it still is; I will drop it for now.

Which did not answer my question. Once we know what is being reset, we
can maybe suggest when/how it should be reset.

> > > +static int liteeth_probe(struct platform_device *pdev)
> > > +{
> > > +     struct net_device *netdev;
> > > +     void __iomem *buf_base;
> > > +     struct resource *res;
> > > +     struct liteeth *priv;
> > > +     int irq, err;
> > > +
> > > +     netdev = alloc_etherdev(sizeof(*priv));
> > > +     if (!netdev)
> > > +             return -ENOMEM;
> > > +
> > > +     priv = netdev_priv(netdev);
> > > +     priv->netdev = netdev;
> > > +     priv->dev = &pdev->dev;
> > > +
> > > +     irq = platform_get_irq(pdev, 0);
> > > +     if (irq < 0) {
> > > +             dev_err(&pdev->dev, "Failed to get IRQ\n");
> > > +             goto err;
> > > +     }
> > > +
> > > +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > +     priv->base = devm_ioremap_resource(&pdev->dev, res);
> > > +     if (IS_ERR(priv->base)) {
> > > +             err = PTR_ERR(priv->base);
> > > +             goto err;
> > > +     }
> > > +
> > > +     res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> > > +     priv->mdio_base = devm_ioremap_resource(&pdev->dev, res);
> > > +     if (IS_ERR(priv->mdio_base)) {
> > > +             err = PTR_ERR(priv->mdio_base);
> > > +             goto err;
> > > +     }
> >
> > So you don't have any PHY handling, or any MDIO bus master code. So i
> > would drop this, until the MDIO architecture question is answered. I
> > also wonder how much use the MAC driver is without any PHY code?
> > Unless you have a good reason, i don't think we should merge this
> > until it makes the needed calls into phylib. It is not much code to
> > add.
> 
> You mean I should skip out the parsing of the mdio base until I'm
> using it? That's reasonable.

It could be we insist you add MDIO and PHY handling. But first we need
to understand the architecture.

   Andrew

      reply	other threads:[~2021-08-09 13:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06  5:49 [PATCH 0/2] net: Add LiteETH network driver Joel Stanley
2021-08-06  5:49 ` [PATCH 1/2] dt-bindings: net: Add bindings for LiteETH Joel Stanley
2021-08-06 17:07   ` Rob Herring
2021-08-07 19:05   ` Andrew Lunn
2021-08-09  7:59     ` Joel Stanley
2021-08-09 13:27       ` Andrew Lunn
2021-08-06  5:49 ` [PATCH 2/2] net: Add driver for LiteX's LiteETH network interface Joel Stanley
2021-08-06 11:48   ` Gabriel L. Somlo
     [not found]     ` <CA+96J6JxAkNd_QkVxfSdAJwWVLJTtSaDsCmVKw3KBfYySJytKA@mail.gmail.com>
2021-08-20  7:46       ` Joel Stanley
2021-08-06 23:10   ` Jakub Kicinski
2021-08-09 12:03     ` Joel Stanley
2021-08-09 16:16       ` Jakub Kicinski
2021-08-07 19:19   ` Andrew Lunn
2021-08-09  3:20     ` Joel Stanley
2021-08-09 13:09       ` Andrew Lunn [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=YREo/wS8iagiuYBA@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=anton@ozlabs.org \
    --cc=benh@kernel.crashing.org \
    --cc=dave@ds0.me \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gsomlo@gmail.com \
    --cc=joel@jms.id.au \
    --cc=kgugala@antmicro.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mholenko@antmicro.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=shorne@gmail.com \
    --subject='Re: [PATCH 2/2] net: Add driver for LiteX'\''s LiteETH network interface' \
    /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

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).