Devicetree
 help / color / mirror / Atom feed
From: Markus Stockhausen <markus.stockhausen@gmx.de>
To: andrew@lunn.ch, 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
Cc: Markus Stockhausen <markus.stockhausen@gmx.de>
Subject: [PATCH net-next v13 08/11] net: mdio: realtek-rtl9300: Check for C45 support during setup
Date: Fri,  7 Aug 2026 19:10:55 +0200	[thread overview]
Message-ID: <20260807171058.522833-9-markus.stockhausen@gmx.de> (raw)
In-Reply-To: <20260807171058.522833-1-markus.stockhausen@gmx.de>

The to-be-merged RTL83xx devices have only 1G ports. Thus the MDIO
bus always runs with C22 mode. For now it makes no sense to add
those devices with C45 helpers that are not used at all. Add a
consistency check in the mapping helper so that it aborts setup
if devicetree defines a C45 PHY for a device that has no such
read/write functions.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
 drivers/net/mdio/mdio-realtek-rtl9300.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c
index 88ba73b2ee81..22b1c4e05354 100644
--- a/drivers/net/mdio/mdio-realtek-rtl9300.c
+++ b/drivers/net/mdio/mdio-realtek-rtl9300.c
@@ -782,8 +782,14 @@ static int otto_emdio_map_ports(struct device *dev)
 		 * (i.e. clause 45). Select 10GPHY mode if there is at least one PHY that
 		 * declares compatible = "ethernet-phy-ieee802.3-c45".
 		 */
-		if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45"))
+		if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45")) {
+			if (!priv->info->read_c45 || !priv->info->write_c45) {
+				err = dev_err_probe(dev, -EOPNOTSUPP,
+						    "bus %d does not support C45 access\n", bus);
+				goto put_nodes;
+			}
 			priv->smi_bus_is_c45[bus] = true;
+		}
 
 		__set_bit(pn, priv->valid_ports);
 		priv->smi_bus[pn] = bus;
-- 
2.55.0


  parent reply	other threads:[~2026-08-07 17:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 17:10 [PATCH net-next v13 00/11] net: mdio: realtek-rtl9300: Add RTL83xx support Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 01/11] dt-bindings: net: realtek,rtl9301-mdio: Add RTL83xx series Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 02/11] net: mdio: realtek-rtl9300: Add polling documentation Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 03/11] net: phy: add (*notify_phy_attach/detach)() hooks to struct mii_bus Markus Stockhausen
2026-08-08 17:12   ` sashiko-bot
2026-08-07 17:10 ` [PATCH net-next v13 04/11] net: mdio: realtek-rtl9300: suppress sysfs bind/unbind attributes Markus Stockhausen
2026-08-08 17:12   ` sashiko-bot
2026-08-07 17:10 ` [PATCH net-next v13 05/11] net: mdio: realtek-rtl9300: Configure hardware polling during probing Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 06/11] net: mdio: realtek-rtl9300: Add page tracking Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 07/11] net: mdio: realtek-rtl9300: Increase MDIO timeout Markus Stockhausen
2026-08-07 17:10 ` Markus Stockhausen [this message]
2026-08-08 17:12   ` [PATCH net-next v13 08/11] net: mdio: realtek-rtl9300: Check for C45 support during setup sashiko-bot
2026-08-07 17:10 ` [PATCH net-next v13 09/11] net: mdio: realtek-rtl9300: Add support for RTL838x Markus Stockhausen
2026-08-08 17:12   ` sashiko-bot
2026-08-07 17:10 ` [PATCH net-next v13 10/11] net: mdio: realtek-rtl9300: Add support for RTL839x Markus Stockhausen
2026-08-07 17:10 ` [PATCH net-next v13 11/11] net: mdio: realtek-rtl9300: reword Kconfig and module description Markus Stockhausen

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=20260807171058.522833-9-markus.stockhausen@gmx.de \
    --to=markus.stockhausen@gmx.de \
    --cc=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=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