From: Andrew Lunn <andrew@lunn.ch>
To: Markus Stockhausen <markus.stockhausen@gmx.de>
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, chris.packham@alliedtelesis.co.nz,
daniel@makrotopia.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v14 10/13] net: mdio: realtek-rtl9300: Open up C22 and C45 space in parallel
Date: Mon, 17 Aug 2026 19:03:50 +0200 [thread overview]
Message-ID: <cf8bdf97-64f9-4120-bdeb-c5a91a274490@lunn.ch> (raw)
In-Reply-To: <20260817162632.1208891-11-markus.stockhausen@gmx.de>
On Mon, Aug 17, 2026 at 06:26:29PM +0200, Markus Stockhausen wrote:
> Until now the MDIO driver supports either access to the C22 or to
> the C45 address space of the PHYs. This is due to the fact that
> the polling configuration favours one of the address spaces and
> limits access to the other space. E.g. when polling is set to
> C22 most of the C45 space can not be accessed.
>
> There are however some exceptions from that. EEE register access
> is allowed independently from the polling mode [1]. As the
> downstream driver already allows parallel C22/C45 access [2] do
> this in upstream too.
Is this enough to actually use C45?
int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
{
if (regnum > (u16)~0 || devad > 32)
return -EINVAL;
if (phydev->drv && phydev->drv->read_mmd)
return phydev->drv->read_mmd(phydev, devad, regnum);
return mmd_phy_read(phydev->mdio.bus, phydev->mdio.addr,
phydev->is_c45, devad, regnum);
}
EXPORT_SYMBOL(__phy_read_mmd);
int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45,
int devad, u32 regnum)
{
if (is_c45)
return __mdiobus_c45_read(bus, phy_addr, devad, regnum);
mmd_phy_indirect(bus, phy_addr, devad, regnum);
/* Read the content of the MMD's selected register */
return __mdiobus_read(bus, phy_addr, MII_MMD_DATA);
}
Is phydev->is_c45 true?
Some of the automotive PHYs have the same issue. Look at
commit aa63217916e1818a28b711384a9340d965ad073f
Author: Ciprian Regus <ciprian.regus@analog.com>
Date: Wed Jul 8 01:33:38 2026 +0300
net: phy: add generic helpers for direct C45 MMD access
Some PHYs support direct C45 register access but not C22 indirect MMD
access (registers 0xD and 0xE). When discovered via C22, phylib routes
MMD access through the indirect path, which won't work on these
devices.
Add genphy_read_mmd_c45() and genphy_write_mmd_c45() as read_mmd/
write_mmd callbacks that bypass the C22 indirect path and use the bus
C45 accessors directly.
And I really think you need to block C45 over C22, since we know it
will go horribly wrong.
Andrew
next prev parent reply other threads:[~2026-08-17 17:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 16:26 [PATCH net-next v14 00/13] net: mdio: realtek-rtl9300: Add RTL83xx support Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 01/13] dt-bindings: net: realtek,rtl9301-mdio: Add RTL83xx series Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 02/13] net: mdio: realtek-rtl9300: Add polling documentation Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 03/13] net: mdio: realtek-rtl9300: deny C45 over C22 access Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 04/13] net: phy: add phy_detach_internal() helper Markus Stockhausen
2026-08-17 16:41 ` Andrew Lunn
2026-08-17 16:26 ` [PATCH net-next v14 05/13] net: phy: add (*notify_phy_attach/detach)() hooks to struct mii_bus Markus Stockhausen
2026-08-17 16:46 ` Andrew Lunn
2026-08-17 16:26 ` [PATCH net-next v14 06/13] net: mdio: realtek-rtl9300: suppress sysfs bind/unbind attributes Markus Stockhausen
2026-08-17 16:47 ` Andrew Lunn
2026-08-17 16:26 ` [PATCH net-next v14 07/13] net: mdio: realtek-rtl9300: Configure hardware polling during probing Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 08/13] net: mdio: realtek-rtl9300: Add page tracking Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 09/13] net: mdio: realtek-rtl9300: Increase MDIO timeout Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 10/13] net: mdio: realtek-rtl9300: Open up C22 and C45 space in parallel Markus Stockhausen
2026-08-17 17:03 ` Andrew Lunn [this message]
2026-08-17 17:29 ` AW: " Markus Stockhausen
2026-08-17 19:35 ` Andrew Lunn
2026-08-17 20:05 ` AW: " Markus Stockhausen
2026-08-17 20:10 ` Andrew Lunn
2026-08-17 16:26 ` [PATCH net-next v14 11/13] net: mdio: realtek-rtl9300: Add support for RTL838x Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 12/13] net: mdio: realtek-rtl9300: Add support for RTL839x Markus Stockhausen
2026-08-17 16:26 ` [PATCH net-next v14 13/13] net: mdio: realtek-rtl9300: reword Kconfig and module description Markus Stockhausen
2026-08-17 17:25 ` [PATCH net-next v14 00/13] net: mdio: realtek-rtl9300: Add RTL83xx support Jakub Kicinski
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=cf8bdf97-64f9-4120-bdeb-c5a91a274490@lunn.ch \
--to=andrew@lunn.ch \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=markus.stockhausen@gmx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@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