From: Chen Minqiang <ptpt52@gmail.com>
To: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"Chester A. Unal" <chester.a.unal@arinc9.com>,
Daniel Golle <daniel@makrotopia.org>,
DENG Qingfang <dqfext@gmail.com>,
Sean Wang <sean.wang@mediatek.com>, Andrew Lunn <andrew@lunn.ch>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
Chen Minqiang <ptpt52@gmail.com>
Subject: [PATCH v2 2/2] net: dsa: mt7530: fix active-low reset sequence
Date: Fri, 21 Nov 2025 05:38:05 +0800 [thread overview]
Message-ID: <20251120213805.4135-2-ptpt52@gmail.com> (raw)
In-Reply-To: <20251120213805.4135-1-ptpt52@gmail.com>
With GPIO_ACTIVE_LOW configured in DTS, gpiod_set_value(1) asserts reset
(drives the line low), and gpiod_set_value(0) deasserts reset (drives high).
Update the reset sequence so that the driver:
- asserts reset by driving the GPIO low first
- waits for the required reset interval
- deasserts reset by driving it high
This ensures MT7531 receives a correct low-to-high reset pulse.
Compatibility notes:
The previous implementation contained a polarity mismatch: the DTS
described the reset line as active-high, while the driver asserted reset
by driving the GPIO low. The two mistakes matched each other, so the
reset sequence accidentally worked.
This patch fixes both sides: the DTS is corrected to use
GPIO_ACTIVE_LOW, and the driver now asserts reset by driving the line
low (value = 1 for active-low) and then deasserts it by driving it high
(value = 0).
Because the old behaviour relied on a matched pair of bugs, this change
is not compatible with mixed combinations of old DTS and new kernel, or
new DTS and old kernel. Both sides must be updated together.
Upstream DTS and upstream kernels will remain fully compatible after
this patch. Out-of-tree DT blobs must update their reset-gpios flags to
match the correct hardware polarity, or the switch may remain stuck in
reset or fail to reset properly.
There is no practical way to maintain compatibility with the previous
incorrect behaviour without adding non-detectable heuristics, so fixing
the binding and the driver together is the correct approach.
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
---
drivers/net/dsa/mt7530.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 548b85befbf4..24c9adff191d 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2405,9 +2405,9 @@ mt7530_setup(struct dsa_switch *ds)
usleep_range(5000, 5100);
reset_control_deassert(priv->rstc);
} else {
- gpiod_set_value_cansleep(priv->reset, 0);
- usleep_range(5000, 5100);
gpiod_set_value_cansleep(priv->reset, 1);
+ usleep_range(5000, 5100);
+ gpiod_set_value_cansleep(priv->reset, 0);
}
/* Waiting for MT7530 got to stable */
@@ -2643,9 +2643,9 @@ mt7531_setup(struct dsa_switch *ds)
usleep_range(5000, 5100);
reset_control_deassert(priv->rstc);
} else {
- gpiod_set_value_cansleep(priv->reset, 0);
- usleep_range(5000, 5100);
gpiod_set_value_cansleep(priv->reset, 1);
+ usleep_range(5000, 5100);
+ gpiod_set_value_cansleep(priv->reset, 0);
}
/* Waiting for MT7530 got to stable */
--
2.17.1
next prev parent reply other threads:[~2025-11-20 21:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 21:38 [PATCH v2 1/2] ARM64: dts: mediatek: fix MT7531 reset GPIO polarity on multiple boards Chen Minqiang
2025-11-20 21:38 ` Chen Minqiang [this message]
2025-11-20 21:57 ` [PATCH v2 2/2] net: dsa: mt7530: fix active-low reset sequence Vladimir Oltean
2025-11-20 22:08 ` [PATCH v2 1/2] ARM64: dts: mediatek: fix MT7531 reset GPIO polarity on multiple boards Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251120213805.4135-2-ptpt52@gmail.com \
--to=ptpt52@gmail.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chester.a.unal@arinc9.com \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=dqfext@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).