From fc3eda9aa25765b2115e7427ee4f6dbcd60f8721 Mon Sep 17 00:00:00 2001
From: Markus Stockhausen <markus.stockhausen@gmx.de>
Date: Mon, 15 Sep 2025 17:23:31 +0200
Subject: [PATCH] net: mdio: Add Realtek Otto SerDes controller

SoCs in Realtek's Otto platform such as the RTL83xx and RTL93xx
have multiple SerDes to drive the PHYs. Provide a mdio interface
to access their registers.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
--- a/drivers/net/mdio/Makefile
+++ b/drivers/net/mdio/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_MDIO_REALTEK_RTL9300)	+= md
 obj-$(CONFIG_MDIO_REGMAP)		+= mdio-regmap.o
 obj-$(CONFIG_MDIO_REALTEK_OTTO)	+= mdio-realtek-otto.o
 obj-$(CONFIG_MDIO_REALTEK_OTTO_AUX)	+= mdio-realtek-otto-aux.o
+obj-$(CONFIG_MDIO_REALTEK_OTTO_SERDES)	+= mdio-realtek-otto-serdes.o
 obj-$(CONFIG_MDIO_SMBUS)		+= mdio-smbus.o
 obj-$(CONFIG_MDIO_SUN4I)		+= mdio-sun4i.o
 obj-$(CONFIG_MDIO_THUNDER)		+= mdio-thunder.o
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -208,6 +208,13 @@ config MDIO_REALTEK_OTTO_AUX
 	  This driver supports the auxilairy MDIO bus on RTL838x SoCs. This bus
 	  is typically used to attach RTL8231 GPIO extenders.
 
+config MDIO_REALTEK_OTTO_SERDES
+        tristate "Realtek Otto MDIO SerDes interface support"
+        default MACH_REALTEK_RTL
+        depends on MACH_REALTEK_RTL || COMPILE_TEST
+        help
+          This driver provides MDIO access to the RTL83xx/RTL93xx SerDes.
+
 config MDIO_THUNDER
 	tristate "ThunderX SOCs MDIO buses"
 	depends on 64BIT
