ipq806x: fix Linksys EAX500 family devices dead Ethernet switch
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 17 Feb 2023 02:43:29 +0000 (03:43 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 17 Feb 2023 03:27:15 +0000 (04:27 +0100)
With 5.15 kernel version Linksys EAX500 family devices suffered from a
big regression where the Ethernet switch became silent and started to
malfunction.

It was discovered later that the cause was not really the kernel upgrade
itself but a hackish implementation of the hw implementation of these
special routers.

In the original Linksys source code, GPIO 63 was handled in a special way
and was reset on reboot.

Normally GPIO 63 is used for pcie2 reset but in every device we support,
pcie2 is actually never used as nothing is attached to it.

Linksys rerouted GPIO 63 to the switch reset pin and deviates from
common hw implementation.

Till now it was used an hack to handle this case... It was set pcie3 as
working (while actually nothing was connected), set it to output low
(for assert-deassert from the pcie init code) and be done with it.
The result was that the GPIO was reset for enough time in early boot and
everything worked correctly.
This hack implementation was born to fail from the very start and in
kernel 5.15 finally problem arised.

In 5.15 pcie code changed and now the GPIO reset pin is not asserted as
probe won't fail if nothing is connected to the line (the old behaviour)
This result in the switch hold the reset pin and the Ethernet switch
dead.

On top of that with 5.15 code got optimized and simply attaching the
GPIO reset to the mdio wasn't enough as the switch require at least 10ms
to be correctly reset.

So implement finally a correct solution where:
- pcie2 is correctly disabled (nothing attached, unused)
- drop the wrong output-low for pcie2 reset pin
- define GPIO 63 as switch reset
- Add the reset-gpios to the mdio0 node
- Set the reset-post-delay-us to 12ms to correctly give time the switch
  to reset

Fixes: #10983
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/ipq806x/files-5.10/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi
target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi
target/linux/ipq806x/patches-5.10/082-ipq8064-dtsi-tweaks.patch

index e74d2dcdbdec51e07c592bfe39f1e292292d790f..e5282efaab0ac940131ca85df8e2824b8ca15458 100644 (file)
        };
 };
 
+&qcom_pinmux {
+       /* eax500 routers reuse the pcie2 reset pin for switch reset pin */
+       switch_reset: switch_reset_pins {
+               mux {
+                       pins = "gpio63";
+                       function = "gpio";
+                       drive-strength = <12>;
+                       bias-pull-up;
+               };
+       };
+};
+
 &usb3_0 {
        status = "okay";
 };
        status = "okay";
 };
 
-&pcie2 {
-       status = "okay";
-};
-
 &nand {
        status = "okay";
 
        pinctrl-0 = <&mdio0_pins>;
        pinctrl-names = "default";
 
+       /* Switch from documentation require at least 10ms for reset */
+       reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>;
+       reset-post-delay-us = <12000>;
+
        phy0: ethernet-phy@0 {
                reg = <0>;
                qca,ar8327-initvals = <
index adf5192ac8cc0b3ce279f0e108cb5f4dde0f4630..910bd86bc5ff2c1c34cd00f8c165d9aab1151c5d 100644 (file)
        };
 };
 
+&qcom_pinmux {
+       /* eax500 routers reuse the pcie2 reset pin for switch reset pin */
+       switch_reset: switch_reset_pins {
+               mux {
+                       pins = "gpio63";
+                       function = "gpio";
+                       drive-strength = <12>;
+                       bias-pull-up;
+               };
+       };
+};
+
 &hs_phy_0 {
        status = "okay";
 };
        status = "okay";
 };
 
-&pcie2 {
-       status = "okay";
-};
-
 &nand {
        status = "okay";
 
        pinctrl-0 = <&mdio0_pins>;
        pinctrl-names = "default";
 
+       /* Switch from documentation require at least 10ms for reset */
+       reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>;
+       reset-post-delay-us = <12000>;
+
        phy0: ethernet-phy@0 {
                reg = <0>;
                qca,ar8327-initvals = <
index d6a459374939c8e21ac06368b2aab3cae1a3f9a0..301963f4f9fb3d723a8420f2d3e0083d3b269e54 100644 (file)
                        #interrupt-cells = <2>;
                        interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
  
-@@ -155,6 +156,7 @@
-                                       function = "pcie3_rst";
-                                       drive-strength = <12>;
-                                       bias-disable;
-+                                      output-low;
-                               };
-                       };
 @@ -190,6 +192,7 @@
                intc: interrupt-controller@2000000 {
                        compatible = "qcom,msm-qgic2";