From d4bf16a9e1618347709b0dccae71c273e6291a61 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 21 Jan 2025 19:40:11 +0100 Subject: [PATCH] realtek: Add virtual MDIO bus on rtl838x 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 --- target/linux/realtek/dts/rtl838x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/target/linux/realtek/dts/rtl838x.dtsi b/target/linux/realtek/dts/rtl838x.dtsi index ab034fc1bc..18da4c9380 100644 --- a/target/linux/realtek/dts/rtl838x.dtsi +++ b/target/linux/realtek/dts/rtl838x.dtsi @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include +#include /dts-v1/; @@ -120,6 +121,7 @@ aliases { serial0 = &uart0; serial1 = &uart1; + mdio-gpio1 = &mdio_gpio; }; chosen { @@ -134,6 +136,22 @@ 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>; -- 2.30.2