From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Wed, 30 Jul 2025 12:37:12 +0000
Subject: [PATCH] b53: add Tenda AC9 switch reset workaround
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Avoid switch reset to keep it in a working state.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/phy/b53/b53_priv.h | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/net/phy/b53/b53_priv.h
+++ b/drivers/net/phy/b53/b53_priv.h
@@ -21,6 +21,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 #include <linux/switch.h>
 
 struct b53_device;
@@ -318,6 +319,14 @@ static inline int b53_write64(struct b53
 
 static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
 {
+	/*
+	 * Tenda AC9 comes with gpio2=robo_reset but performing switch reset
+	 * leaves it in a non-working state. It seems b53 swconfig driver misses
+	 * some initialization bit.
+	 */
+	if (of_machine_is_compatible("tenda,ac9"))
+		return -ENOENT;
+
 #ifdef CONFIG_BCM47XX
 	enum bcm47xx_board board = bcm47xx_board_get();
 
