[openwrt/openwrt] realtek: rtl838x: Instantiate auxiliary MDIO bus

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 22 03:57:26 PST 2025


svanheule pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/01bc33a9132237f2b395dc4331e70e198ed6146e

commit 01bc33a9132237f2b395dc4331e70e198ed6146e
Author: Sander Vanheule <sander at svanheule.net>
AuthorDate: Fri Dec 27 15:56:44 2024 +0100

    realtek: rtl838x: Instantiate auxiliary MDIO bus
    
    Add a disabled node for the auxiliary MDIO bus, used to manage the
    RTL8231 expanders. A simple-mfd parent node is added, at the same
    (implied) address as the switch at 1b000000 node, as the switch drivers
    should anyway transistion to MFD subdivices at some point.
    
    Additionally, two pinctrl-single node are added to allow the MDX pins to
    be muxed correctly, in case the bootloader leaves these unconfigured.
    
    Signed-off-by: Sander Vanheule <sander at svanheule.net>
    (cherry picked from commit 92ae8cb16c46823d5a00489b4d3a9cc724ba67a4)
---
 target/linux/realtek/dts/rtl838x.dtsi   | 56 +++++++++++++++++++++++++++++++++
 target/linux/realtek/rtl838x/config-6.6 |  2 +-
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/dts/rtl838x.dtsi b/target/linux/realtek/dts/rtl838x.dtsi
index 13ba6450b2..ab034fc1bc 100644
--- a/target/linux/realtek/dts/rtl838x.dtsi
+++ b/target/linux/realtek/dts/rtl838x.dtsi
@@ -232,6 +232,42 @@
 		};
 	};
 
+	switchcore at 1b000000 {
+		compatible = "syscon", "simple-mfd";
+		reg = <0x1b000000 0x20000>;
+
+		mdio_aux: mdio-aux {
+			compatible = "realtek,rtl8380-aux-mdio";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "disabled";
+
+			pinctrl-names = "default";
+			pinctrl-0 = <&mdio_aux_mdx>, <&aux_mode_mdio>;
+		};
+	};
+
+	pinmux at 1b000144 {
+		compatible = "pinctrl-single";
+		reg = <0x1b000144 0x4>;
+
+		pinctrl-single,bit-per-mux;
+		pinctrl-single,register-width = <32>;
+		pinctrl-single,function-mask = <0x1>;
+		#pinctrl-cells = <2>;
+
+		/* I2C mode */
+		aux_mode_i2c: i2c-pins {
+			pinctrl-single,bits = <0x0 0x0 0x1>;
+		};
+
+		/* MDIO mode */
+		aux_mode_mdio: mdx-pins {
+			pinctrl-single,bits = <0x0 0x1 0x1>;
+		};
+	};
+
 	pinmux: pinmux at 1b001000 {
 		compatible = "pinctrl-single";
 		reg = <0x1b001000 0x4>;
@@ -262,6 +298,26 @@
 		};
 	};
 
+	pinmux at 1b00a0e0 {
+		compatible = "pinctrl-single";
+		reg = <0x1b00a0e0 0x4>;
+
+		pinctrl-single,bit-per-mux;
+		pinctrl-single,register-width = <32>;
+		pinctrl-single,function-mask = <0x1>;
+		#pinctrl-cells = <2>;
+
+		/* Use SoC GPIO 2/3 as GPIO */
+		mdio_aux_gpio: gpio-pins {
+			pinctrl-single,bits = <0x0 0x0 0x1>;
+		};
+
+		/* Use SoC GPIO 2/3 as MDC/MDIO */
+		mdio_aux_mdx: mdx-pins {
+			pinctrl-single,bits = <0x0 0x1 0x1>;
+		};
+	};
+
 	ethernet0: ethernet at 1b00a300 {
 		compatible = "realtek,rtl838x-eth";
 		reg = <0x1b00a300 0x100>;
diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6
index d031965cea..020477b7bc 100644
--- a/target/linux/realtek/rtl838x/config-6.6
+++ b/target/linux/realtek/rtl838x/config-6.6
@@ -122,7 +122,7 @@ CONFIG_MDIO_BUS=y
 CONFIG_MDIO_DEVICE=y
 CONFIG_MDIO_DEVRES=y
 CONFIG_MDIO_I2C=y
-# CONFIG_MDIO_REALTEK_OTTO_AUX is not set
+CONFIG_MDIO_REALTEK_OTTO_AUX=y
 CONFIG_MDIO_SMBUS=y
 CONFIG_MEMFD_CREATE=y
 CONFIG_MFD_SYSCON=y




More information about the lede-commits mailing list