From: Raag Jadav <raagjadav@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Steen Hegelund <steen.hegelund@microchip.com>,
Bjarni Jonasson <bjarni.jonasson@microchip.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation
Date: Sun, 27 Mar 2022 14:02:29 +0530 [thread overview]
Message-ID: <20220327083229.GB3254@localhost> (raw)
In-Reply-To: <YhpV/Q8Pnv+OZ3Fr@shell.armlinux.org.uk>
On Sat, Feb 26, 2022 at 04:31:57PM +0000, Russell King (Oracle) wrote:
> On Sat, Feb 26, 2022 at 12:53:27PM +0530, Raag Jadav wrote:
> > On Thu, Feb 24, 2022 at 10:48:57AM +0000, Russell King (Oracle) wrote:
> > > Sorry for the late comment on this patch.
> > >
> > > On Sat, Feb 05, 2022 at 12:14:52PM +0530, Raag Jadav wrote:
> > > > +static int vsc85xx_config_inband_aneg(struct phy_device *phydev, bool enabled)
> > > > +{
> > > > + int rc;
> > > > + u16 reg_val = 0;
> > > > +
> > > > + if (enabled)
> > > > + reg_val = MSCC_PHY_SERDES_ANEG;
> > > > +
> > > > + mutex_lock(&phydev->lock);
> > > > +
> > > > + rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_3,
> > > > + MSCC_PHY_SERDES_PCS_CTRL, MSCC_PHY_SERDES_ANEG,
> > > > + reg_val);
> > > > +
> > > > + mutex_unlock(&phydev->lock);
> > >
> > > What is the reason for the locking here?
> > >
> > > phy_modify_paged() itself is safe due to the MDIO bus lock, so you
> > > shouldn't need locking around it.
> > >
> >
> > True.
> >
> > My initial thought was to have serialized access at PHY level,
> > as we have multiple ports to work with.
> > But I guess MDIO bus lock could do the job as well.
>
> The MDIO bus lock is the only lock that will guarantee that no other
> users can nip onto the bus and possibly access your PHY in the middle
> of an operation that requires more than one access to complete. Adding
> local locking at PHY driver level does not give you those guarantees.
> This is exactly why phy_modify() etc was added - because phy_read()..
> phy_write() does not give that guarantee.
>
> As an example of something that could interfere - the userspace MII
> ioctls.
>
> > I've gone through Vladimir's patches and they look more promising
> > than this approach.
> > Let me know if I could be of any help.
>
> I haven't seen them - so up to you.
>
Definitely worth a look.
> Thanks.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2022-03-27 8:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-05 6:44 [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation Raag Jadav
2022-02-05 14:57 ` Andrew Lunn
2022-02-06 17:12 ` Raag Jadav
2022-02-06 17:18 ` Russell King (Oracle)
2022-02-06 18:01 ` Andrew Lunn
2022-02-07 17:49 ` Raag Jadav
2022-02-08 2:09 ` Andrew Lunn
2022-02-08 15:57 ` Raag Jadav
2022-02-08 16:01 ` Russell King (Oracle)
2022-02-08 19:12 ` Andrew Lunn
2022-02-10 16:48 ` Raag Jadav
2022-02-08 9:45 ` Russell King (Oracle)
2022-02-08 15:53 ` Raag Jadav
2022-02-24 10:41 ` Siddharth Narayan Vadapalli
2022-02-24 10:48 ` Russell King (Oracle)
2022-02-26 7:23 ` Raag Jadav
2022-02-26 16:31 ` Russell King (Oracle)
2022-03-27 8:32 ` Raag Jadav [this message]
2022-03-24 10:06 ` Siddharth Vadapalli
2022-03-27 8:30 ` Raag Jadav
2022-03-28 8:13 ` Siddharth Vadapalli
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=20220327083229.GB3254@localhost \
--to=raagjadav@gmail.com \
--cc=andrew@lunn.ch \
--cc=bjarni.jonasson@microchip.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=steen.hegelund@microchip.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