[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANr-f5xp7DG9idmg-Mn+Tj6+a+pxrajVw-h8Tm4O6NAjB1AJYw@mail.gmail.com>
Date: Tue, 27 Jul 2021 22:18:07 +0200
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>, devicetree@...r.kernel.org
Subject: Re: [PATCH net-next 4/5] tsnep: Add TSN endpoint Ethernet MAC driver
On Mon, Jul 26, 2021 at 10:50 PM Andrew Lunn <andrew@...n.ch> wrote:
> Hi Gerhard
Hi Andrew
> > +int tsnep_read_md(struct tsnep_adapter *adapter, int phy, int reg, u16 *data)
> > +{
> > + u32 md;
> > + int retval = 0;
> > +
> > + if (mutex_lock_interruptible(&adapter->md_lock) != 0)
> > + return -ERESTARTSYS;
>
> This probably means you have something wrong with your architecture.
> The core mdio layer will serialise access to the mdio bus. So you
> should not need such locks.
>
> > +int tsnep_enable_loopback(struct tsnep_adapter *adapter, int speed)
> > +{
> > + int phy_address = adapter->phydev->mdio.addr;
> > + u16 val;
> > + int retval;
> > +
> > + adapter->loopback = true;
> > + adapter->loopback_speed = speed;
> > +
> > + retval = tsnep_read_md(adapter, phy_address, MII_BMCR, &val);
>
> And this might be why you have these locks?
>
> A MAC driver should never directly touch the PHY hardware. Use the
> phy_loopback(phydev) call.
I will try to use phy_loopback(phydev) . Thanks for the advice!
Gerhard
Powered by blists - more mailing lists