public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Charles Perry <charles.perry@microchip.com>
Cc: "Russell King (Oracle)" <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 3/3] net: phy: add a PHY write barrier when disabling interrupts
Date: Tue, 7 Apr 2026 18:59:00 +0200	[thread overview]
Message-ID: <b63c401b-bea9-4a2d-a43e-cd20c3013f53@lunn.ch> (raw)
In-Reply-To: <adUupYuD6tM3ahaR@bby-cbu-swbuild03.eng.microchip.com>

> static void phy_write_barrier(struct phy_device *phydev)
> {
>        int err;
>  
>        err = mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, MII_PHYSID1);
>        if (err == -EOPNOTSUPP)
>                mdiobus_c45_read(phydev->mdio.bus, phydev->mdio.addr,
>                                 __ffs(phydev->c45_ids.mmds_present),
>                                 MII_PHYSID1);
> }

Using __ffs() is maybe more complex than needed.

All you are trying to do is ensure the last write happened, by doing a
read. Any read should work, even if the device does not respond. We
just need to be careful not to read a register which might clear on
read, such as an interrupt status register, or the link status, which
latches. MII_PHYID1 is safe. Since we throw away the value, we don't
care if the MMD is not present, the read will still flush the previous
write. So i would replace the _ffs() with a hard coded value. KISS.

> Do you think there's any way I can test this on my VSC8574 or VSC8541? It
> supports some C45 registers for EEE but not the device discovery part.

It is not so easy to do. You need to hack the C22 read so that is
returns EOPNOTSUPP, but you also need the first few reads to return a
valid value otherwise the probe will fail.

I think this is one of the cases that if the reviewers thinks its
looks O.K, we can accept it without extensive testing.

      Andrew

  reply	other threads:[~2026-04-07 16:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 13:12 [PATCH net-next v4 0/3] Add support for PIC64-HPSC/HX MDIO controller Charles Perry
2026-04-02 13:12 ` [PATCH net-next v4 1/3] dt-bindings: net: document Microchip " Charles Perry
2026-04-02 13:12 ` [PATCH net-next v4 2/3] net: mdio: add a driver for " Charles Perry
2026-04-02 13:12 ` [PATCH net-next v4 3/3] net: phy: add a PHY write barrier when disabling interrupts Charles Perry
2026-04-02 13:31   ` Andrew Lunn
2026-04-02 17:51     ` Charles Perry
2026-04-02 18:03     ` Russell King (Oracle)
2026-04-02 18:09       ` Andrew Lunn
2026-04-07 16:19         ` Charles Perry
2026-04-07 16:59           ` Andrew Lunn [this message]
2026-04-07 17:59             ` Charles Perry

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=b63c401b-bea9-4a2d-a43e-cd20c3013f53@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=charles.perry@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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=pabeni@redhat.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