realtek: Add virtual MDIO bus on rtl838x
authorSander Vanheule <sander@svanheule.net>
Tue, 21 Jan 2025 18:40:11 +0000 (19:40 +0100)
committerSander Vanheule <sander@svanheule.net>
Sat, 25 Jan 2025 14:06:03 +0000 (15:06 +0100)
Some RTL8380M-based devices have been around for a long time and use an
early A revision of the RTL8380M SoC. This revision has an issue with
the auxiliary MDIO controller, causing it to malfunction. This may lead
to device reboots when the controller is used.

Provide a bit-banged MDIO bus, which muxes the auxiliary MDIO pins to
their GPIO function. Although this will result in lower performance,
there should otherwise be no functional differences.

Link: https://github.com/openwrt/openwrt/issues/9534
Signed-off-by: Sander Vanheule <sander@svanheule.net>
target/linux/realtek/dts/rtl838x.dtsi

index ab034fc1bcfc2c380ed6f34a40a356c37941adb0..18da4c9380046155afb51843c777a76e86f37e8c 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
 #include <dt-bindings/clock/rtl83xx-clk.h>
+#include <dt-bindings/gpio/gpio.h>
 
 /dts-v1/;
 
        aliases {
                serial0 = &uart0;
                serial1 = &uart1;
+               mdio-gpio1 = &mdio_gpio;
        };
 
        chosen {
                interrupt-controller;
        };
 
+       /*
+        * Provided for devices with RTL838xM SoC with revision A silicon.
+        * Newer SoCs can use the &mdio_aux bus instead.
+        */
+       mdio_gpio: mdio {
+               compatible = "virtual,mdio-gpio";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>,
+                       <&gpio0 3 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&mdio_aux_gpio>;
+
+               status = "disabled";
+       };
+
        soc: soc {
                compatible = "simple-bus";
                #address-cells = <1>;