ath79: use hardware MDIO on MikroTik RouterBOARD wAP G-5HacT2HnD
authorSander Vanheule <sander@svanheule.net>
Tue, 21 Jul 2020 19:49:53 +0000 (21:49 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Mon, 25 Jan 2021 17:53:29 +0000 (18:53 +0100)
Instead of using a bit-banged GPIO, configure the GPIO output mux to use
the SoC's MDIO functionality. According to the QCA955x datasheet, MDIO1
is associated with the use of SGMII.

The following changes are also made:
* Drop phy-mode from phy0: the ar71xx driver looks for this property in
  ethX nodes, but the correct value is already specified in the dtsi.
* Drop the deprecated 'device-type = "ethernet-phy"' for phy0.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
[drop mdio2 from aliases]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts

index a3f9ec28a4717381e4703980935f84b1d073be45..dbfe773577a73138e3f423576cf71139639f3c27 100644 (file)
@@ -10,7 +10,6 @@
        model = "MikroTik RouterBOARD wAP G-5HacT2HnD";
 
        aliases {
-               mdio-gpio1 = &mdio2;
                serial0 = &uart;
        };
 
                        debounce-interval = <60>;
                };
        };
+};
 
-       mdio2: mdio {
-               compatible = "virtual,mdio-gpio";
+&pinmux {
+       mdio_pins: mdio_pins {
+               /* GPIO 11 as MDIO(0x20), GPIO 12 as MDC(0x21) */
+               pinctrl-single,bits = <0x8 0x20000000 0xff000000>,
+                                     <0xc 0x00000021 0x000000ff>;
+       };
+};
 
-               gpios = <&gpio 12 GPIO_ACTIVE_HIGH>, /* MDC */
-                       <&gpio 11 GPIO_ACTIVE_HIGH>; /* MDIO */
-               #address-cells = <1>;
-               #size-cells = <0>;
+&mdio1 {
+       status = "okay";
 
-               phy0: ethernet-phy@0 {
-                       reg = <0>;
-                       device_type = "ethernet-phy";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio_pins>;
 
-                       phy-mode = "sgmii";
+       phy-mask = <0x1>;
 
-                       at803x-override-sgmii-link-check;
-               };
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+               at803x-override-sgmii-link-check;
        };
 };