From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/7] net: korina: Fix MDIO functions
Date: Wed, 14 Apr 2021 22:36:56 +0200 [thread overview]
Message-ID: <20210414203656.GA3382@alpha.franken.de> (raw)
In-Reply-To: <YHdEJGhQlAVkSwWW@lunn.ch>
On Wed, Apr 14, 2021 at 09:36:04PM +0200, Andrew Lunn wrote:
> > +static int korina_mdio_wait(struct korina_private *lp)
> > +{
> > + int timeout = 1000;
> > +
> > + while ((readl(&lp->eth_regs->miimind) & 1) && timeout-- > 0)
> > + udelay(1);
> > +
> > + if (timeout <= 0)
> > + return -1;
> > +
> > + return 0;
>
> Using readl_poll_timeout_atomic() would be better.
I'll have a look
>
>
> > +}
> > +
> > +static int korina_mdio_read(struct net_device *dev, int phy, int reg)
> > {
> > struct korina_private *lp = netdev_priv(dev);
> > int ret;
> >
> > - mii_id = ((lp->rx_irq == 0x2c ? 1 : 0) << 8);
> > + if (korina_mdio_wait(lp))
> > + return -1;
>
> This should really be -ETIMEDOUT
ok.
> > dev->watchdog_timeo = TX_TIMEOUT;
> > netif_napi_add(dev, &lp->napi, korina_poll, NAPI_POLL_WEIGHT);
> >
> > - lp->phy_addr = (((lp->rx_irq == 0x2c? 1:0) << 8) | 0x05);
> > lp->mii_if.dev = dev;
> > - lp->mii_if.mdio_read = mdio_read;
> > - lp->mii_if.mdio_write = mdio_write;
> > - lp->mii_if.phy_id = lp->phy_addr;
> > + lp->mii_if.mdio_read = korina_mdio_read;
> > + lp->mii_if.mdio_write = korina_mdio_write;
> > + lp->mii_if.phy_id = 1;
> > lp->mii_if.phy_id_mask = 0x1f;
> > lp->mii_if.reg_num_mask = 0x1f;
>
> You could also replace all the mii code with phylib.
that's on my todo.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2021-04-14 20:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 20:48 [PATCH net-next 0/7] net: Korina improvements Thomas Bogendoerfer
2021-04-13 20:48 ` [PATCH net-next 1/7] net: korina: Fix MDIO functions Thomas Bogendoerfer
2021-04-14 19:36 ` Andrew Lunn
2021-04-14 20:36 ` Thomas Bogendoerfer [this message]
2021-04-13 20:48 ` [PATCH net-next 2/7] net: korina: Use devres functions Thomas Bogendoerfer
2021-04-14 19:38 ` Andrew Lunn
2021-04-13 20:48 ` [PATCH net-next 3/7] net: korina: Remove not needed cache flushes Thomas Bogendoerfer
2021-04-13 20:48 ` [PATCH net-next 4/7] net: korina: Remove nested helpers Thomas Bogendoerfer
2021-04-13 20:48 ` [PATCH net-next 5/7] net: korina: Use DMA API Thomas Bogendoerfer
2021-04-13 20:48 ` [PATCH net-next 6/7] net: korina: Only pass mac address via platform data Thomas Bogendoerfer
2021-04-13 20:48 ` [PATCH net-next 7/7] net: korina: Make driver COMPILE_TESTable Thomas Bogendoerfer
2021-04-14 2:06 ` kernel test robot
2021-04-14 2:37 ` kernel test robot
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=20210414203656.GA3382@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).